View source: R/ITSModelingCode.R
extrapolate_model | R Documentation |
This function takes a fitted model and uses it to make post-policy predictions by simulating data.
extrapolate_model(
M0,
dat,
outcomename = "Y",
timename = "time",
t0 = 0,
R = 400,
summarize = FALSE,
smooth = FALSE,
smoother = smooth_series,
full_output = FALSE,
fix_parameters = FALSE,
...
)
M0 |
The fit model |
dat |
Dataframe with data being analyzed. |
outcomename |
Outcome of interest (name of column). |
timename |
Name of the time variable (name of column). |
t0 |
Last pre-policy timepoint |
R |
Number of replications |
summarize |
Boolean, TRUE means collapse all simulated trajectories into single aggregate. FALSE means return all paths. |
smooth |
Boolean. TRUE means fit a smoother to the trajectories and look at distribution of smoothed trajectories. FALSE means look at raw data treajectories. |
smoother |
Function to do smoothing, if smoothing set to TRUE. Default is smooth_series() |
full_output |
TRUE means smoother returns residuals as well as smoothed series. |
fix_parameters |
Keep the parameters in the model M0 as fixed; do not add parameter uncertainty. |
... |
Extra arguments to be passed to smoother (e.g, bandwidth). |
Dataframe with columns corresponding to the simulations. If summarize=TRUE, one row per time point in original data. If FALSE, all the details of all the runs are returned.
process_outcome_model
for wrapper function
for this method that is easier to use.
data("mecklenberg" )
mecklenberg = add_lagged_covariates( mecklenberg, "pbail" )
mecklenberg.pre = dplyr::filter( mecklenberg, month <= 0 )
M0 = fit_model_default( mecklenberg.pre, "pbail" )
res = extrapolate_model( M0, "pbail", mecklenberg, 0, 1,
smooth=TRUE)
tail( res )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.