Create the calibration dataset from the main data table
create_modelling_data.Rd
Create the calibration dataset from the main data table
Arguments
- data
table of referrals, competes and incompletes (as different types); data needs the following field names: trust, specialty, period_id, type, months_waited_id, value
- max_months_waited
integer; the stock to pool the stocks that have waited longer into
- referrals_uplift
numeric; single value - parameter to apply to referral inputs (absolute value of the renege_params in the first stock when calibrating the models). These occur due to under-reporting of referrals data. This is applied to the observed referrals using the following formula:
$$referrals_{adjusted} = referrals_{obs} + (referrals_{obs} * uplift\_parameter)$$
See details for more information on this argument and how it is applied.
Details
This is the maths for stock = 0. We know:
(Equation 1) $$incomplete_{obs} = referrals_{obs} - complete_{obs} - reneges_{calc}$$
BUT, when \(reneges_{calc}\) are negative, we want to adjust referrals by that amount
$$incompletes_{obs} = referrals\_adj_{calc} - complete_{obs}$$
WHERE
(Equation 2) $$referrals\_adj_{calc} = referrals_{obs} + reneges_{calc}$$ (where \(reneges_{calc}\) is from equation 1)
ALSO
(Equation 3)
$$renege\_param_{calc} = \frac{reneges_{calc}}{referrals_{obs}}$$
THEREFORE, combining eq. 2 and eq. 3 (substituting \(reneges_{calc}\))
(Equation 4) $$renege\_param_{calc} = \frac{referrals\_adj_{calc} - referrals_{obs}}{referrals_{obs}}$$
REARRANGING eq. 4
$$referrals\_adj_{calc} = (renege\_param_{calc} * referrals_{obs}) + referrals_{obs}$$