From 7289494bf98d07c749064ed70c872618333b76d6 Mon Sep 17 00:00:00 2001 From: johannah-pik <89136160+johannah-pik@users.noreply.github.com> Date: Wed, 15 Sep 2021 10:15:18 +0200 Subject: [PATCH 1/2] Change logit structure for cycling and walking Logit structure was changed as follows: Subsector_L3: "Walk" & "Cycle" -> "trn_pass_road" Subsector_L2: "Walk_tmp_subsector_L2" & "Cycle_tmp_subsector_L2" -> "Non_mot" Subsector_L1: "Walk_tmp_subsector_L1" & "Cycle_tmp_subsector_L1" -> "Walk" & "Cycle" Note: Some changes are still missing --- R/calculate_logit_inconv_endog.R | 4 ++-- edgetRansport.Rproj | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/R/calculate_logit_inconv_endog.R b/R/calculate_logit_inconv_endog.R index 653b17f..3aeed56 100644 --- a/R/calculate_logit_inconv_endog.R +++ b/R/calculate_logit_inconv_endog.R @@ -47,7 +47,7 @@ calculate_logit_inconv_endog = function(prices, ## delete entries have tot_price NA (e.g. 1900 BEV) df <- df[ !(is.na(tot_price))] ## entries that are not present in the mix have non_fuel_price == 0, but also Walk and Cycle: delete all the not-present in the mix options - df <- df[(non_fuel_price>0)|(non_fuel_price==0 & subsector_L3 %in% c("Walk", "Cycle"))] + df <- df[(non_fuel_price>0)|(non_fuel_price==0 & subsector_L1 %in% c("Walk", "Cycle"))] ## needs random lambdas for the sectors that are not explicitly calculated df <- df[ is.na(logit.exponent), logit.exponent := -10] @@ -134,7 +134,7 @@ calculate_logit_inconv_endog = function(prices, ## delete entries have tot_price NA (e.g. 1900 BEV) df <- df[ !(is.na(tot_price))] ## entries that are not present in the mix have non_fuel_price == 0, but also Walk and Cycle: delete all the not-present in the mix options - df <- df[(non_fuel_price>0)|(non_fuel_price==0 & subsector_L3 %in% c("Walk", "Cycle"))] + df <- df[(non_fuel_price>0)|(non_fuel_price==0 & subsector_L1 %in% c("Walk", "Cycle"))] ## needs random lambdas for the sectors that are not explicitly calculated df <- df[ is.na(logit.exponent), logit.exponent := -10] diff --git a/edgetRansport.Rproj b/edgetRansport.Rproj index d848a9f..cba1b6b 100644 --- a/edgetRansport.Rproj +++ b/edgetRansport.Rproj @@ -5,8 +5,13 @@ SaveWorkspace: No AlwaysSaveHistory: Default EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 Encoding: UTF-8 +RnwWeave: Sweave +LaTeX: pdfLaTeX + AutoAppendNewline: Yes StripTrailingWhitespace: Yes From 127656cc4a653b476356f5993fb06e70fddc596b Mon Sep 17 00:00:00 2001 From: Marianna Rottoli Date: Thu, 16 Sep 2021 14:16:10 +0200 Subject: [PATCH 2/2] Removed deprecated lines. --- R/calculate_logit_inconv_endog.R | 3 --- 1 file changed, 3 deletions(-) diff --git a/R/calculate_logit_inconv_endog.R b/R/calculate_logit_inconv_endog.R index 3aeed56..20a743e 100644 --- a/R/calculate_logit_inconv_endog.R +++ b/R/calculate_logit_inconv_endog.R @@ -41,13 +41,10 @@ calculate_logit_inconv_endog = function(prices, ## joins the df containing the prices with the df containing the logit exponents df <- merge(prices, logit_exponent, by=intersect(names(prices), names(logit_exponent)), all.x = TRUE) - ## joins the previous df with gathe df containing the inconvenience costs df <- merge(df, final_pref, by=intersect( names(df),names(final_pref)), all.y=TRUE) ## delete entries have tot_price NA (e.g. 1900 BEV) df <- df[ !(is.na(tot_price))] - ## entries that are not present in the mix have non_fuel_price == 0, but also Walk and Cycle: delete all the not-present in the mix options - df <- df[(non_fuel_price>0)|(non_fuel_price==0 & subsector_L1 %in% c("Walk", "Cycle"))] ## needs random lambdas for the sectors that are not explicitly calculated df <- df[ is.na(logit.exponent), logit.exponent := -10]