Unlabelled experiment & interactions between attributes
Posted: 22 Sep 2022, 15:34
Dear all,
I am new to the forum and after finding the d-efficient design for my unlabelled experiment (two alternatives: 1 & 2), and collecting pilot data, I am now preparing for the choice modelling.
The five attributes & corresponding levels are the following:
Years of life (yol): 0.5, 1, 3
Quality of life gains (qol): 20, 40, 60
Experience (exp): Poor(0), Fair(1), Good(2)
Size (size): 50, 5000, 10000
Equity (equ): 25, 50, 75
Apart from interactions with socio-demographics, I want to add interactions between two of the continuous attributes yol & qol. I am trying the following in R, but it is not working:
### Vector of parameters, including any that are kept fixed in estimation
apollo_beta=c(asc = 0,
byol = 0,
bqol = 0,
bexp_fair = 0,
bexp_good = 0,
bsize = 0,
bequ = 0,
bage = 0,
byol_female = 0
)
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 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()
### Create coefficients with interactions
b_years = byol + byol_female * (female==1)
b_yolqol1 = bqol + byol*yol1
b_yolqol2 = bqol + byol*yol2
### List of utilities: these must use the same names as in mnl_settings, order is irrelevant
V = list()
V[["Alt1"]] = asc + b_years*yol1 + b_yolqol1*qol1 + bexp_fair*(exp1==1) + bexp_good*(exp1==2) + bsize*size1 + bequ*equ1 + bage*age
V[["Alt2"]] = b_years*yol2 + b_yolqol2*qol2 + bexp_fair*(exp2==1) + bexp_good*(exp2==2) + bsize*size2 + bequ*equ2
OR should I simply add directly to the interactions between attributes to the utility functions (this one is working, but I want to confirm whether this is okay):
### Vector of parameters, including any that are kept fixed in estimation
apollo_beta=c(asc = 0,
byol = 0,
bqol = 0,
bqy = 0,
bexp_fair = 0,
bexp_good = 0,
bsize = 0,
bequ = 0,
bage = 0,
byol_female = 0
)
### Create coefficients with interactions (only with socio-demographics):
b_years = byol + byol_female * (female==1)
### List of utilities: these must use the same names as in mnl_settings, order is irrelevant
V = list()
V[["Alt1"]] = asc + b_years*yol1 + bqol*qol1 + bqy*((qol1)*yol1) + bexp_fair*(exp1==1) + bexp_good*(exp1==2) + bsize*size1 + bequ*equ1 + bage*age
V[["Alt2"]] = b_ years*yol2 + bqol*qol2 + bqy*((qol2)*yol2) + bexp_fair*(exp2==1) + bexp_good*(exp2==2) + bsize*size2 + bequ*equ2
I would appreciate very much your help with this. Thanks!
Best wishes,
Pamela.
I am new to the forum and after finding the d-efficient design for my unlabelled experiment (two alternatives: 1 & 2), and collecting pilot data, I am now preparing for the choice modelling.
The five attributes & corresponding levels are the following:
Years of life (yol): 0.5, 1, 3
Quality of life gains (qol): 20, 40, 60
Experience (exp): Poor(0), Fair(1), Good(2)
Size (size): 50, 5000, 10000
Equity (equ): 25, 50, 75
Apart from interactions with socio-demographics, I want to add interactions between two of the continuous attributes yol & qol. I am trying the following in R, but it is not working:
### Vector of parameters, including any that are kept fixed in estimation
apollo_beta=c(asc = 0,
byol = 0,
bqol = 0,
bexp_fair = 0,
bexp_good = 0,
bsize = 0,
bequ = 0,
bage = 0,
byol_female = 0
)
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 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()
### Create coefficients with interactions
b_years = byol + byol_female * (female==1)
b_yolqol1 = bqol + byol*yol1
b_yolqol2 = bqol + byol*yol2
### List of utilities: these must use the same names as in mnl_settings, order is irrelevant
V = list()
V[["Alt1"]] = asc + b_years*yol1 + b_yolqol1*qol1 + bexp_fair*(exp1==1) + bexp_good*(exp1==2) + bsize*size1 + bequ*equ1 + bage*age
V[["Alt2"]] = b_years*yol2 + b_yolqol2*qol2 + bexp_fair*(exp2==1) + bexp_good*(exp2==2) + bsize*size2 + bequ*equ2
OR should I simply add directly to the interactions between attributes to the utility functions (this one is working, but I want to confirm whether this is okay):
### Vector of parameters, including any that are kept fixed in estimation
apollo_beta=c(asc = 0,
byol = 0,
bqol = 0,
bqy = 0,
bexp_fair = 0,
bexp_good = 0,
bsize = 0,
bequ = 0,
bage = 0,
byol_female = 0
)
### Create coefficients with interactions (only with socio-demographics):
b_years = byol + byol_female * (female==1)
### List of utilities: these must use the same names as in mnl_settings, order is irrelevant
V = list()
V[["Alt1"]] = asc + b_years*yol1 + bqol*qol1 + bqy*((qol1)*yol1) + bexp_fair*(exp1==1) + bexp_good*(exp1==2) + bsize*size1 + bequ*equ1 + bage*age
V[["Alt2"]] = b_ years*yol2 + bqol*qol2 + bqy*((qol2)*yol2) + bexp_fair*(exp2==1) + bexp_good*(exp2==2) + bsize*size2 + bequ*equ2
I would appreciate very much your help with this. Thanks!
Best wishes,
Pamela.