First of all, thanks prof. Hess and prof. Palma for creating such a useful package and being so helpful towards us normal people that use it.
I am writing here to ask about a DCE that I have created and that I am trying to analyse using Apollo.
I have to admit that statistics is not my greatest strength so that's where my doubts come from. So forgive me for asking possibly dumb questions.
Here's the idea: we're asking people about whether they want to invest in a public project which has four attributes, or they prefer to stay with the default choice (i.e. not investing in anything and stay with the status quo).
The attributes of the two alternatives are: A, as the cost of the project (continuous variable); B, the CO2 savings (defined in three levels, which I am not sure whether to treat as continuous or categorical);C, the type of the construction (three levels according to each type, so a categorical); D, an attribute which takes value 50% and 100%. The second alternative (no project) has all the attributes set at 0, logically, as it is the status quo.
So, my doubts are the following:
1) in this case, using a MNL model is still a valid choice? or a logit model would still be suitable, or even better?
2) is it better to code the CO2 levels as a continuous or categorical variable? also, the three levels are equally distant from each other.
3) how do I add the socio-demographic variables in the model? Is it correct to interact them with the two alternatives? e.g. the two coefficients for gender would give me how much being a female increases the chance of choosing the first alternative, and the same for the chance of choosing the second alternative.
4) Is it correct if I define the utility functions as for the following code
Code: Select all
### Set core controls
apollo_control = list(
modelName = "DCE",
modelDescr = "dcetest",
indivID = "RID",
outputDirectory = "output",
estimationRoutine = "ml",
nCores = 4
)
### Vector of parameters, including any that are kept fixed in estimation
apollo_beta = c(
asc_opt1 = 0,
asc_opt2 = 0,
b_A = 0,
b_B = 0,
b_D = 0,
b_C1 = 0,
b_C2 = 0,
b_C3 = 0
)
### Vector with names (in quotes) of parameters to be kept fixed at their starting value in apollo_beta, use apollo_beta_fixed = c() if none
apollo_fixed = c("asc_opt2","b_C3")
# ################################################################# #
#### GROUP AND VALIDATE INPUTS ####
# ################################################################# #
apollo_inputs = apollo_validateInputs()
# ################################################################# #
#### DEFINE MODEL AND LIKELIHOOD FUNCTION ####
# ################################################################# #
apollo_probabilities=function(apollo_beta, apollo_inputs, functionality="estimate"){
### Attach inputs and detach after function exit
apollo_attach(apollo_beta, apollo_inputs)
on.exit(apollo_detach(apollo_beta, apollo_inputs))
### Create list of probabilities P
P = list()
### List of utilities: these must use the same names as in mnl_settings, order is irrelevant
V = list()
V[['opt1']] = asc_opt1 +
b_A * A_opt1 +
b_B * B_opt1 +
b_D * D_opt1 +
b_C1 * C_C1_opt1 +
b_C2 * C_C2_opt1 +
b_C3 * C_C3_opt1
V[['opt2']] = asc_opt2
### Define settings for MNL model component
mnl_settings = list(
alternatives = c(opt1=1, opt2=0),
avail = 1,
choiceVar = Choice,
V = V
)
### Compute probabilities using MNL model
P[['model']] = apollo_mnl(mnl_settings, functionality)
# ### Take product across observation for same individual
P = apollo_panelProd(P, apollo_inputs, functionality)
#
### Prepare and return outputs of function
P = apollo_prepareProb(P, apollo_inputs, functionality)
return(P)
}
# ################################################################# #
#### MODEL ESTIMATION ####
# ################################################################# #
model = apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, apollo_inputs)
Final question: does it all make sense to you guys?
I would really appreciate any help from you about this.
Thanks in advance for any answer you might give me.