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.

Binary/Multinomial logit in the measurement model for HCM

Ask questions about model specifications. Ideally include a mathematical explanation of your proposed model.
Post Reply
hrrichard
Posts: 10
Joined: 26 Apr 2020, 15:03

Binary/Multinomial logit in the measurement model for HCM

Post by hrrichard »

Hi Stephane,

I am estimating a HCM, and instead of the conventional approach such as Likert-scale indicators, I would like to use other variables as indicators for the latent variable. In this case, I would use a binary/multinomial logit in the measurement equations. I have two questions regarding these:
1. Do you think I should create a different lists for these MNLs other than the list of "V" that is used for the stated choice data?
2. Would you recommend to specify constants in these MNLs to capture the overall preference for the choice options of the indicators alongside the zeta parameters capturing the impact of the LV?

For the binary case, I have implemented the following code:

Code: Select all

I= list()
  
  I[['op1']] = Constant_1_1+ zeta_ind_1_1*LV
  I[['op2']] = Constant_1_2+ zeta_ind_1_2*LV
  
  mnl_settings_2 = list(
    alternatives = c(op1=0, op2=1),
    avail        = list(op1=1, op2=1),
    choiceVar    = Ind_1,
    V            = I,
    rows=(Sequence==1)
  )
  P[["ind_1"]] = apollo_mnl(mnl_settings_2, functionality)
While I implemented the following code for the MNL:

Code: Select all

J= list()
  
  J[['op1']] = Constant_2_1+ zeta_ind_2_1*LV
  J[['op2']] = Constant_2_2+ zeta_ind_2_2*LV
  J[['op3']] = Constant_2_3+ zeta_ind_2_3*LV

  mnl_settings_2 = list(
    alternatives = c(op1=0, op2=1,op3=2),
    avail        = list(op1=1, op2=1,op3=1),
    choiceVar    = Ind_2,
    V            = J,
    rows=(Sequence==1)
  )
  P[["ind_2"]] = apollo_mnl(mnl_settings3, functionality)
Thank you for your help!

Best wishes,
Richard
stephanehess
Site Admin
Posts: 1040
Joined: 24 Apr 2020, 16:29

Re: Binary/Multinomial logit in the measurement model for HCM

Post by stephanehess »

Hi Richard

on point 1, what you do is indeed the easiest and best way of doing it. You could use the same list for the different components, but you would need to reset it in between each component (so you start with an empty one). While that would save a little memory compared to creating new lists and keeping the others in memory, the coding is more convoluted and the risk of mistakes is larger.

on point 2, yes, when I've used binary (or multinomial) indicators for LVs, I include constants, obviously with a normalisation for identification.

Best wishes

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
Sissi
Posts: 1
Joined: 04 Jan 2021, 22:39

Re: Binary/Multinomial logit in the measurement model for HCM

Post by Sissi »

Hi Stephanehess,

I have a related question. I plan to use HCM for joint estimation of stated choice and perception/attitude data.
Attitude contains 8 statements, and their answers are binary;i.e., 1 if a statement is selected or 0 otherwise.
I follow your example in apollo_example_24 for drug choice, using ordered measurement model for indicators.

Code: Select all

apollo_beta = c(lambda  = 1, # respondent choose a favorite photo, no other attributes available.
                gamma_gender     = 0, 
                gamma_birth   	   = 0, 
		gamma_edu    	   = 0,
                zeta_aesthetic     = 1, 
                zeta_access    	  = 1, 
                zeta_forestry      = 1, 
                zeta_grazing       = 1, 
                zeta_bio  		  = 1, 
                zeta_culture       = 1, 
                zeta_carbon        = 1, 
                tau_aesthetic_1    = 0, # the number of different levels in the dependent variable -1
                tau_access_1  	   = 0, 
                tau_forestry_1     = 0, 
                tau_grazing_1      = 0, 
                tau_bio_1 	   =0, 
                tau_culture_1      = 0, 
                tau_carbon_1       = 0) 
Here is the warning i have received:
Testing likelihood function...
Error in apollo_preprocess(inputs = ol_settings, modelType, functionality, :
If provided as scalars, need at least two thresholds for Ordered Logit for model component "indic_aesthetic"!


Because latent indicators are binary, I only specify one threshhold for each tau indicator in apollo_beta following the instruction in apollo manual.
Apparently, this is a wrong specification. How can I adapt my code so that I can run the HCM with binary attitude indicators? I have gone through the apollo manual, but did not find examples.

Many thanks in advance for your attentions.

Best regards,
Sissi
stephanehess
Site Admin
Posts: 1040
Joined: 24 Apr 2020, 16:29

Re: Binary/Multinomial logit in the measurement model for HCM

Post by stephanehess »

Hi Sissi

if your dependent variable is binary, then you should just use an MNL model for it, rather than an OL.

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
Post Reply