Unlabelled DCE with fixed status quo
Posted: 17 Apr 2022, 18:02
Hello,
I have conducted a pretest for my DCE.
The DCE has one fixed status quo (which is the same in all choice sets) plus two alternatives per choice set, each respondent answering nine choice tasks each.
The first attribute (Beitr) is a linear variable with the following levels [1.6; 1.8; 3.3; 4.8] where level “1.6” only is used for fixed status quo. The other three levels are used in the alternatives only.
The second (HoeheEEE) and third attribute (ZeitEEE) are categorical variables with the following levels:
HoeheEEE [unlimited, 300, 600, 900]
ZeitEEE [unlimited, 12 ,36 ,72]
The level “unlimited” is used in fixed status quo as well as the alternatives.
I am now especially wondering on
- if I defined right the dummy variables for attr2 and attr3
- how to define “apollo_beta”
- how to define the “list of MNL utilities” especially with regard to V[["SQ"]] because I will not be able to estimate HoeheEEE1 and ZeitEEE1 as they are fixed for status quo?!
Please see below my code so far:
# ################################################################# #
#### LOAD DATA AND APPLY ANY TRANSFORMATIONS ####
# ################################################################# #
Daten_Choice_Pivot <- read.csv("DatenApollo.csv", header = TRUE)
## Defining levels of Attribute 1
Daten_Choice_Pivot$Beitr_1[which(Daten_Choice_Pivot$Beitr_1==1)] <- 1.6
Daten_Choice_Pivot$Beitr_1[which(Daten_Choice_Pivot$Beitr_1==2)] <- 1.8
Daten_Choice_Pivot$Beitr_1[which(Daten_Choice_Pivot$Beitr_1==3)] <- 3.3
Daten_Choice_Pivot$Beitr_1[which(Daten_Choice_Pivot$Beitr_1==4)] <- 4.8
Daten_Choice_Pivot$Beitr_2[which(Daten_Choice_Pivot$Beitr_2==1)] <- 1.6
Daten_Choice_Pivot$Beitr_2[which(Daten_Choice_Pivot$Beitr_2==2)] <- 1.8
Daten_Choice_Pivot$Beitr_2[which(Daten_Choice_Pivot$Beitr_2==3)] <- 3.3
Daten_Choice_Pivot$Beitr_2[which(Daten_Choice_Pivot$Beitr_2==4)] <- 4.8
Daten_Choice_Pivot$Beitr_3[which(Daten_Choice_Pivot$Beitr_3==1)] <- 1.6
Daten_Choice_Pivot$Beitr_3[which(Daten_Choice_Pivot$Beitr_3==2)] <- 1.8
Daten_Choice_Pivot$Beitr_3[which(Daten_Choice_Pivot$Beitr_3==3)] <- 3.3
Daten_Choice_Pivot$Beitr_3[which(Daten_Choice_Pivot$Beitr_3==4)] <- 4.8
## Defining Attribute 2 as dummy variable
Daten_Choice_Pivot$HoeheEEE_2_1 <- ifelse(Daten_Choice_Pivot$HoeheEEE_2==1,1,0)
Daten_Choice_Pivot$HoeheEEE_2_2 <- ifelse(Daten_Choice_Pivot$HoeheEEE_2==2,1,0)
Daten_Choice_Pivot$HoeheEEE_2_3 <- ifelse(Daten_Choice_Pivot$HoeheEEE_2==3,1,0)
Daten_Choice_Pivot$HoeheEEE_3_1 <- ifelse(Daten_Choice_Pivot$HoeheEEE_3==1,1,0)
Daten_Choice_Pivot$HoeheEEE_3_2 <- ifelse(Daten_Choice_Pivot$HoeheEEE_3==2,1,0)
Daten_Choice_Pivot$HoeheEEE_3_3 <- ifelse(Daten_Choice_Pivot$HoeheEEE_3==3,1,0)
## Defining Attribute 3 as dummy variable
Daten_Choice_Pivot$ZeitEEE_2_1 <- ifelse(Daten_Choice_Pivot$ZeitEEE_2==1,1,0)
Daten_Choice_Pivot$ZeitEEE_2_2 <- ifelse(Daten_Choice_Pivot$ZeitEEE_2==2,1,0)
Daten_Choice_Pivot$ZeitEEE_2_3 <- ifelse(Daten_Choice_Pivot$ZeitEEE_2==3,1,0)
Daten_Choice_Pivot$ZeitEEE_3_1 <- ifelse(Daten_Choice_Pivot$ZeitEEE_3==1,1,0)
Daten_Choice_Pivot$ZeitEEE_3_2 <- ifelse(Daten_Choice_Pivot$ZeitEEE_3==2,1,0)
Daten_Choice_Pivot$ZeitEEE_3_3 <- ifelse(Daten_Choice_Pivot$ZeitEEE_3==3,1,0)
database = Daten_Choice_Pivot
# ################################################################# #
#### DEFINE MODEL PARAMETERS ####
# ################################################################# #
### Vector of parameters, including any kept fixed during estimation
apollo_beta = c(Beitr = 0,
HoeheEEE_2_1 = 0, HoeheEEE_2_2 = 0, HoeheEEE_2_3 = 0, HoeheEEE_3_1 = 0, HoeheEEE_3_2 = 0, HoeheEEE_3_3 = 0,
ZeitEEE_2_1 = 0, ZeitEEE_2_2 = 0, ZeitEEE_2_3 = 0, ZeitEEE_3_1 = 0, ZeitEEE_3_2 = 0, ZeitEEE_3_3 = 0)
### Vector with parameter names (in quotes) to be kept fixed at
# their starting values during estimation.
apollo_fixed = c()
# ################################################################# #
#### GROUP AND VALIDATE INPUTS ####
# ################################################################# #
apollo_inputs = apollo_validateInputs()
# ################################################################# #
#### DEFINE MODEL AND LIKELIHOOD FUNCTION ####
# ################################################################# #
apollo_probabilities=function(apollo_beta, apollo_inputs,
functionality="estimate"){
### Function initialisation: do not change the following three commands
### Attach and detach inputs, and create empty list of probabilities
apollo_attach(apollo_beta, apollo_inputs)
on.exit(apollo_detach(apollo_beta, apollo_inputs))
P = list()
### List of MNL utilities: must use the same names as in mnl_settings
V = list()
V[["SQ"]] = Beitr*Beitr_1 + HoeheEEE*HoeheEEE_1 + ZeitEEE*ZeitEEE_1
V[["RefA"]] = Beitr*Beitr_2 + HoeheEEE*HoeheEEE_2 + ZeitEEE*ZeitEEE_2
V[["RefB"]] = Beitr*Beitr_3 + HoeheEEE*HoeheEEE_3 + ZeitEEE*ZeitEEE_3
### Define settings for MNL model component
mnl_settings = list(
alternatives = c(SQ=1, RefA=2, RefB=3),
choiceVar = Choice,
utilities = V
)
### Compute probabilities using MNL model
P[["model"]] = apollo_mnl(mnl_settings, functionality)
### Comment out as necessary
P = apollo_panelProd(P, apollo_inputs, functionality)
P = apollo_prepareProb(P, apollo_inputs, functionality)
return(P)
}
# ################################################################# #
#### MODEL ESTIMATION AND OUTPUT ####
# ################################################################# #
model = apollo_estimate(apollo_beta, apollo_fixed,
apollo_probabilities, apollo_inputs)
apollo_modelOutput(model)
apollo_saveOutput(model)
Any help is highly appreciated!
Thank you very much in advance.
Best regards,
J.
I have conducted a pretest for my DCE.
The DCE has one fixed status quo (which is the same in all choice sets) plus two alternatives per choice set, each respondent answering nine choice tasks each.
The first attribute (Beitr) is a linear variable with the following levels [1.6; 1.8; 3.3; 4.8] where level “1.6” only is used for fixed status quo. The other three levels are used in the alternatives only.
The second (HoeheEEE) and third attribute (ZeitEEE) are categorical variables with the following levels:
HoeheEEE [unlimited, 300, 600, 900]
ZeitEEE [unlimited, 12 ,36 ,72]
The level “unlimited” is used in fixed status quo as well as the alternatives.
I am now especially wondering on
- if I defined right the dummy variables for attr2 and attr3
- how to define “apollo_beta”
- how to define the “list of MNL utilities” especially with regard to V[["SQ"]] because I will not be able to estimate HoeheEEE1 and ZeitEEE1 as they are fixed for status quo?!
Please see below my code so far:
# ################################################################# #
#### LOAD DATA AND APPLY ANY TRANSFORMATIONS ####
# ################################################################# #
Daten_Choice_Pivot <- read.csv("DatenApollo.csv", header = TRUE)
## Defining levels of Attribute 1
Daten_Choice_Pivot$Beitr_1[which(Daten_Choice_Pivot$Beitr_1==1)] <- 1.6
Daten_Choice_Pivot$Beitr_1[which(Daten_Choice_Pivot$Beitr_1==2)] <- 1.8
Daten_Choice_Pivot$Beitr_1[which(Daten_Choice_Pivot$Beitr_1==3)] <- 3.3
Daten_Choice_Pivot$Beitr_1[which(Daten_Choice_Pivot$Beitr_1==4)] <- 4.8
Daten_Choice_Pivot$Beitr_2[which(Daten_Choice_Pivot$Beitr_2==1)] <- 1.6
Daten_Choice_Pivot$Beitr_2[which(Daten_Choice_Pivot$Beitr_2==2)] <- 1.8
Daten_Choice_Pivot$Beitr_2[which(Daten_Choice_Pivot$Beitr_2==3)] <- 3.3
Daten_Choice_Pivot$Beitr_2[which(Daten_Choice_Pivot$Beitr_2==4)] <- 4.8
Daten_Choice_Pivot$Beitr_3[which(Daten_Choice_Pivot$Beitr_3==1)] <- 1.6
Daten_Choice_Pivot$Beitr_3[which(Daten_Choice_Pivot$Beitr_3==2)] <- 1.8
Daten_Choice_Pivot$Beitr_3[which(Daten_Choice_Pivot$Beitr_3==3)] <- 3.3
Daten_Choice_Pivot$Beitr_3[which(Daten_Choice_Pivot$Beitr_3==4)] <- 4.8
## Defining Attribute 2 as dummy variable
Daten_Choice_Pivot$HoeheEEE_2_1 <- ifelse(Daten_Choice_Pivot$HoeheEEE_2==1,1,0)
Daten_Choice_Pivot$HoeheEEE_2_2 <- ifelse(Daten_Choice_Pivot$HoeheEEE_2==2,1,0)
Daten_Choice_Pivot$HoeheEEE_2_3 <- ifelse(Daten_Choice_Pivot$HoeheEEE_2==3,1,0)
Daten_Choice_Pivot$HoeheEEE_3_1 <- ifelse(Daten_Choice_Pivot$HoeheEEE_3==1,1,0)
Daten_Choice_Pivot$HoeheEEE_3_2 <- ifelse(Daten_Choice_Pivot$HoeheEEE_3==2,1,0)
Daten_Choice_Pivot$HoeheEEE_3_3 <- ifelse(Daten_Choice_Pivot$HoeheEEE_3==3,1,0)
## Defining Attribute 3 as dummy variable
Daten_Choice_Pivot$ZeitEEE_2_1 <- ifelse(Daten_Choice_Pivot$ZeitEEE_2==1,1,0)
Daten_Choice_Pivot$ZeitEEE_2_2 <- ifelse(Daten_Choice_Pivot$ZeitEEE_2==2,1,0)
Daten_Choice_Pivot$ZeitEEE_2_3 <- ifelse(Daten_Choice_Pivot$ZeitEEE_2==3,1,0)
Daten_Choice_Pivot$ZeitEEE_3_1 <- ifelse(Daten_Choice_Pivot$ZeitEEE_3==1,1,0)
Daten_Choice_Pivot$ZeitEEE_3_2 <- ifelse(Daten_Choice_Pivot$ZeitEEE_3==2,1,0)
Daten_Choice_Pivot$ZeitEEE_3_3 <- ifelse(Daten_Choice_Pivot$ZeitEEE_3==3,1,0)
database = Daten_Choice_Pivot
# ################################################################# #
#### DEFINE MODEL PARAMETERS ####
# ################################################################# #
### Vector of parameters, including any kept fixed during estimation
apollo_beta = c(Beitr = 0,
HoeheEEE_2_1 = 0, HoeheEEE_2_2 = 0, HoeheEEE_2_3 = 0, HoeheEEE_3_1 = 0, HoeheEEE_3_2 = 0, HoeheEEE_3_3 = 0,
ZeitEEE_2_1 = 0, ZeitEEE_2_2 = 0, ZeitEEE_2_3 = 0, ZeitEEE_3_1 = 0, ZeitEEE_3_2 = 0, ZeitEEE_3_3 = 0)
### Vector with parameter names (in quotes) to be kept fixed at
# their starting values during estimation.
apollo_fixed = c()
# ################################################################# #
#### GROUP AND VALIDATE INPUTS ####
# ################################################################# #
apollo_inputs = apollo_validateInputs()
# ################################################################# #
#### DEFINE MODEL AND LIKELIHOOD FUNCTION ####
# ################################################################# #
apollo_probabilities=function(apollo_beta, apollo_inputs,
functionality="estimate"){
### Function initialisation: do not change the following three commands
### Attach and detach inputs, and create empty list of probabilities
apollo_attach(apollo_beta, apollo_inputs)
on.exit(apollo_detach(apollo_beta, apollo_inputs))
P = list()
### List of MNL utilities: must use the same names as in mnl_settings
V = list()
V[["SQ"]] = Beitr*Beitr_1 + HoeheEEE*HoeheEEE_1 + ZeitEEE*ZeitEEE_1
V[["RefA"]] = Beitr*Beitr_2 + HoeheEEE*HoeheEEE_2 + ZeitEEE*ZeitEEE_2
V[["RefB"]] = Beitr*Beitr_3 + HoeheEEE*HoeheEEE_3 + ZeitEEE*ZeitEEE_3
### Define settings for MNL model component
mnl_settings = list(
alternatives = c(SQ=1, RefA=2, RefB=3),
choiceVar = Choice,
utilities = V
)
### Compute probabilities using MNL model
P[["model"]] = apollo_mnl(mnl_settings, functionality)
### Comment out as necessary
P = apollo_panelProd(P, apollo_inputs, functionality)
P = apollo_prepareProb(P, apollo_inputs, functionality)
return(P)
}
# ################################################################# #
#### MODEL ESTIMATION AND OUTPUT ####
# ################################################################# #
model = apollo_estimate(apollo_beta, apollo_fixed,
apollo_probabilities, apollo_inputs)
apollo_modelOutput(model)
apollo_saveOutput(model)
Any help is highly appreciated!
Thank you very much in advance.
Best regards,
J.