Hi, Can someone help me in resolving the error I am having in trying to use gmnl. See code below and the error message
# Set your working directory appropriately
setwd("C:\\examples_v0.2.8")
wtp_ajare <- read.csv("C:\\examples_v0.2.8/pooled.csv")
head(wtp_ajare,3) #check it uploaded data
attach(wtp_ajare)
## put data into mlogit.data form for multinomial logit models
data.ml<-mlogit.data(data=wtp_ajare,
choice="choice",
shape="long",
alt.var = "alt",
id.var="id",
idx = c("id", "pid"))
head(data.ml,3) #check data
#create price and buy
price1 <-price/1000
buy <- 1 - nobuy
wtp_rplec_pools6 <- gmnl(choice ~ price1 + nobuy + korea + usa + irra + buy |0|0|0|1,
data = data.ml,
model = 'gmnl',
ranp = c(korea="n", usa="n", irra="n", buy="n"),
correlation = T,
panel = T,
#notscale = c(rep(0,6)),
start = c(-1, rep(0,4), 0, rep(0,11),0,0),
fixed = c(TRUE, rep(FALSE, 4), TRUE, rep(FALSE, 11), FALSE, TRUE), # mean of Buy is fixed at 0
print.init = TRUE,
R = 50,
method = "bhhh",
#print.level = 2,
iterlim = 500)
summary(wtp_rplec_pools6)
###########Use start Values from wtp_rplec_pools6
wtp_rplec_pools7 <- gmnl(choice ~ price1 + nobuy + korea + usa + irra + buy |0|0|0|1,
data = data.ml,
model = 'gmnl',
ranp = c(korea="n", usa="n", irra="n", buy="n"),
correlation = T,
panel = T,
#notscale = c(rep(0,6)),
start = c(-1,-10.796535,3.984897,-3.491923,-1.275958,0,-0.736515,2.365229, -2.804438,2.556293,-2.768052,-3.122557, -5.716975,-0.446425,0.199051,4.200909, -2.973468,0.1,0),
fixed = c(TRUE, rep(FALSE, 4), TRUE, rep(FALSE, 11), FALSE, TRUE), # mean of Buy is fixed at 0
print.init = TRUE,
R = 250,
method = "bhhh",
#print.level = 2,
iterlim = 500)
summary(wtp_rplec_pools7)
Error in gmnl(choice ~ price1 + nobuy + korea + usa + irra + buy | 0 | :
No individual index