ActivitySim / activitysim

An Open Platform for Activity-Based Travel Modeling
https://activitysim.github.io
BSD 3-Clause "New" or "Revised" License
189 stars 96 forks source link

Problem in CDAP estimation mode #595

Open jpn-- opened 1 year ago

jpn-- commented 1 year ago

As reported by @jfdman

It appears that the coefficients for 3-person households and 4-person households are not being added to the right utility equations in estimation mode. These are the coefficients that are applied when the alternative is where all persons regardless of person type choose the same pattern. They are expressed as P_coeff_D_xxx, P_coeff_D_xxxx, and P_coeff_D_xxxxx, where D is either M,N, or H and the x’s refer to the number of persons in the household.

Here is the utility trace for alternative 1 (MMM) for a 3-person household. It looks like the all-household member interaction term for 5-person households ( P.coef_M_xxxxx) is being applied to this alternative instead of the interaction term for 3-person households ( P.coef_M_xxx).

+ P.coef_full_time_worker_asc_M * X('p1_ptype == 1')
+ P.coef_part_time_worker_asc_M * X('p1_ptype == 2')
+ P.coef_university_student_asc_M * X('p1_ptype == 3')
+ P.coef_UNAVAILABLE * X('p1_ptype == 4')
+ P.coef_UNAVAILABLE * X('p1_ptype == 5')
+ P.coef_driving_age_child_who_is_in_school_asc_M * X('p1_ptype == 6')
+ P.coef_pre_driving_age_child_who_is_in_school_asc_M * X('p1_ptype == 7')
+ P.coef_pre_driving_age_child_who_is_in_school_interaction_with_age_6_to_9_M * X('(p1_ptype == 7) & (p1_age >= 6) & (p1_age <= 9)')
+ P.coef_pre_driving_age_child_who_is_in_school_interaction_with_age_13_to_15_M * X('(p1_ptype == 7) & (p1_age >= 13) & (p1_age <= 15)')
+ P.coef_pre_driving_age_child_who_is_too_young_for_school_asc_M * X('p1_ptype == 8')
+ P.coef_pre_driving_age_child_who_is_too_young_for_school_interaction_with_age_0_to_1_M * X('(p1_ptype == 8) & (p1_age >= 0) & (p1_age <= 1)')
+ P.coef_pre_driving_age_child_who_is_too_young_for_school_interaction_with_age_4_to_5_M * X('(p1_ptype == 8) & (p1_age >= 4) & (p1_age <= 5)')
+ P.coef_full_time_worker_interaction_with_age_less_than_40_M * X('(p1_ptype == 1) & (p1_age < 40)')
+ P.coef_full_time_worker_interaction_with_female_gender_M * X('(p1_ptype == 1) & (p1_SEX == 2)')
+ P.coef_non_working_adult_interaction_with_female_gender_M * X('(p1_ptype == 4) & (p1_SEX == 2)')
+ P.coef_retired_interaction_with_female_M * X('(p1_ptype == 5) & (p1_SEX == 2)')
+ P.coef_non_working_adult_interaction_with_more_cars_than_workers_M * X('(p1_ptype == 4) & (p1_auto_ownership > p1_num_workers)')
+ P.coef_retired_interaction_with_more_cars_than_workers_M * X('(p1_ptype == 5) & (p1_auto_ownership > p1_num_workers)')
+ P.coef_full_time_worker_intraction_with_peak_accessibility_to_all_employment_M * X('(p1_ptype == 1) * p1_auPkTotal')
+ P.coef_part_time_worker_interaction_with_peak_accessibility_to_all_employment_M * X('(p1_ptype == 2) * p1_auPkTotal')
+ P.coef_non_working_adult_interaction_with_peak_accessibility_to_all_employment_M * X('(p1_ptype == 4) * p1_auPkTotal')
+ P.coef_retired_interaction_with_peak_accessibility_to_all_employment_M * X('(p1_ptype == 5) * p1_auPkTotal')
+ P.coef_full_time_worker_asc_M * X('p2_ptype == 1')
+ P.coef_part_time_worker_asc_M * X('p2_ptype == 2')
+ P.coef_university_student_asc_M * X('p2_ptype == 3')
+ P.coef_UNAVAILABLE * X('p2_ptype == 4')
+ P.coef_UNAVAILABLE * X('p2_ptype == 5')
+ P.coef_driving_age_child_who_is_in_school_asc_M * X('p2_ptype == 6')
+ P.coef_pre_driving_age_child_who_is_in_school_asc_M * X('p2_ptype == 7')
+ P.coef_pre_driving_age_child_who_is_in_school_interaction_with_age_6_to_9_M * X('(p2_ptype == 7) & (p2_age >= 6) & (p2_age <= 9)')
+ P.coef_pre_driving_age_child_who_is_in_school_interaction_with_age_13_to_15_M * X('(p2_ptype == 7) & (p2_age >= 13) & (p2_age <= 15)')
+ P.coef_pre_driving_age_child_who_is_too_young_for_school_asc_M * X('p2_ptype == 8')
+ P.coef_pre_driving_age_child_who_is_too_young_for_school_interaction_with_age_0_to_1_M * X('(p2_ptype == 8) & (p2_age >= 0) & (p2_age <= 1)')
+ P.coef_pre_driving_age_child_who_is_too_young_for_school_interaction_with_age_4_to_5_M * X('(p2_ptype == 8) & (p2_age >= 4) & (p2_age <= 5)')
+ P.coef_full_time_worker_interaction_with_age_less_than_40_M * X('(p2_ptype == 1) & (p2_age < 40)')
+ P.coef_full_time_worker_interaction_with_female_gender_M * X('(p2_ptype == 1) & (p2_SEX == 2)')
+ P.coef_non_working_adult_interaction_with_female_gender_M * X('(p2_ptype == 4) & (p2_SEX == 2)')
+ P.coef_retired_interaction_with_female_M * X('(p2_ptype == 5) & (p2_SEX == 2)')
+ P.coef_non_working_adult_interaction_with_more_cars_than_workers_M * X('(p2_ptype == 4) & (p2_auto_ownership > p2_num_workers)')
+ P.coef_retired_interaction_with_more_cars_than_workers_M * X('(p2_ptype == 5) & (p2_auto_ownership > p2_num_workers)')
+ P.coef_full_time_worker_intraction_with_peak_accessibility_to_all_employment_M * X('(p2_ptype == 1) * p2_auPkTotal')
+ P.coef_part_time_worker_interaction_with_peak_accessibility_to_all_employment_M * X('(p2_ptype == 2) * p2_auPkTotal')
+ P.coef_non_working_adult_interaction_with_peak_accessibility_to_all_employment_M * X('(p2_ptype == 4) * p2_auPkTotal')
+ P.coef_retired_interaction_with_peak_accessibility_to_all_employment_M * X('(p2_ptype == 5) * p2_auPkTotal')
+ P.coef_full_time_worker_asc_M * X('p3_ptype == 1')
+ P.coef_part_time_worker_asc_M * X('p3_ptype == 2')
+ P.coef_university_student_asc_M * X('p3_ptype == 3')
+ P.coef_UNAVAILABLE * X('p3_ptype == 4')
+ P.coef_UNAVAILABLE * X('p3_ptype == 5')
+ P.coef_driving_age_child_who_is_in_school_asc_M * X('p3_ptype == 6')
+ P.coef_pre_driving_age_child_who_is_in_school_asc_M * X('p3_ptype == 7')
+ P.coef_pre_driving_age_child_who_is_in_school_interaction_with_age_6_to_9_M * X('(p3_ptype == 7) & (p3_age >= 6) & (p3_age <= 9)')
+ P.coef_pre_driving_age_child_who_is_in_school_interaction_with_age_13_to_15_M * X('(p3_ptype == 7) & (p3_age >= 13) & (p3_age <= 15)')
+ P.coef_pre_driving_age_child_who_is_too_young_for_school_asc_M * X('p3_ptype == 8')
+ P.coef_pre_driving_age_child_who_is_too_young_for_school_interaction_with_age_0_to_1_M * X('(p3_ptype == 8) & (p3_age >= 0) & (p3_age <= 1)')
+ P.coef_pre_driving_age_child_who_is_too_young_for_school_interaction_with_age_4_to_5_M * X('(p3_ptype == 8) & (p3_age >= 4) & (p3_age <= 5)')
+ P.coef_full_time_worker_interaction_with_age_less_than_40_M * X('(p3_ptype == 1) & (p3_age < 40)')
+ P.coef_full_time_worker_interaction_with_female_gender_M * X('(p3_ptype == 1) & (p3_SEX == 2)')
+ P.coef_non_working_adult_interaction_with_female_gender_M * X('(p3_ptype == 4) & (p3_SEX == 2)')
+ P.coef_retired_interaction_with_female_M * X('(p3_ptype == 5) & (p3_SEX == 2)')
+ P.coef_non_working_adult_interaction_with_more_cars_than_workers_M * X('(p3_ptype == 4) & (p3_auto_ownership > p3_num_workers)')
+ P.coef_retired_interaction_with_more_cars_than_workers_M * X('(p3_ptype == 5) & (p3_auto_ownership > p3_num_workers)')
+ P.coef_full_time_worker_intraction_with_peak_accessibility_to_all_employment_M * X('(p3_ptype == 1) * p3_auPkTotal')
+ P.coef_part_time_worker_interaction_with_peak_accessibility_to_all_employment_M * X('(p3_ptype == 2) * p3_auPkTotal')
+ P.coef_non_working_adult_interaction_with_peak_accessibility_to_all_employment_M * X('(p3_ptype == 4) * p3_auPkTotal')
+ P.coef_retired_interaction_with_peak_accessibility_to_all_employment_M * X('(p3_ptype == 5) * p3_auPkTotal')
+ P('-999.0') * X('(p1_ptype == 5)')
+ P('-999.0') * X('(p1_ptype == 4)')
+ P('-999.0') * X('(p2_ptype == 5)')
+ P('-999.0') * X('(p2_ptype == 4)')
+ P('-999.0') * X('(p3_ptype == 5)')
+ P('-999.0') * X('(p3_ptype == 4)')
+ P.coef_M_11 * X('(p1_ptype == 1)&(p2_ptype == 1)')
+ P.coef_M_12 * X('(p1_ptype == 1)&(p2_ptype == 2)')
+ P.coef_M_13 * X('(p1_ptype == 1)&(p2_ptype == 3)')
+ P.coef_M_16 * X('(p1_ptype == 1)&(p2_ptype == 6)')
+ P.coef_M_17 * X('(p1_ptype == 1)&(p2_ptype == 7)')
+ P.coef_M_18 * X('(p1_ptype == 1)&(p2_ptype == 8)')
+ P.coef_M_22 * X('(p1_ptype == 2)&(p2_ptype == 2)')
+ P.coef_M_23 * X('(p1_ptype == 2)&(p2_ptype == 3)')
+ P.coef_M_26 * X('(p1_ptype == 2)&(p2_ptype == 6)')
+ P.coef_M_27 * X('(p1_ptype == 2)&(p2_ptype == 7)')
+ P.coef_M_28 * X('(p1_ptype == 2)&(p2_ptype == 8)')
+ P.coef_M_33 * X('(p1_ptype == 3)&(p2_ptype == 3)')
+ P.coef_M_36 * X('(p1_ptype == 3)&(p2_ptype == 6)')
+ P.coef_M_37 * X('(p1_ptype == 3)&(p2_ptype == 7)')
+ P.coef_M_38 * X('(p1_ptype == 3)&(p2_ptype == 8)')
+ P.coef_M_66 * X('(p1_ptype == 6)&(p2_ptype == 6)')
+ P.coef_M_67 * X('(p1_ptype == 6)&(p2_ptype == 7)')
+ P.coef_M_68 * X('(p1_ptype == 6)&(p2_ptype == 8)')
+ P.coef_M_77 * X('(p1_ptype == 7)&(p2_ptype == 7)')
+ P.coef_M_78 * X('(p1_ptype == 7)&(p2_ptype == 8)')
+ P.coef_M_88 * X('(p1_ptype == 8)&(p2_ptype == 8)')
+ P.coef_M_11 * X('(p1_ptype == 1)&(p3_ptype == 1)')
+ P.coef_M_12 * X('(p1_ptype == 1)&(p3_ptype == 2)')
+ P.coef_M_13 * X('(p1_ptype == 1)&(p3_ptype == 3)')
+ P.coef_M_16 * X('(p1_ptype == 1)&(p3_ptype == 6)')
+ P.coef_M_17 * X('(p1_ptype == 1)&(p3_ptype == 7)')
+ P.coef_M_18 * X('(p1_ptype == 1)&(p3_ptype == 8)')
+ P.coef_M_22 * X('(p1_ptype == 2)&(p3_ptype == 2)')
+ P.coef_M_23 * X('(p1_ptype == 2)&(p3_ptype == 3)')
+ P.coef_M_26 * X('(p1_ptype == 2)&(p3_ptype == 6)')
+ P.coef_M_27 * X('(p1_ptype == 2)&(p3_ptype == 7)')
+ P.coef_M_28 * X('(p1_ptype == 2)&(p3_ptype == 8)')
+ P.coef_M_33 * X('(p1_ptype == 3)&(p3_ptype == 3)')
+ P.coef_M_36 * X('(p1_ptype == 3)&(p3_ptype == 6)')
+ P.coef_M_37 * X('(p1_ptype == 3)&(p3_ptype == 7)')
+ P.coef_M_38 * X('(p1_ptype == 3)&(p3_ptype == 8)')
+ P.coef_M_66 * X('(p1_ptype == 6)&(p3_ptype == 6)')
+ P.coef_M_67 * X('(p1_ptype == 6)&(p3_ptype == 7)')
+ P.coef_M_68 * X('(p1_ptype == 6)&(p3_ptype == 8)')
+ P.coef_M_77 * X('(p1_ptype == 7)&(p3_ptype == 7)')
+ P.coef_M_78 * X('(p1_ptype == 7)&(p3_ptype == 8)')
+ P.coef_M_88 * X('(p1_ptype == 8)&(p3_ptype == 8)')
+ P.coef_M_11 * X('(p2_ptype == 1)&(p3_ptype == 1)')
+ P.coef_M_12 * X('(p2_ptype == 1)&(p3_ptype == 2)')
+ P.coef_M_13 * X('(p2_ptype == 1)&(p3_ptype == 3)')
+ P.coef_M_16 * X('(p2_ptype == 1)&(p3_ptype == 6)')
+ P.coef_M_17 * X('(p2_ptype == 1)&(p3_ptype == 7)')
+ P.coef_M_18 * X('(p2_ptype == 1)&(p3_ptype == 8)')
+ P.coef_M_22 * X('(p2_ptype == 2)&(p3_ptype == 2)')
+ P.coef_M_23 * X('(p2_ptype == 2)&(p3_ptype == 3)')
+ P.coef_M_26 * X('(p2_ptype == 2)&(p3_ptype == 6)')
+ P.coef_M_27 * X('(p2_ptype == 2)&(p3_ptype == 7)')
+ P.coef_M_28 * X('(p2_ptype == 2)&(p3_ptype == 8)')
+ P.coef_M_33 * X('(p2_ptype == 3)&(p3_ptype == 3)')
+ P.coef_M_36 * X('(p2_ptype == 3)&(p3_ptype == 6)')
+ P.coef_M_37 * X('(p2_ptype == 3)&(p3_ptype == 7)')
+ P.coef_M_38 * X('(p2_ptype == 3)&(p3_ptype == 8)')
+ P.coef_M_66 * X('(p2_ptype == 6)&(p3_ptype == 6)')
+ P.coef_M_67 * X('(p2_ptype == 6)&(p3_ptype == 7)')
+ P.coef_M_68 * X('(p2_ptype == 6)&(p3_ptype == 8)')
+ P.coef_M_77 * X('(p2_ptype == 7)&(p3_ptype == 7)')
+ P.coef_M_78 * X('(p2_ptype == 7)&(p3_ptype == 8)')
+ P.coef_M_88 * X('(p2_ptype == 8)&(p3_ptype == 8)')
+ P.coef_M_111 * X('(p1_ptype == 1)&(p2_ptype == 1)&(p3_ptype == 1)')
+ P.coef_M_112_114 * X('(p1_ptype == 1)&(p2_ptype == 1)&(p3_ptype == 2)')
+ P.coef_M_112_114 * X('(p1_ptype == 1)&(p2_ptype == 1)&(p3_ptype == 4)')
+ P.coef_M_666 * X('(p1_ptype == 6)&(p2_ptype == 6)&(p3_ptype == 6)')
+ P.coef_M_xxxxx
jfdman commented 1 year ago

@jpn-- has this issue been addressed in activitysim 1.2?