Page 2 of 2

Re: parameter does not influence LL

Posted: 25 May 2021, 16:56
by shengxiao
Hi Stephane,
I am still confused at how to specify the functions in Apollo. I am testing what factors are related to a combination of residential location and vehicle ownership. This is the reason why I include the same parameters for each alternative. For example, I assume that the age is related to the probability of living in an urban area with a car and also related to that of living in a suburb without a car. Therefore, I would like to include all categories of age for each alternative. I understand that at least there should be some differences of the utility functions. So I have tried to include asc:

asc_Ru_N_value = asc_Ru_N+asc_Ru_N_burden*cost
asc_SEC_N_value = asc_SEC_N+asc_SEC_N_burden*cost
asc_SUB_N_value = asc_SUB_N+asc_SUB_N_burden*cost+asc_SUB_N_transit*pt
asc_URB_N_value = asc_URB_N+asc_URB_N_burden*cost+asc_URB_N_transit*pt
asc_Ru_D_value = asc_Ru_D+asc_Ru_D_burden*cost
asc_SEC_D_value =asc_SEC_D+asc_SEC_D_burden*cost
asc_URB_D_value = asc_URB_D+asc_URB_D_burden*cost+asc_URB_D_transit*pt

Unfortunately, the results are the same: Parameter b_age_65 does not influence the log-likelihood of your model! I try to use Cross-nested model because I like its relaxation on the IIA hypothesis.
In this case, I wonder what I should do. As I see on your website, I think it is fine to include the same utility function for all alternatives. So should I do b_age_65_i in stead of an uniform b_age_65 for all alternatives?

Thank you,
Alex

Re: parameter does not influence LL

Posted: 25 May 2021, 17:38
by stephanehess
Alex

it's very simple. You have the following, where I show only the first and last alternative

Code: Select all

V[['Ru_D']]  = acs_Ru_D + b_age_65 * (age_65_74==1) + b_age_75 * (age_75==1) + b_AA * (race_AA==1) + b_HIS * (race_HIS==1) + 
    b_OTHERS * (race_OTHERS==1) + b_inc * (income) + b_med*(medc==1) + b_retire_o * (retire_one==1) + 
    b_retire_t * (retire_two==1) + b_alonem * (alonem==1) + b_alonef * (alonef==1)+ b_incm * (data$incomem==1)
...
V[['URB_S']]  = acs_URB_S + b_age_65 * (age_65_74==1) + b_age_75 * (age_75==1) + b_AA * (race_AA==1) + b_HIS * (race_HIS==1) + 
    b_OTHERS * (race_OTHERS==1) + b_inc * (income) + b_med*(medc==1) + b_retire_o * (retire_one==1) + 
    b_retire_t * (retire_two==1) + b_alonem * (alonem==1) + b_alonef * (alonef==1)+ b_incm * (data$incomem==1)
You cannot estimate a constant for each alternative, as only the differences in utilities matter. So you would for example include asc_URB_S in apollo_fixed, so its value stays at 0. The estimate for acs_Ru_D would then be the difference in utility for Ru_D compared to URB_S, all else being equal.

Now, I understand you want to incorporate socio-demographic effects too. But what you have done is to include these in all of the utility functions, with the same parameters. So they would just drop out of the model as they would not capture any differences across alternatives. If you want to for example capture the impact of age being between 65 and 74, then you would need to use a separate parameter for that for each alternative, with one of them being fixed to zero. Just like for the ASCs. It's the exact same principle. So you would need e.g.

Code: Select all

V[['Ru_D']]  = acs_Ru_D + b_age_65_RU_D * (age_65_74==1) + ...
...
V[['URB_S']]  = acs_URB_S + b_age_65_URB_S * (age_65_74==1) + ...
where b_age_65_URB_S is also included in apollo_fixed

Stephane

Re: parameter does not influence LL

Posted: 08 Jun 2021, 13:37
by shengxiao
Hi Stephane,

It finally works. Thanks so much! But another quick question: I wonder how long does it take to run the model? I have around 80,000 samples, and 12 alternatives. It run for several days already, but did not work out. I wonder whether it is normal. If so, do you have any recommendations to make the computation less expensive?

Thank you,
Alex

Re: parameter does not influence LL

Posted: 08 Jun 2021, 16:04
by stephanehess
Alex

that's a big sample, but it shouldn't take that long or does your model also use mixing? What version of Apollo are you using and are you using multiple cores?

Stephane

Re: parameter does not influence LL

Posted: 16 Jun 2021, 14:05
by shengxiao
Hi Stephane,
Sorry about my late reply. I just want to have more information before reaching out to you. I do not think that I used mixing. The model structure is the same as your publication in Transportation in 2012 (vehicle type and fuel type). My apollo version is apollo_0.2.4. Thanks for the reminder of the number of cores. Now I have opened all cores on my computer (6), and it goes a little faster.

I can see that it should converge nearly 200 times, which makes it really slow. And it takes very long after the coverage (sometimes it cannot even converge). In this case, do you have any other suggestions? Should I reduce the number of parameters? Will that help?

Thank you,
Alex

Re: parameter does not influence LL

Posted: 17 Jun 2021, 10:29
by stephanehess
Alex

can you please show us the whole code and the output?

Thanks