metahit / mh-execute

0 stars 2 forks source link

Injury model #2

Open robj411 opened 4 years ago

robj411 commented 4 years ago

A challenge with the injury model is that, if it depends on any parameter that is uncertain, it needs to be re-run with each new parameter sample. If the model run takes a few hours, and we have 1024 parameter samples, this is infeasible.

One solution might be to remove any dependence on uncertain parameters from the model, or, equivalently, decide that the injury model parameters will not be uncertain.

For example, we could decide that distances travelled are not uncertain, and that injury linearity parameters are uncertain. Then, instead of the ITHIM-R version, which is

form <- 'count~...+ offset(log(cas_distance) + log(strike_distance) + (CAS_EXPONENT-1)*log(cas_distance_sum) + (STR_EXPONENT-1)*log(strike_distance_sum))' mod <- glm(as.formula(form))

we would write

form <- 'count~...+ offset(log(cas_distance) + log(strike_distance))' mod <- glm(as.formula(form))

in mh-injury/add_distance_to_injury.R to build the model, and predict in mh-execute/metahit_script.R using the scenario distances, and then scale the prediction by

(CAS_EXPONENT-1)*log(scen_cas_distance_sum) + (STR_EXPONENT-1)*log(scen_strike_distance_sum) - (CAS_EXPONENT-1)*log(base_cas_distance_sum)+(STR_EXPONENT-1)*log(base_strike_distance_sum).

If distances are to be uncertain too, then they ought to be excluded from the model build, e.g.

form <- 'count~...' mod <- glm(as.formula(form))

where ... should now include more interaction terms to allow for inter-city differences that would have been captured by distance.

Then the prediction model would be scaled by

log(scen_cas_distance) + log(scen_strike_distance) - log(base_cas_distance) + log(base_strike_distance) + (CAS_EXPONENT-1)*log(scen_cas_distance_sum) + (STR_EXPONENT-1)*log(scen_strike_distance_sum) - (CAS_EXPONENT-1)*log(base_cas_distance_sum) + (STR_EXPONENT-1)*log(base_strike_distance_sum).