Random Variable part in gmnl (R); Error: Random Variable are not in the data

246 Views Asked by At

Error Message in Random Parameter Part in gmnl code: "The following random variables are not in the data"

I'm estimating a mixed MNL model, however, the gmnl keeps giving me the error message suggesting that the random part variable is NOT in the data. But it is in the data.

My data is:

    choice ID alt RankofSubscrn DistToLastSubscrn
1.1   TRUE 1   1  -1.460        -0.684
1.2  FALSE 2   2  -1.095        -0.851
1.3  FALSE 2   3  -0.730        -1.361

My code is:

gmnl(choice ~ DistToLastSubscrn|0, 
  data = tempdata,
  model = 'mixl',
  panel = TRUE, 
  ranp = c(DistToLastSubscrn="n"))

Then it will say:

Error in gmnl(choice ~ DistToLastSubscrn | 0, data = tempdata, model = "mixl",  : 
The following random variables are not in the data:  DistToLastSubscrn

However, this variable "DistToLastSubscrn" is in my tempdata. Please help!

1

There are 1 best solutions below

0
mahdi On

Probability you predictors are factors. Convert them into integer, the problem would be solved.