bicyclingplus / atp-bc-tool-analysis

Analyzing inputs/outputs from the CTC Active Transportation Benefits/Costs tool, to identify and investigate potential issues (analysis notebooks only - input/output data is not included)
0 stars 0 forks source link

Compare safety results based on user inputted existing crashes and model crashes #2

Open mRaffill opened 1 year ago

mRaffill commented 1 year ago

Calculate using model only


Calculate using user-input only


Make NC just be based on whatever is used as EC


Compare using model only or user-input only or just using whatever is used as EC

mRaffill commented 1 year ago

"Calculate a new column "new_crashes_used" of New Crashes based only on whatever was used for Existing Crashes (eg. apply the % safety benefits to whatever number was used as existing crashes - if this is feasible)": a new equation is needed for this. Here are the existing equations (according to the calculations documentation):

New crashes

$NC{cmojk}=(\sum{f}\sum{v}NCC{cmojvfk}) * CRF_{mojk}$

$NCC{cmojvfk}=e^{Ɑ{mojvf}} L_{jvf} (PV_{cmjk})^{p}$

Volume

$PV{cmjk}=EV{cmj}+\sum{i}\sum{F}\Delta V_{cmjkiF}$

$\Delta V{cmjkiF}=EV{cmj} E_{ik} \frac{Ni}{L} *I_{F}$

Existing Crashes

(based on the model - since that is essentially the basis from which new crashes are currently calculated)

$EC{cmoj} = \sum{f}\sum{v}ECC{cmojvf}$

$ECC{cmojvf} = e^{Ɑ{mojvf}} L_{jvf} (EV_{cmj})^{p}$

mRaffill commented 1 year ago

Now, the goal is to rewrite the equation for new crashes so that it can be based off of the user-inputted crashes, or ideally just whatever the tool is using for exiting crashes (since there will potentially be a completely different method for measuring crashes in the future)

mRaffill commented 1 year ago

Here is what I've gotten based on simplifying and re-arranging the existing equations:

First, simplify and combine:

  1. Simplify new crashes $NC_{cmojk}$ (just substitute NCC into NC) $NC{cmojk}=(\sum{f}\sum{v}e^{Ɑ{mojvf}} L_{jvf} (PV{cmjk})^{p}) * CRF{mojk}$
  2. Simplify existing crashes (based on model) $EC_{cmoj}$ (just substitute ECC into EC) $EC{cmoj} = \sum{f}\sum{v}e^{Ɑ{mojvf}} L_{jvf} (EV_{cmj})^{p}$
  3. Simplify projected volume $PV_{cmjk}$ a) Just substitute $\Delta V$ into PV $PV{cmjk}=EV{cmj}+\sum{i}\sum{F}EV{cmj}* E{ik} \frac{Ni}{L} I{F}$ b) Then pull EV out of the summation because it is not actually split by either i or F - it is like a constant multiplier here $PV{cmjk}=EV{cmj}+EV{cmj} \sum{i}\sum{F}E_{ik} \frac{Ni}{L} I{F}$ c) Factorize $PV{cmjk}=EV_{cmj} (1 + \sum{i}\sum{F}E{ik} \frac{Ni}{L} I{F})$

Next, substitute these equations into the equation for new crashes:

  1. Substitute equation for PV into equation for NC $NC{cmojk}=(\sum{f}\sum{v}e^{Ɑ{mojvf}} L_{jvf} (PV{cmjk})^{p}) * CRF{mojk}$ $NC{cmojk}=[\sum{f}\sum{v}e^{Ɑ{mojvf}} L_{jvf} (EV{cmj} * (1 + \sum{i}\sum{F}E{ik} \frac{Ni}{L} I{F}))^{p}] * CRF{mojk}$
  2. Distribute power p $NC{cmojk}=[\sum{f}\sum{v}e^{Ɑ{mojvf}} L_{jvf} (EV{cmj})^{p} * (1 + \sum{i}\sum{F}E{ik} \frac{Ni}{L} I{F})^{p}] * CRF{mojk}$
  3. Now, the first section of this equation is the same as the model based equation for existing crashes. For now I am going to assume that this means it is interchangeable with existing crashes, and substitute in $EC{cmoj}$. This means that now, the percentage changes in volume and percentage changes in crashes are directly applied to existing crashes (regardless of the source - model, user input, something else entirely), instead of re-calculating based on only the model. $EC{cmoj} = \sum{f}\sum{v}e^{Ɑ{mojvf}} * L{jvf} (EV{cmj})^{p}$ $NC{cmojk}=[EC_{cmoj} (1 + \sum{i}\sum{F}E{ik} \frac{Ni}{L} I{F})^{p}]*CRF_{mojk}$
mRaffill commented 1 year ago

Now the question is whether I can quickly calculate a new column based on this equation to test it out!

mRaffill commented 1 year ago

Required information for the equation: $NC{cmojk}=EC{cmoj} (1 + \sum{i}\sum{F}E_{ik} \frac{Ni}{L} I_{F})^{p}CRF_{mojk}$ Existing crashes (whatever the tool used - user-input if >5 years, model if 0 years, split if 0-5 years)

Selected infrastructure, infrastructure share, improvement type, and % change in volume

Crash reduction factor

mRaffill commented 1 year ago

Need to figure out somehow which existing crash variation was used

Ah, I forgot to include this in the data request! Need to send an update just asking for a table of how many user-input years were provided and which existing crash variation was used for each project...

mRaffill commented 1 year ago

Implemented a first version of this equation (just to test it out, very messy and may not completely work) in b003083b1a519d0f79ccb5addda2b75b08b607d6 It should theoretically give the same result as the current NCmojk if given the current model-based ECmoj.

mRaffill commented 1 year ago
mRaffill commented 12 months ago
mRaffill commented 11 months ago

Graph existing crashes (model) and existing crashes (user-input) across all projects (to see how much the model and user input vary by)

image

Model and user-input crashes clearly vary a lot. Since crash change is then calculated with model new crashes - user existing crashes (if user input is provided) the crash change then becomes positive and very large.

It seems unreasonable that the model crashes would be this high - there are in fact some issues with the model (#5)

mRaffill commented 11 months ago
These are the graphs split by location type and sorted low->high, showing how the model crashes seem to be increasing much more dramatically than user crashes. And this is much more of an issue for segments compared to intersections - user-input and model crashes do seem fairly similar for the segments, but clearly not for the intersections. (again this may be resolved by fixing the issue in #5 with duplicated volumes, just adding for reference of past work) intersections roadways
image image
mRaffill commented 11 months ago

After implementing the new equation, the absolute crashes do seem better - much more are negative now, especially when looking at the user inputted crashes (although this is still without making any improvements/fixes to the model so it may get better later):

user-only change: user new crashes - user existing crashes image

model-only change: model new crashes - model existing crashes image

existing process: model new crashes - user existing crashes (if user-input is provided) image

mRaffill commented 4 months ago

In https://github.com/mRaffill/atp-bc-tool-analysis/issues/7#issuecomment-2051327211 I realized this new equation didn't take into account how to calculate the combined mode crashes.

For the new equation: $NC{cmojk}=[EC{cmoj} (1 + \sum{i}\sum{F}E_{ik} \frac{Ni}{L} I_{F})^{p}]CRF_{mojk}$

There aren't infrastructure travel benefits for combined mode (the $\sum{i}\sum{F}E{ik} \frac{Ni}{L} I{F}$ part), so this equation won't work directly for combined mode.

In the original equations: $EC{cmoj} = \sum{f}\sum{v}e^{Ɑ{mojvf}} L_{jvf} (EV{cmj})^{p}$ $NC{cmojk}=(\sum{f}\sum{v} e^{Ɑ{mojvf}} * L{jvf} (PV_{cmjk})^{p}) CRF{mojk}$ $PV{cmjk}=EV{cmj} * (1 + \sum{i}\sum{F}E{ik} \frac{Ni}{L} I{F})$ New crashes were calculated directly from the the new projected volume, with the combined mode volume = bicycle volume + pedestrian volume. So the general structure of the equation for combined crashes was originally something like $PV{combined} = EV{bike} * (bike ratio) + EV{walk} (walk ratio)$ $EC{combined} = \sum{f}\sum{v}e^{Ɑ{mojvf}} L{jvf} * (EV{bike} + EV{walk})^{p}$ $NC{combined}=(\sum{f}\sum{v} e^{Ɑ{mojvf}} * L{jvf} (EV_{bike} (bike ratio) + EV{walk} (walk ratio))^{p}) CRF{mojk}$]

It isn't possible to directly factor the projected volume to be based on the original travel benefit percentages from the project infrastructure. But since that term is essentially just scaling the crashes by the ratio between the projected volume and existing volume, it seems like we could just calculate that ratio separately for combined mode, instead of directly using infrastructure benefits: $NC{combined}=(\sum{f}\sum{v} e^{Ɑ{mojvf}} L_{jvf} (EV{combined} * (PV{combined}/EV{combined}))^{p}) * CRF{mojk}$

Then again, rewriting the new crashes in terms of whatever the existing crashes are: $NC{combined}=(\sum{f}\sum{v} e^{Ɑ{mojvf}} L_{jvf} (EV{combined})^{p} * (PV{combined}/EV{combined})^{p}) * CRF{mojk}$ Substituting the existing crashes for combined mode $EC{combined} = \sum{f}\sum{v}e^{Ɑ{mojvf}} L_{jvf} (EV{combined})^{p}$ The general structure for the combined mode crashes would be something like $NC{combined}=(EC{combined} * (PV{combined}/EV{combined})^{p}) * CRF{mojk}$

I think this is the most general form of the new crashes equation. Basically, new crashes = existing crashes ratio between new and existing volume crash reduction ratio. It works for bicycling and walking (where $PV{combined}/EV{combined}$ is just the same as the infrastructure travel increases), and for combined mode (where PV and EV need to be calculated separately as the sum of bicycling and walking volumes).

mRaffill commented 4 months ago

Writing out this new new crashes equation a bit more formally:

current iteration: $NC{cmojk}=[EC{cmoj} (1 + \sum{i}\sum{F}E_{ik} \frac{Ni}{L} I_{F})^{p}]CRF{mojk}$ potential new iteration: $NC{cmojk}=(EC{cmojk} * (PV{cmjk}/EV{cmj})^{p}) * CRF{mojk}$

where $PV{cmjk} = EV{cmj} (1 + \sum{i}\sum{F}E_{ik} \frac{Ni}{L} * I{F})$ for m = bicycle or pedestrian $PV{cmjk} = PV{cmj{bicycle}}+PV{cmj{pedestrian}}$ for m = combined (not sure how to structure all of the subscripts here though!)

drafts - trying out other potential equations/simplifications Maybe use the fact that the alpha constant for combined mode is the average of the bicycle and pedestrian alpha constants? $EC_{combined} = \sum_{f}\sum_{v}e^{(Ɑ_{bicycle} + Ɑ_{pedestrian})/2} * L_{jvf} * (EV_{bicycle}+EV_{pedestrian})^{p}$ $EC_{combined} = \sum_{f}\sum_{v}e^{Ɑ_{bicycle}/2} *e^{Ɑ_{pedestrian}/2} * L_{jvf} * (EV_{bicycle}+EV_{pedestrian})^{p}$ $NC_{combined} = \sum_{f}\sum_{v}e^{Ɑ_{bicycle}/2} *e^{Ɑ_{pedestrian}/2} * L_{jvf} * (PV_{bicycle}+PV_{pedestrian})^{p}*CRF_{mojk}$ What if $EC_{combined} = EC_{bicycle} + EC_{pedestrian}$ (not actually how the tool works right now, but just to see if it would make the calculations simpler) $NC_{combined} = EC_{combined} * ((PV_{bicycle} + PV_{combined})/(EV_{bicycle} + EV_{combined}))^{p}$ $NC_{combined} = EC_{bicycle} + EC_{pedestrian} *(PV_{bicycle} + PV_{combined})^{p}/(EV_{bicycle} + EV_{combined})^{p}*CRF_{mojk}$ No, none of these seem to simplify things any further. I guess any other simplifications aren't really possible, because the "safety in numbers" power p makes it impossible to rearrange or separate the bicycle volume + pedestrian volume terms.