Page 1 of 1

Errors in ordered logit model

Posted: 14 Apr 2021, 15:26
by Hyewon
Dear Stephane,

I am trying to run the ordered logit model in Apollo. However, there are two issues.

1) The result is different from other packages.
2) The result converged and somehow come up, but producing the following errors;

Calculating LL(0)...
Calculating LL of each model component...
There were 22 warnings (use warnings() to see them)
> warnings()
Warning messages:
1: In log(P[[j]]) : NaNs produced
2: In log(P[[j]]) : NaNs produced
3: In log(P[[j]]) : NaNs produced
4: In log(P[[j]]) : NaNs produced
5: In log(P[[j]]) : NaNs produced
6: In log(P[[j]]) : NaNs produced
7: In log(P[[j]]) : NaNs produced
8: In log(P[[j]]) : NaNs produced
9: In log(P[[j]]) : NaNs produced
10: In log(P[[j]]) : NaNs produced
11: In log(P[[j]]) : NaNs produced
12: In log(P[[j]]) : NaNs produced
13: In log(P[[j]]) : NaNs produced
14: In log(P[[j]]) : NaNs produced
15: In log(P[[j]]) : NaNs produced
16: In log(P[[j]]) : NaNs produced
17: In log(P[[j]]) : NaNs produced
18: In log(P[[j]]) : NaNs produced
19: In log(P[[j]]) : NaNs produced
20: In log(P[[j]]) : NaNs produced
21: In log(P[[j]]) : NaNs produced
22: In log(P[[j]]) : NaNs produced

---------------------------------------------------------

Therefore, I think the result why is different from other package is maybe the issue of this.
Ordered logit is a simple model, so I revise it. However, there is no example of it in the manual except LV setting, so can you please kindly check what is the issue of it? I will attach the code.

Code: Select all

# ################################################################# #
#### DEFINE MODEL PARAMETERS                                     ####
# ################################################################# #

### Vector of parameters, including any that are kept fixed in estimation
apollo_beta = c(
  b_auto_tram = 0,
  b_auto_vehi = 0,
  b_bus = 0,
  b_truck_person = 0,
  b_truck_guard = 0,
  b_video = 0,
  b_experi = 0,
  b_none = 0,
  tau_choice_1 = -2,
  tau_choice_2 = -1,
  tau_choice_3 = 1,
  tau_choice_4 = 2
)

### Vector with names (in quotes) of parameters to be kept fixed at their starting value in apollo_beta, use apollo_beta_fixed = c() if none
apollo_fixed = c("b_none")

# ################################################################# #
#### 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))
  
  ### Create list of probabilities P
  P = list()
  

  ### Define settings for ordered logit
  
  
  ol_settings = list(outcomeOrdered = choice, 
                      V              =  b_auto_tram*auto_tram + b_auto_vehi*auto_vehi + b_bus*bus + 
                       			b_truck_person*truck_person + b_truck_guard*truck_guard + 
                      			 b_video*video1 + b_none*video2 + b_experi*exp_group,
                       tau            = c(tau_choice_1, tau_choice_2, tau_choice_3, tau_choice_4)
                                       
  )
  
  ### Compute ordered logit probabilities
  P[["model"]]=apollo_ol(ol_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 ESTIMATION                                            ####
# ################################################################# #

model = apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, apollo_inputs)

Did I verify the model in the right way? Can I know the issue in the error?
The outcomeordered is on Likert scale, it will be appreciated if you can have a look and give any comment.

Thank you so much, always!

With best regards,
Hyewon

Re: Errors in ordered logit model

Posted: 14 Apr 2021, 16:15
by stephanehess
Hyewon

the reason for the error messages is simply that during estimation, some of the tau parameters overlapped. This is nothing to worry about as the estimation sorted itself out.

However, to help you with your main query, we really need to see the results for your model, with Apollo and the other package you're comparing it to

Stephane