Hi, I am trying to estimate a hybrid model with ordered indicators. I have succesfully run this type of model with other datasets previously succesfully, but I have encounter a problem with the current dataset I am using.
I have a variable with the following levels
levels=c(1,2,3,4,5),labels=c("Strongly Disagree","Disagree","Neither","Agree","Strongly Agree")))
I have tried running a ordered logit with 4 taus but I am getting an error.
ol_settings1 = list(outcomeOrdered=concerned,
V=zeta_IND_concerned*LV_IND,
tau=c(tau_IND_concerned_1,
tau_IND_concerned_2,
tau_IND_concerned_3,
tau_IND_concerned_4),
rows=(task==1),
componentName="indic_IND_concerned")
The problem is that for the level "2" I have no data, so basically it means that there are less "treshold coefficients " than 4. Actually if I recode this variable and change the "3"<-2, "4"<-3..so on. and run the model with 3 Taus, the model works perfectly!
So, I have managed to twist the data to run the model but I am not sure it is correct, so I would like to know if its possible to code the "ol_settigs" with 4 steps even though there is no data for one level?
Important: Read this before posting to this forum
- This forum is for questions related to the use of Apollo. We will answer some general choice modelling questions too, where appropriate, and time permitting. We cannot answer questions about how to estimate choice models with other software packages.
- There is a very detailed manual for Apollo available at http://www.ApolloChoiceModelling.com/manual.html. This contains detailed descriptions of the various Apollo functions, and numerous examples are available at http://www.ApolloChoiceModelling.com/examples.html. In addition, help files are available for all functions, using e.g. ?apollo_mnl
- Before asking a question on the forum, users are kindly requested to follow these steps:
- Check that the same issue has not already been addressed in the forum - there is a search tool.
- Ensure that the correct syntax has been used. For any function, detailed instructions are available directly in Apollo, e.g. by using ?apollo_mnl for apollo_mnl
- Check the frequently asked questions section on the Apollo website, which discusses some common issues/failures. Please see http://www.apollochoicemodelling.com/faq.html
- Make sure that R is using the latest official release of Apollo.
- Users can check which version they are running by entering packageVersion("apollo").
- Then check what is the latest full release (not development version) at http://www.ApolloChoiceModelling.com/code.html.
- To update to the latest official version, just enter install.packages("apollo"). To update to a development version, download the appropriate binary file from http://www.ApolloChoiceModelling.com/code.html, and install the package from file
- If the above steps do not resolve the issue, then users should follow these steps when posting a question:
- provide full details on the issue, including the entire code and output, including any error messages
- posts will not immediately appear on the forum, but will be checked by a moderator first. This may take a day or two at busy times. There is no need to submit the post multiple times.
Number of thresholds to use in hybrid ordered model with no data in one level
-
- Posts: 10
- Joined: 20 Aug 2020, 15:20
Re: Number of thresholds to use in hybrid ordered model with no data in one level
Hi Valeria,
Indeed, you cannot estimate thresholds for levels that are not observed. So, as there are no "disagree" responses in you data, you need to drop that level and pretend it doesn't exist, so your model considers only four possible responses. You can implement that in two ways:
David
Indeed, you cannot estimate thresholds for levels that are not observed. So, as there are no "disagree" responses in you data, you need to drop that level and pretend it doesn't exist, so your model considers only four possible responses. You can implement that in two ways:
- By subtracting 1 from all responses that are bigger than 2 (as you did) or,
- Use the "code" option to skip the non-selected level in the model definition, in your case it would be as follows
I cannot be certain that this will work with your data, as I don't know if your dependant variable (concerned) is stored as a factor or a numeric variable, but try if this works. If it doesn't you can try using code=c("Strongly Disagree","Neither","Agree","Strongly Agree").
Code: Select all
ol_settings1 = list(outcomeOrdered = concerned, V = zeta_IND_concerned*LV_IND, tau = c(tau_IND_concerned_1, tau_IND_concerned_2, tau_IND_concerned_3, tau_IND_concerned_4), rows = (task==1), coding =c(1,3,4,5), componentName = "indic_IND_concerned")
David
-
- Posts: 10
- Joined: 20 Aug 2020, 15:20
Re: Number of thresholds to use in hybrid ordered model with no data in one level
Hi David,
I saw the coding option from another comment but it didn't occur to me to use it like that. This solution makes the coding much clearer.
Thanks a lot for your reply!
I saw the coding option from another comment but it didn't occur to me to use it like that. This solution makes the coding much clearer.
Thanks a lot for your reply!
-
- Posts: 10
- Joined: 20 Aug 2020, 15:20
Re: Number of thresholds to use in hybrid ordered model with no data in one level
Hi David,
thanks a lot your time and suggestions. My data has a numeric format, so I tried the coding option as you first suggested (skipping level 2).
Now I am getting a new error:
"Testing probability function (apollo_probabilities)
Error in apollo_ol(ol_settings1, functionality) :
Threshold vector length +1 does not match number of elements in argument 'coding'.
Called from: apollo_ol(ol_settings1, functionality)"
thanks a lot your time and suggestions. My data has a numeric format, so I tried the coding option as you first suggested (skipping level 2).
Now I am getting a new error:
"Testing probability function (apollo_probabilities)
Error in apollo_ol(ol_settings1, functionality) :
Threshold vector length +1 does not match number of elements in argument 'coding'.
Called from: apollo_ol(ol_settings1, functionality)"
Re: Number of thresholds to use in hybrid ordered model with no data in one level
Hi Valeria,
As now there are only four different possible levels (1,3,4,5), you only need three thresholds. So the correct code should be:
Sorry for the mistake.
Cheers
David
As now there are only four different possible levels (1,3,4,5), you only need three thresholds. So the correct code should be:
Code: Select all
ol_settings1 = list(outcomeOrdered = concerned,
V = zeta_IND_concerned*LV_IND,
tau = c(tau_IND_concerned_1,
tau_IND_concerned_3,
tau_IND_concerned_4),
rows = (task==1),
coding =c(1,3,4,5),
componentName = "indic_IND_concerned")
Cheers
David
-
- Posts: 10
- Joined: 20 Aug 2020, 15:20
Re: Number of thresholds to use in hybrid ordered model with no data in one level
Hi David, that worked perfectly.
Thanks a lot for your time and help, I really appreciate it.
Best
Valeria Toledo
Thanks a lot for your time and help, I really appreciate it.
Best
Valeria Toledo