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

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!



Solution 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mahdi