Page 1 of 1

MDCNEV

Posted: 13 Jan 2022, 20:50
by punyabeet
Hi Prof Hess

Is the apollo package capable to estimate a cross-nested MDCEV model?
I tried to modify apollo_example_13.r and run the model but I get the following error :

Error in mdcnev_settings$mdcnevNests[[which(as.vector(mdcnev_settings$mdcnevStructure[, :
subscript out of bounds

These are the modifications I did in the code:

Fragment 1
### Vector of parameters, including any that are kept fixed in estimation
apollo_beta = c(alpha_base = 0,
gamma_work = 1,
gamma_school = 1,
gamma_shopping = 1,
gamma_private = 1,
gamma_leisure = 1,
delta_work = 0,
delta_school = 0,
delta_shopping = 0,
delta_private = 0,
delta_leisure = 0,
delta_work_FT = 0,
delta_work_wknd = 0,
delta_school_young = 0,
delta_leisure_wknd = 0,
theta_subsistence = 0.9,
theta_nonwork = 0.9,
theta_other = 0.9,
alpha0_shopping_subsistence = 0,
alpha0_shopping_nonwork = 0)

### Vector with names (in quotes) of parameters to be kept fixed at their starting value
apollo_fixed = c("theta_other", "alpha0_shopping_nonwork")

Fragment 2
### Define nesting structure
mdcnevNests = list(subsistence = theta_subsistence,
nonwork = theta_nonwork,
other = theta_other)

### Specify nest allocation parameters for alternatives included in multiple nests
alpha_shopping_subsistence = exp(alpha0_shopping_subsistence)/(exp(alpha0_shopping_subsistence) + exp(alpha0_shopping_nonwork))
alpha_shopping_nonwork = 1 - alpha_shopping_subsistence

mdcnevStructure = matrix(0, nrow=length(mdcnevNests), ncol=length(V))
### outside work school shopping private leisure
mdcnevStructure[1,] = c( 0, 1, 1, alpha_shopping_subsistence, 0, 0) # subsistence
mdcnevStructure[2,] = c( 0, 0, 0, alpha_shopping_nonwork, 0, 1) # nonwork
mdcnevStructure[3,] = c( 1, 0, 0, 0, 1, 0) # other

Re: MDCNEV

Posted: 14 Jan 2022, 16:12
by stephanehess
Hi

the MDCNEV model assumes that each alternative falls into exactly one nest.

We will improve the error message that you're getting, but all the columns in mdcnevStructure need to only include 0/1 values, and sum to 1 across rows

Stephane

Re: MDCNEV

Posted: 14 Jan 2022, 17:10
by punyabeet
Thanks, Prof Hess for the clarification.