Page 1 of 1

Effects coding MNL model and relative importance.

Posted: 23 Jan 2024, 16:06
by El2023
Dear Apollo Choice Modelling forum,

Lately I have conducted a DCE with three attributes ("goede voorspelling", "onterecht ingrijpen", "onterecht geruststellen") with three attribute levels each that all consist of different percentages (Goede voorspelling: 90%, 70%, 50%(ref), Onterecht ingrijpen: 50%, 52%, 5%(ref), Onterecht geruststellen: 20%, 10%, 1% (ref)).

I want to estimate a simple MNL model using effects coding. I have chosen to use effects coding, because I prefer to also report a Beta-coefficient for the reference category (in dummy coding this is set to zero).

I have inserted an effects coding constraint in my R script. I have provided the code and output below. I have a few questions:
1. Am I doing this correctly?
2. In my model estimations, no Beta coefficient is provided for the reference category. It makes sense that I can calculate the Beta of the reference category using the coding constraint: ("b_Goede_voorspelling_50 = - b_Goede_voorspelling_70 - b_Goede_voorspelling_90"), is this correct?
3. How do I calculate the p-value for the Beta of the reference category? I would like to report this in the results of my paper.
4. I have now specified the attributes as categorical variables using effects coding. However, if the effect is linear, I could perhaps also insert them into the model as continuous variables. Is this a reasonable thought and how can I check linearity for each attribute?
3. To calculate the relative importance of each attribute, I calculated the distances between the lowest and highest attribute level coefficient for each attribute, added these distances for all attributes (total distance), and then calculated the percentage that the distance of each attribute contributed to the total distance. Is this an appropriate method? I found the method in this paper:(https://www.researchgate.net/publicatio ... Importance).

Thank you very much in advance for your help.

Kind regards,
Ellis


##############################################################################
apollo_control = list( modelName = "MNL_DCE_data",
modelDescr = "Simple MNL model on DCE choice data using effects coding",
indivID = "ID",
outputDirectory = "output")

apollo_beta=c(asc_choice1 = 0,
b_Goede_voorspelling_70 = 0,
b_Goede_voorspelling_90 = 0,
b_Onterecht_Ingrijpen_50 = 0,
b_Onterecht_Ingrijpen_25 = 0,
b_Onterecht_Geruststellen_20 = 0,
b_Onterecht_Geruststellen_10 = 0
)

apollo_fixed = c()
apollo_inputs = apollo_validateInputs()

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()

# effects coding constraint
b_Goede_voorspelling_50 = - b_Goede_voorspelling_70 - b_Goede_voorspelling_90
b_Onterecht_Ingrijpen_5 = - b_Onterecht_Ingrijpen_25 - b_Onterecht_Ingrijpen_50
b_Onterecht_Geruststellen_1 = - b_Onterecht_Geruststellen_10 - b_Onterecht_Geruststellen_20

### List of utilities: these must use the same names as in mnl_settings, order is irrelevant
V = list()
V[["choice1"]] = asc_choice1 + b_Goede_voorspelling_50 * (GV1 ==1) + b_Goede_voorspelling_70 * (GV1 ==2) + b_Goede_voorspelling_90 * (GV1 ==3) + b_Onterecht_Ingrijpen_50 * (OI1 ==1) + b_Onterecht_Ingrijpen_25 * (OI1 ==2) + b_Onterecht_Ingrijpen_5 * (OI1 ==3) + b_Onterecht_Geruststellen_20 * (OG1 ==1) + b_Onterecht_Geruststellen_10 * (OG1 ==2) + b_Onterecht_Geruststellen_1 * (OG1 ==3)

V[["choice2"]] = b_Goede_voorspelling_50 * (GV2 ==1) + b_Goede_voorspelling_70 * (GV2 ==2) + b_Goede_voorspelling_90 * (GV2 ==3) + b_Onterecht_Ingrijpen_50 * (OI2 ==1) + b_Onterecht_Ingrijpen_25 * (OI2 ==2) + b_Onterecht_Ingrijpen_5 * (OI2 ==3) + b_Onterecht_Geruststellen_20 * (OG2 ==1) + b_Onterecht_Geruststellen_10 * (OG2 ==2) + b_Onterecht_Geruststellen_1 * (OG2 ==3)

### Define settings for MNL model component
mnl_settings = list(
alternatives = c(choice1=1, choice2=2),
choiceVar = choice,
utilities = 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 = apollo_estimate(apollo_beta, apollo_fixed,
apollo_probabilities, apollo_inputs)

summary(model)

MODEL OUPUT
estimate SE t-ratio p (1-sided)
asc_choice1 0.037 0.018 2.1 0.02 *
b_Goede_voorspelling_70 -0.023 0.019 -1.2 0.11
b_Goede_voorspelling_90 0.788 0.031 25.1 <2e-16 ***
b_Onterecht_Ingrijpen_50 -0.630 0.023 -27.4 <2e-16 ***
b_Onterecht_Ingrijpen_25 -0.012 0.021 -0.6 0.28
b_Onterecht_Geruststellen_20 -0.461 0.025 -18.3 <2e-16 ***
b_Onterecht_Geruststellen_10 0.044 0.024 1.8 0.04 *

Re: Effects coding MNL model and relative importance.

Posted: 30 Jan 2024, 15:02
by stephanehess
Ellis

your model specification is correct, as is the calculation of the beta for the reference level and the relative importance calculation (though I'm not a fan of this).

But it makes no sense to calculate p values for the reference category. Think about it this way. With categorical variables, the t-ratio for a level is a comparison against 0. So with dummy coding, that will tell you whether the utility for a given level is different from that for the base level (which has beta fixed to 0). With effects coding, this kind of calculation makes no sense at all.

Remember that only differences in utility matter, so you can use the delta method to calculate p-values for the differences between individual levels

Stephane