Dear Stephane,

Thank you. I am using a repeated BWS case 1 (no levels) to evaluate preferences for alternative policies. So it is Best-Worst-Best (Second)-Worst (Second). There are 6 alternatives (objectives) and a status quo (SQ) option for a policy. As per the experimental design, there are 15 blocks, 4 out of the 6 alternatives are shown per block and the SQ is always available. So there are a total of 5 options shown for each block. An individual is only shown 1 block. I have added conditions in the "avail" to indicate if the alternative is available in the block or not.

I used a series of multinomial logit models and used the combine command. I get results in the v 3.2, but when I try to run the model in 3.3, I get this error.

Testing influence of parametersError in nRows(P$like) :

INTERNAL ISSUE - An element of P did not have as many rows as observations or individuals, so it was not weighted.

One of the options (shown by "Caste_based" option in the code) is never chosen as the best, and it is chosen as the worst or second worst the most number of times. Which was expected. But that could be an issue. I have shared the full code if that helps.

Just to add, it runs when I remove the weights. But I get a log likelihood of -3000. In the previous version, when the models were running the log likelihood was around the range of -104

Please also note that I have another BWS, a Case 2, from the same survey. It uses the same weights. In that case all the alternatives are always available. That runs fine on v 3.3 and the results are the same as that from when I ran the model in v.3.2

Code: Select all

```
### Vector of parameters
apollo_beta = c(b_Income = 0,
b_HH_Member = 0,
b_Caste = 0,
b_Elderly_DiffAble = 0,
b_NotPlanned = 0,
b_10k_All = 0,
b_CurrentPolicy = 0,
mu_worst = 1)
apollo_fixed = c("b_CurrentPolicy")
# ################################################################# #
#### 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))
### list of probabilities P
P = list()
### List of utilities:
V = list()
V[["Income"]] = b_Income
V[["HH_Members"]] = b_HH_Member
V[["Caste_Based"]] = b_Caste
V[["Elderly_DiffAble"]] = b_Elderly_DiffAble
V[["Not_in_Planned"]] = b_NotPlanned
V[["Universal"]] = b_10k_All
V[["Keep_Current"]] = b_CurrentPolicy
### FIRST BEST: Compute probabilities for "best" choice using MNL model
mnl_settings_best = list(
alternatives = c(Income =1,
HH_Members =2,
Caste_Based =3,
Elderly_DiffAble =4,
Not_in_Planned =5,
Universal =6,
Keep_Current =7),
avail = list(Income =(Inc==1),
HH_Members =(HH==1),
Caste_Based =(Caste==1),
Elderly_DiffAble =(ElderDiffAble==1),
Not_in_Planned =(NotPlanned==1),
Universal =(First10k==1),
Keep_Current =(CurrentPolicy==1) ),
choiceVar = BWS_1_F_Most,
utilities = V,
componentName = "best"
)
P[["choice_best"]] = apollo_mnl(mnl_settings_best, functionality)
### FIRST WORST: Compute probabilities for "worst" choice using MNL model
mnl_settings_worst = list(
alternatives = c(Income =1,
HH_Members =2,
Caste_Based =3,
Elderly_DiffAble =4,
Not_in_Planned =5,
Universal =6,
Keep_Current =7),
avail = list(Income =(Inc==1 &
BWS_1_F_Most!=1),
HH_Members =(HH==1 &
BWS_1_F_Most!=2),
Caste_Based =(Caste==1 &
BWS_1_F_Most!=3),
Elderly_DiffAble =(ElderDiffAble==1 &
BWS_1_F_Most!=4),
Not_in_Planned =(NotPlanned==1 &
BWS_1_F_Most!=5),
Universal =(First10k==1 &
BWS_1_F_Most!=6),
Keep_Current =(CurrentPolicy==1 &
BWS_1_F_Most!=7)),
choiceVar = BWS_1_F_Least,
utilities = list(Income = -mu_worst*V[["Income"]],
HH_Members = -mu_worst*V[["HH_Members"]],
Caste_Based = -mu_worst*V[["Caste_Based"]],
Elderly_DiffAble = -mu_worst*V[["Elderly_DiffAble"]],
Not_in_Planned = -mu_worst*V[["Not_in_Planned"]],
Universal = -mu_worst*V[["Universal"]],
Keep_Current = -mu_worst*V[["Keep_Current"]]),
componentName = "worst"
)
P[["choice_worst"]] = apollo_mnl(mnl_settings_worst, functionality)
### Compute probabilities for "Second Best" choice using MNL model
mnl_settings_best_2 = list(
alternatives = c(Income =1,
HH_Members =2,
Caste_Based =3,
Elderly_DiffAble =4,
Not_in_Planned =5,
Universal =6,
Keep_Current =7),
avail = list(Income =(Inc==1 &
BWS_1_F_Most!=1 &
BWS_1_F_Least!=1) ,
HH_Members =(HH==1 &
BWS_1_F_Most!=2 &
BWS_1_F_Least!=2),
Caste_Based =(Caste==1 &
BWS_1_F_Most!=3 &
BWS_1_F_Least!=3),
Elderly_DiffAble =(ElderDiffAble==1 &
BWS_1_F_Most!=4 &
BWS_1_F_Least!=4),
Not_in_Planned =(NotPlanned==1 &
BWS_1_F_Most!=5 &
BWS_1_F_Least!=5),
Universal =(First10k==1 &
BWS_1_F_Most!=6 &
BWS_1_F_Least!=6),
Keep_Current =(CurrentPolicy==1 &
BWS_1_F_Most!=7 &
BWS_1_F_Least!=7)),
choiceVar = BWS_1_S_Most,
utilities = V,
componentName = "second_best"
)
P[["choice_best_2"]] = apollo_mnl(mnl_settings_best_2, functionality)
### Compute probabilities for "Second Worst" choice using MNL model
mnl_settings_worst_2 = list(
alternatives = c(Income =1,
HH_Members =2,
Caste_Based =3,
Elderly_DiffAble =4,
Not_in_Planned =5,
Universal =6,
Keep_Current =7),
avail = list(Income =(Inc==1 &
BWS_1_F_Most!=1 &
BWS_1_F_Least!=1 &
BWS_1_S_Most!=1) ,
HH_Members =(HH==1 &
BWS_1_F_Most!=2 &
BWS_1_F_Least!=2 &
BWS_1_S_Most!=2),
Caste_Based =(Caste==1 &
BWS_1_F_Most!=3 &
BWS_1_F_Least!=3 &
BWS_1_S_Most!=3),
Elderly_DiffAble =(ElderDiffAble==1 &
BWS_1_F_Most!=4 &
BWS_1_F_Least!=4 &
BWS_1_S_Most!=4),
Not_in_Planned =(NotPlanned==1 &
BWS_1_F_Most!=5 &
BWS_1_F_Least!=5 &
BWS_1_S_Most!=5),
Universal =(First10k==1 &
BWS_1_F_Most!=6 &
BWS_1_F_Least!=6 &
BWS_1_S_Most!=6),
Keep_Current =(CurrentPolicy==1 &
BWS_1_F_Most!=7 &
BWS_1_F_Least!=7 &
BWS_1_S_Most!=7)),
choiceVar = BWS_1_S_Least,
utilities = list(Income = -mu_worst*V[["Income"]],
HH_Members = -mu_worst*V[["HH_Members"]],
Caste_Based = -mu_worst*V[["Caste_Based"]],
Elderly_DiffAble = -mu_worst*V[["Elderly_DiffAble"]],
Not_in_Planned = -mu_worst*V[["Not_in_Planned"]],
Universal = -mu_worst*V[["Universal"]],
Keep_Current = -mu_worst*V[["Keep_Current"]]),
componentName = "second worst"
)
P[["choice_worst_2"]] = apollo_mnl(mnl_settings_worst_2, functionality)
### Combined model
P = apollo_combineModels(P, apollo_inputs, functionality)
# ### Including individual weights
P = apollo_weighting(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)
```

Thank you

Best,

Saumitra