Skip to content

Instantly share code, notes, and snippets.

@bgweber
Last active July 12, 2017 23:13
Show Gist options
  • Save bgweber/3e9d9f929583a530d7aa06efd5f9b7a6 to your computer and use it in GitHub Desktop.
Save bgweber/3e9d9f929583a530d7aa06efd5f9b7a6 to your computer and use it in GitHub Desktop.
library(CausalImpact)
data <- read.csv(file = "DailySessions.csv")
# Create a DataFrame and plot the input data
ts <- cbind(data$test, data$control)
matplot(ts, type = "l")
# Use two week prior and post periods and plot results
pre.period <- c(1, 14)
post.period <- c(15, 30)
impact <- CausalImpact(ts, pre.period, post.period)
# Plot the results and explain the outcome
plot(impact, c("original", "pointwise"))
summary(impact, "report")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment