causal: Time Series Based Causal Analysis

Description Usage Arguments Details Value Author(s) References

Description

Performs a time series causal analysis using a simulated predictive distribution for the counterfactual.

Usage

1
2
3
4
tscausal(object, ...)
## S3 method for class 'tsmodel.distribution'
tscausal(object, actual, fitted = NULL, 
alpha = 0.05, include_cumulative = TRUE, ...)

Arguments

object

An object which inherits class “tsmodel.distribution” representing the forecast distribution in the post intervention period.

actual

An xts vector of the actual data series which includes both the pre and post intervention data.

fitted

An optional object for the in-sample fitted values which can be either an xts vector or an object of class “tsmodel.distribution”.

alpha

The coverage representing the 1-alpha confidence level.

include_cumulative

Whether to include cumulative sum analysis. This is only valid if the target represents a flow variable.

...

Any additional arguments passed to custom classes.

Details

The routine calculates the point wise differences between the actual and counterfactual (distribution) to determine the distribution of the lift.

Value

An object of class “tscausal” which can be passed to the print, report or plot functions.

Author(s)

Alexios Galanos with some supporting code borrowed from the CausalImpact package of Scott.

References

Brodersen, Kay H and Gallusser, Fabian and Koehler, Jim and Remy, Nicolas and Scott, Steven L and others (2016). Inferring causal impact using Bayesian structural time-series models. The Annals of Applied Statistics, 9 (1), 247-274.


tsmodels/tscausal documentation built on Dec. 31, 2020, 9:38 a.m.