# NOT RUN {
## Examples using Electricity data set from mlogit package
library(mlogit)
data("Electricity", package = "mlogit")
Electr <- mlogit.data(Electricity, id.var = "id", choice = "choice",
varying = 3:26, shape = "wide", sep = "")
## Estimate a MIXL model with correlated random parameters
Elec.cor <- gmnl(choice ~ pf + cl + loc + wk + tod + seas| 0, data = Electr,
subset = 1:3000,
model = 'mixl',
R = 10,
panel = TRUE,
ranp = c(cl = "n", loc = "n", wk = "n", tod = "n", seas = "n"),
correlation = TRUE)
## Use functions for correlated random parameters
cov.gmnl(Elec.cor)
se.cov.gmnl(Elec.cor)
se.cov.gmnl(Elec.cor, sd = TRUE)
cor.gmnl(Elec.cor)
# }
Run the code above in your browser using DataLab