Hi I am trying to use gmnl function in r. There are three alternative-specific variables beat1,beta2, and beta3. There are two individual-specific variables Z1 and Z2. I want to set Z1 and Z2 as scale varies and observed heterogeneity random parameters. I get the error saying"The following random variables are not in the data: Z1, Z2". In my Data file, I do have Beta1 to 3 , Z1&2, id and TID.
Does anyone have comments or suggestions?
My code is below:
MData=mlogit.data(Data,choice="Choice",shape = "long",id.var= ("id"),chid.var=("TID"), drop.index = TRUE)
GMNL=gmnl(Choice~Beta1+Beta2+Beta3|1|0|0| Z1 + Z2-1,
halton = NA,
panel = TRUE,
notscale = c(1,1,1,1,rep(0, 5)),
ranp=c(Beta1="n", Beta2="n", Beta3="n", Z1="n", Z2="n"),
init.gamma = 0,