Error running multinomial logit model with random slopes
Posted: Wed Mar 13, 2024 9:18 am
Hi
I'm trying to estimate a 2-level multinomial logit model with random slopes but am encountering problems with the estimation.
I'll keep the example simple. I have the following variables in my dataframe:
WPID_RANDOM - respondent id
Country - character variable indicating country
prepared_gov - outcome variable where 1 = "yes, well prepared", 2 = "no, not well prepared," 3 = "prepared"
Gender - 0 = "male," 1 = "female"
There are no missing values in the dataframe.
If I estimate a model with random slopes for gender at the country level, I have the following code:
model1 <- runMLwiN(logit(prepared_gov) ~
Gender +
(1 + Gender | Country),
D = "Unordered Multinomial",
data = dataframe,
estoptions = list(sort.force = TRUE)
)
summary(model1)
However, when I run the model, I get the following output:
/nogui option ignored
ECHO 0
error while obeying batch file C:/Users/-/AppData/Local/Temp/RtmpchhCHz/macrofile_2860395b2cc5.txt at line number 55:
SETV 3 'Gender.No, not well prepared'
Wrong parameters
error while obeying batch file C:/Users/-/AppData/Local/Temp/RtmpchhCHz/macrofile_2860395b2cc5.txt at line number 55:
SETV 3 'Gender.No, not well prepared'
Wrong parameters.
Execution completed
Error in foreign::read.dta(IGLSfile) :
unable to open file: 'No such file or directory'
If I take out the random slope for gender and just specify a random intercept at the country level, the model the runs fine. I notice there isn't an example for a MNL model with random slopes in the documentation. Is something that R2MlWin can't handle?
Thanks in advance
I'm trying to estimate a 2-level multinomial logit model with random slopes but am encountering problems with the estimation.
I'll keep the example simple. I have the following variables in my dataframe:
WPID_RANDOM - respondent id
Country - character variable indicating country
prepared_gov - outcome variable where 1 = "yes, well prepared", 2 = "no, not well prepared," 3 = "prepared"
Gender - 0 = "male," 1 = "female"
There are no missing values in the dataframe.
If I estimate a model with random slopes for gender at the country level, I have the following code:
model1 <- runMLwiN(logit(prepared_gov) ~
Gender +
(1 + Gender | Country),
D = "Unordered Multinomial",
data = dataframe,
estoptions = list(sort.force = TRUE)
)
summary(model1)
However, when I run the model, I get the following output:
/nogui option ignored
ECHO 0
error while obeying batch file C:/Users/-/AppData/Local/Temp/RtmpchhCHz/macrofile_2860395b2cc5.txt at line number 55:
SETV 3 'Gender.No, not well prepared'
Wrong parameters
error while obeying batch file C:/Users/-/AppData/Local/Temp/RtmpchhCHz/macrofile_2860395b2cc5.txt at line number 55:
SETV 3 'Gender.No, not well prepared'
Wrong parameters.
Execution completed
Error in foreign::read.dta(IGLSfile) :
unable to open file: 'No such file or directory'
If I take out the random slope for gender and just specify a random intercept at the country level, the model the runs fine. I notice there isn't an example for a MNL model with random slopes in the documentation. Is something that R2MlWin can't handle?
Thanks in advance