Learn R Programming

The simITS Package

This package is for analyzing ITS designs with parametric simulation and extrapolation

Active code is on github, with clean releases posted to CRAN.

How to learn how to use this package

I would recommend starting by reading the methods overview paper, "Using Simulation to Analyze Interrupted Time Series Designs", on ArXiV https://arxiv.org/abs/2002.05746.

There is also a vignettes in the package that walks through almost everything.

Disclaimer

The post-stratified ITS code is both messier and less developed. There are multiple ways one might adjust for time-varying covariates, and this is an active area of ongoing research. Buyer beware!

Making contributions

You are most welcome to check out a copy from github https://github.com/lmiratrix/simITS and play with the code. All suggestions and improvements most welcome!

Copy Link

Version

Install

install.packages('simITS')

Monthly Downloads

165

Version

0.1.1

License

GPL-3

Maintainer

Luke Miratrix

Last Published

May 20th, 2020

Functions in simITS (0.1.1)

aggregate_simulation_results

Test a passed test statistic on the simulated data
meck_subgroup

Mecklenberg data by subgroup of charge type
calculate_group_weights

Calculate proportion of subgroups across time
calculate_average_outcome

Summary function for summarize.simulation.results
mecklenberg

Mecklenberg PSA Reform Data
make_many_predictions

Generate a collection of raw counterfactual trajectories
make_model_smoother

Make a smoother that fits a model and then smooths residuals
smooth_series

Smooth a series using a static loess smoother
extrapolate_model

Extrapolate pre-policy data to post-policy era
fit_model_default

Default ITS model
newjersey

New Jersey PSA Reform aggregate data
generate_fake_data

Make fake data for testing purposes.
process_outcome_model

Generate an ITS extrapolation simulation.
generate_fake_grouped_data

A fake DGP with time varying categorical covariate for illustrating the code.
simITS

simITS package overview
smooth_residuals

Smooth residuals after model fit
add_lagged_covariates

Augment dataframe with lagged covariates
adjust_data

Adjust an outcome time series based on the group weights.
make_fit_season_model

Make a fit_model that takes a seasonality component
make_envelope_graph

Make envelope style graph with associated smoothed trendlines
aggregate_data

Aggregate grouped data