cauimp: Computes Causal Inference through Counterfactual Predictions...

View source: R/cauimp.R

cauimpR Documentation

Computes Causal Inference through Counterfactual Predictions from a Mixture Estimation with State-Space Components.

Description

This function estimates causal inference through counterfactual predictions from a mixture estimation with state-space components. Multi-step ahead predictions are generated by the Monte Carlo method.

Usage

cauimp(object,x.post,y.post,alpha=0.05,n.sim=100)

Arguments

object

object of class mixest obtained from mixest1 for the pre-intervention period

x.post

matrix of independent time-series (predictors) for the post-intervention period, observations inserted rowwise

y.post

one column matrix of the post-intervention period observed dependent time-series, observations inserted rowwise

alpha

optional, numeric between 0 and 1, the desired tail area probability for posterior intervals, by default alpha=0.05 is taken

n.sim

optional, numeric, number of the post-intervention period simulations, by default n.sim=100 is taken

Value

list of

$statistics

matrix of summary statistics for the post-intervention period

$significance

logical indicating whether the posterior interval excludes zero

$p

numeric of Bayesian one-sided tail area probability that the observed effect was obtained by chance

$y.hat

vector of the dependent variable predicted for the post-intervention period

$alpha

numeric of the desired tail area probability for posterior intervals, as above

$n.sim

numeric of the number of the post-intervention period simulations, as above

$y.sim

matrix of the simulated dependent variable predictions for the post-intervention period

References

Brodersen, K. H., Gallusser, F., Koehler, J., Remy, N., Scott, S. L., 2015, Inferring causal impact using Bayesian structural time-series models. Annals of Applied Statistics 9, 247–274.

Morgan, S. L., Winship, C., 2007, Counterfactuals and Causal Inference, Cambridge University Press.

See Also

mixest1, CausalImpact

Examples


data(oil)
m1 <- mixest1(y=oil[1:300,1,drop=FALSE],x=oil[1:300,-1,drop=FALSE],ftype=0,V=1,W=1,kappa=0.97)
x.1 <- oil[301:323,-1,drop=FALSE]
y.1 <- oil[301:323,1,drop=FALSE]
ci <- cauimp(object=m1,x.post=x.1,y.post=y.1,alpha=0.05,n.sim=100)


dynmix documentation built on July 9, 2023, 7:22 p.m.

Related to cauimp in dynmix...