its2es

This package implements interrupted time series analysis for both continuous and count outcomes, and quantifies the associated effect size, as described in Effect size quantification for interrupted time series analysis: Implementation in R and analysis for Covid-19 research. The main functions fit an ITS regression model, and then use the fitted values and the model-based counterfactual values to quantify the effect size (Cohen's d for continuous outcomes and relative risk for count outcomes). An example describing how to install and use this package is described below. A more detailed tutorial, including the data analysis described in the paper, is also available with this package (Rmd + pdf file).

Installation

You can install the package from its GitHub repository. You first need to install the devtools package.

install.packages("devtools",repos = "http://cran.us.r-project.org")

Then install its2es using the install_github function in the devtools package.

library(devtools)
install_github("Yael-Travis-Lumer/its2es")

Example

  1. Load library and Israel all-cause mortality data (discussed in paper)
library(its2es)
data <- Israel_mortality
  1. Define formula and intervention start index for the Covid-19 period
form <- as.formula("percent ~ time")
intervention_start_ind <- which(data$Year==2020 & data$Month==3)
  1. Fit a linear regression ITS model to the mortality percent
fit <- its_lm(data=data,form=form,time_name = "time",intervention_start_ind=intervention_start_ind, freq=12,seasonality= "full", impact_model = "full",counterfactual = TRUE, print_summary = FALSE)
  1. Plot predicted values and counterfactual values
p <- plot_its_lm(data=fit$data,intervention_start_ind=intervention_start_ind, y_lab="All-cause mortality percent", response="percent", date_name= "Date")
p


Yael-Travis-Lumer/its2es documentation built on Oct. 31, 2022, 8:05 a.m.