Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions configs/resident/annotate_persons_mtf.csv
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ number of mandatory tours for each person,num_mand,"_PERSON_TOUR_COUNT('tour_cat
number of work tours for each person,num_work_tours,"_PERSON_TOUR_COUNT('tour_type==%s' % _Q('work'), persons, tours).fillna(0)"
presence of pre school kid with mandatory tours,has_pre_school_child_with_mandatory,"other_than(persons.household_id, (persons.ptype == 8) & (num_mand > 0))"
presense of driving age school children with mandatory tours,has_driving_age_child_with_mandatory,"other_than(persons.household_id, (persons.ptype == 6) & (num_mand > 0))"
Legible label of telework arrangement on the simulation day,telework_arrangement,'not working'
Teleworking on the simulation day,telework_arrangement,"np.where((num_work_tours==0)&(persons.get('has_in_home_work_activity')), 'teleworking', telework_arrangement)"
Commuting on the simulation day,telework_arrangement,"np.where((num_work_tours>0)&(~persons.get('has_in_home_work_activity'))&(persons.get('is_worker')), 'commuting', telework_arrangement)"
Hybrid working on the simulation day,telework_arrangement,"np.where((num_work_tours>0)&(persons.get('has_in_home_work_activity')), 'hybrid working', telework_arrangement)"
3 changes: 2 additions & 1 deletion configs/resident/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,9 @@ models:
- transponder_ownership
- free_parking
- telecommute_frequency
- telecommute_status
- cdap_simulate
- telework_arrangement
- telework_duration
- mandatory_tour_frequency
- mandatory_tour_scheduling
- school_escorting
Expand Down
3 changes: 2 additions & 1 deletion configs/resident/settings_mp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ models:
- transponder_ownership
- free_parking
- telecommute_frequency
- telecommute_status
- cdap_simulate
- telework_arrangement
- telework_duration
- mandatory_tour_frequency
- mandatory_tour_scheduling
- school_escorting
Expand Down
3 changes: 2 additions & 1 deletion configs/resident/settings_mp_sharrow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ models:
- transponder_ownership
- free_parking
- telecommute_frequency
- telecommute_status
- cdap_simulate
- telework_arrangement
- telework_duration
- mandatory_tour_frequency
- mandatory_tour_scheduling
- school_escorting
Expand Down
35 changes: 35 additions & 0 deletions configs/resident/telework_arrangement.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Label,Description,Expression,has_in_home_work_activity,no_in_home_work_activity
util_acs,alternative specific constant,@1,coef_acs_has_in_home_work_activity,
util_part_time_worker,part-time worker,ptype==2,coef_parttime_has_in_home,
util_univ_student,university student,ptype==3,coef_univ_student_has_in_home,
util_driving_age_student,driving age student,ptype==6,-999,
util_has_preschool_at_home,has preschool children at home on the day,has_preschool_kid_at_home,coef_has_preschool_at_home_has_in_home,
util_income_100_150,income 100-150k,(income_in_thousands>=100)&(income_in_thousands<150),coef_income_100_150,
util_income_150p,income 150k plus,income_in_thousands>=150,coef_income_150p,
util_age_above_35,age above 35,age>=35,coef_age_above_35,
util_workplace_mc_logsum,workplace mode choice logsum,"@np.where(df.workplace_zone_id>-1, df.workplace_modechoice_logsum, 0)",coef_workplace_mc_logsum,
#util_dummy_missing_workplace,util_dummy_missing_workplace,"@np.where((df.workplace_zone_id<=-1)&(~df.work_from_home), 1, 0)",coef_dummy_missing_workplace,
# interaction terms,,,,
util_telecommute_1_day_cdap_N,telecommute 1 day and cdap non-mandatory,"(telecommute_frequency==""1_day_week"") & (cdap_activity==""N"")",coef_telecommute_1_day_cdap_N,
util_telecommute_2_3_days_cdap_N,telecommute 2-3 days and cdap non-mandatory,"((telecommute_frequency==""2_days_week"") | (telecommute_frequency==""3_days_week"")) & (cdap_activity==""N"")",coef_telecommute_2_3_4p_days_cdap_N,
util_telecommute_4p_days_cdap_N,telecommute 4p days and cdap non-mandatory,"(telecommute_frequency==""4_days_week"") & (cdap_activity==""N"")",coef_telecommute_2_3_4p_days_cdap_N,
util_telecommute_1_day_cdap_H,telecommute 1 day and cdap home,"(telecommute_frequency==""1_day_week"") & (cdap_activity==""H"")",coef_telecommute_1_day_cdap_H,
util_telecommute_2_3_days_cdap_H,telecommute 2-3 days and cdap home,"((telecommute_frequency==""2_days_week"") | (telecommute_frequency==""3_days_week"")) & (cdap_activity==""H"")",coef_telecommute_2_3_days_cdap_H,
util_telecommute_4p_days_cdap_H,telecommute 4p days and cdap home,"(telecommute_frequency==""4_days_week"") & (cdap_activity==""H"")",coef_telecommute_4p_days_cdap_H,
util_work_from_home_cdap_N,work from home and cdap non-mandatory,"(work_from_home==True) & (cdap_activity==""N"")",coef_work_from_home_cdap_N,
util_work_from_home_cdap_H,work from home and cdap home,"(work_from_home==True) & (cdap_activity==""H"")",coef_work_from_home_cdap_H,
# industry,,,,
util_industry_retail,retail industry,"@df.naics_code.isin([44,45])",coef_industry_retail,
util_industry_construction,construction industry,@df.naics_code==23,coef_industry_construction,
util_industry_other,srv industry_other,@df.naics_code==81,coef_industry_other,
util_industry_healthcare,healthcare industry,@df.naics_code==62,coef_industry_healthcare,
util_industry_education,education industry,@df.naics_code==61,coef_industry_education,
util_industry_government,government industry,@df.naics_code==92,coef_industry_government,
util_industry_mgmt_srv,mgmt_srv,@df.naics_code==55,coef_industry_mgmt_srv,
util_industry_manufacturing,manufacturing,"@df.naics_code.isin([31,32,33,3000])",coef_industry_manufacturing,
util_industry_entertainment,entertainment,@df.naics_code==71,coef_industry_entertainment,
util_industry_accommodation,accommodation,"@df.naics_code.isin([721,722])",coef_industry_accomodation,
util_industry_military,military,@df.naics_code==9000,coef_industry_military,
util_cdap_N_non_mandatory_accessibility,CDAP N and Disaggregate non-mandatory accessibility at home location,"(cdap_activity==""N"")*(othdiscr_accessibility + shopping_accessibility) / 2",coef_cdap_N_non_mandatory_accessibility,
# intrazonal,,,,
util_intrazonal,intrazonal,home_zone_id==workplace_zone_id,coef_intrazonal,
6 changes: 6 additions & 0 deletions configs/resident/telework_arrangement.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SPEC: telework_arrangement.csv
COEFFICIENTS: telework_arrangement_coeffs.csv

LOGIT_TYPE: MNL

HAS_IN_HOME_WORK_ACTIVITY_ALT: 0
30 changes: 30 additions & 0 deletions configs/resident/telework_arrangement_coeffs.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
coefficient_name,value,constrain
coef_acs_has_in_home_work_activity,-1.39,F
coef_age_above_35,-0.206,F
coef_cdap_N_non_mandatory_accessibility,0.0584,F
coef_dummy_missing_workplace,0.433,F
coef_has_preschool_at_home_has_in_home,0.341,F
coef_income_100_150,0.128,F
coef_income_150p,0.222,F
coef_industry_accomodation,-0.798,F
coef_industry_construction,-0.851,F
coef_industry_education,-0.541,F
coef_industry_entertainment,-1.09,F
coef_industry_government,-0.517,F
coef_industry_healthcare,-0.466,F
coef_industry_manufacturing,-0.415,F
coef_industry_mgmt_srv,-0.594,F
coef_industry_military,-0.645,F
coef_industry_other,-0.986,F
coef_industry_retail,-0.746,F
coef_intrazonal,0.586,F
coef_parttime_has_in_home,-0.631,F
coef_telecommute_1_day_cdap_H,1.43,F
coef_telecommute_1_day_cdap_N,0.397,F
coef_telecommute_2_3_4p_days_cdap_N,1.81,F
coef_telecommute_2_3_days_cdap_H,2.27,F
coef_telecommute_4p_days_cdap_H,2.54,F
coef_univ_student_has_in_home,-0.737,F
coef_work_from_home_cdap_H,2.81,F
coef_work_from_home_cdap_N,2.59,F
coef_workplace_mc_logsum,-0.0349,F
10 changes: 10 additions & 0 deletions configs/resident/telework_duration.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Label,Description,Expression,3-5 hours,5-7 hours,7-9 hours,9+ hours
util_asc,alternative specific constant,@1,coef_acs_3_5,coef_acs_5_7,,coef_asc_9_plus
util_part_time,part-time worker,@df.ptype==2,coef_part_time_3_5,coef_part_time_5_7,,coef_part_time_9_plus
util_university_student,university student,@df.ptype==3,coef_university_student_3_5,coef_university_student_5_7,,
util_work_from_home,work from home,work_from_home,,,,coef_work_from_home_9_plus
util_hybrid,hybrid worker,(cdap_activity=='M')&(ptype<3),,,coef_hybrid_7_plus,coef_hybrid_7_plus
util_income_150_plus,income 150k+,(income_in_thousands>=150),coef_income_150_plus_3_7,coef_income_150_plus_3_7,,
util_workplace_mc_logsum,workplace mode choice logsum,"@np.where(df.workplace_zone_id > -1, df.workplace_modechoice_logsum, 0)",coef_workplace_mc_logsum_3_7,coef_workplace_mc_logsum_3_7,,
#util_dummy_missing_workplace,util_dummy_missing_workplace,"@np.where((df.workplace_zone_id<=-1)&(~df.work_from_home), 1, 0)",coef_dummy_missing_workplace_3_5,coef_dummy_missing_workplace_5_7,,
util_intrazonal,intrazonal,home_zone_id==workplace_zone_id,coef_intrazonal_3_5,,,
24 changes: 24 additions & 0 deletions configs/resident/telework_duration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# CHOICE_MODEL: PROBABILISTIC
CHOICE_MODEL: MNL

# Worker filters: apply only to workers with in-home work activity.
CHOOSER_FILTER_COLUMN_NAME: has_in_home_work_activity

# Output columns on persons table.
DURATION_CATEGORY_COLUMN_NAME: telework_duration_category
DURATION_HOURS_COLUMN_NAME: telework_duration_hours

# Shared alternatives for both model types.
ALTS: telework_duration_alts.csv
ALT_NAME_COLUMN: alt
ALT_DURATION_COLUMN: duration_hours

# Probabilistic configuration.
PROBS_SPEC: telework_duration_probs.csv
PROBS_JOIN_COLS:
- ptype

# MNL configuration (used when CHOICE_MODEL: MNL).
SPEC: telework_duration.csv
COEFFICIENTS: telework_duration_coeffs.csv
LOGIT_TYPE: MNL
5 changes: 5 additions & 0 deletions configs/resident/telework_duration_alts.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alt,duration_hours
3-5 hours,4
5-7 hours,6
7-9 hours,8
9+ hours,10
16 changes: 16 additions & 0 deletions configs/resident/telework_duration_coeffs.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
coefficient_name,value,constrain
coef_acs_3_5,-1.71,F
coef_acs_5_7,-1.80,F
coef_asc_9_plus,-1.53,F
coef_dummy_missing_workplace_3_5,1.7,F
coef_dummy_missing_workplace_5_7,1.28,F
coef_hybrid_7_plus,-6.70,F
coef_income_150_plus_3_7,-0.194,F
coef_intrazonal_3_5,0.495,F
coef_part_time_3_5,2,F
coef_part_time_5_7,1.85,F
coef_part_time_9_plus,-1.64,F
coef_university_student_3_5,2.16,F
coef_university_student_5_7,1.85,F
coef_work_from_home_9_plus,-0.264,F
coef_workplace_mc_logsum_3_7,0.0624,F
4 changes: 4 additions & 0 deletions configs/resident/telework_duration_probs.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ptype,3-5 hours,5-7 hours,7-9 hours,9+ hours
1,0.14,0.13,0.62,0.11
2,0.45,0.33,0.22,0
3,0.73,0.11,0.03,0.13
3 changes: 2 additions & 1 deletion test/test_sandag_abm3.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ def regress(out_dir: Path, regress_dir: Path = None, filename="final_trips.csv")
"transponder_ownership",
"free_parking",
"telecommute_frequency",
"telecommute_status",
"cdap_simulate",
"telework_arrangement",
"telework_duration",
"mandatory_tour_frequency",
"mandatory_tour_scheduling",
"school_escorting",
Expand Down
Loading