Important: Read this before posting to this forum

  1. 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.
  2. 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
  3. Before asking a question on the forum, users are kindly requested to follow these steps:
    1. Check that the same issue has not already been addressed in the forum - there is a search tool.
    2. 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
    3. Check the frequently asked questions section on the Apollo website, which discusses some common issues/failures. Please see http://www.apollochoicemodelling.com/faq.html
    4. Make sure that R is using the latest official release of Apollo.
  4. If the above steps do not resolve the issue, then users should follow these steps when posting a question:
    1. provide full details on the issue, including the entire code and output, including any error messages
    2. 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

Ask questions about how to estimate models and how to change your settings for estimation.
Post Reply
valeria toledo
Posts: 10
Joined: 20 Aug 2020, 15:20

Number of thresholds to use in hybrid ordered model with no data in one level

Post by valeria toledo »

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?
dpalma
Posts: 190
Joined: 24 Apr 2020, 17:54

Re: Number of thresholds to use in hybrid ordered model with no data in one level

Post by dpalma »

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:
  • 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

    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")
    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").
Cheers
David
valeria toledo
Posts: 10
Joined: 20 Aug 2020, 15:20

Re: Number of thresholds to use in hybrid ordered model with no data in one level

Post by valeria toledo »

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!
valeria toledo
Posts: 10
Joined: 20 Aug 2020, 15:20

Re: Number of thresholds to use in hybrid ordered model with no data in one level

Post by valeria toledo »

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)"
dpalma
Posts: 190
Joined: 24 Apr 2020, 17:54

Re: Number of thresholds to use in hybrid ordered model with no data in one level

Post by dpalma »

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:

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")
Sorry for the mistake.

Cheers
David
valeria toledo
Posts: 10
Joined: 20 Aug 2020, 15:20

Re: Number of thresholds to use in hybrid ordered model with no data in one level

Post by valeria toledo »

Hi David, that worked perfectly.
Thanks a lot for your time and help, I really appreciate it.

Best
Valeria Toledo
Post Reply