Extracting Statistics from CausalImpact Summary

Say I have a CausalImpact Summary like this:

> summary(impact)
Posterior inference {CausalImpact}

Average        Cumulative
Actual                   3              65
Prediction (s.d.)        2.7 (0.46)     60.4 (10.21)
95% CI                   [1.8, 3.6]     [40.4, 79.6]

Absolute effect (s.d.)   0.21 (0.46)    4.56 (10.21)
95% CI                   [-0.66, 1.1]   [-14.63, 24.6]

Relative effect (s.d.)   7.5% (17%)     7.5% (17%)
95% CI                   [-24%, 41%]    [-24%, 41%]

Posterior tail-area probability p:   0.32852
Posterior prob. of a causal effect:  67%

For more details, type: summary(impact, "report")

How would I extract the Actual Average of 3? How would I extract the Posterior tail-area probability p?

I've tried summarizing numbers from the impact$series dataframe, but the average of the actual values after the date of intervention doesn't equal 3, so I'm stumped. Thanks! • I guess you can find all you need in impact$summary. – user81847 Jan 19 '16 at 4:57

Using the first example of ?CausalImpact

set.seed(1)
x1 <- 100 + arima.sim(model = list(ar = 0.999), n = 100)
y <- 1.2 * x1 + rnorm(100)
y[71:100] <- y[71:100] + 10
data <- cbind(y, x1)
pre.period <- c(1, 70)
post.period <- c(71, 100)
impact <- CausalImpact(data, pre.period, post.period)

summary(impact)
# Posterior inference {CausalImpact}

#                          Average        Cumulative
# Actual                   117            3511
# Prediction (s.d.)        107 (0.42)     3195 (12.51)
# 95% CI                   [106, 107]     [3169, 3218]

# Absolute effect (s.d.)   11 (0.42)      316 (12.51)
# 95% CI                   [9.8, 11]      [293.0, 342]

# Relative effect (s.d.)   9.9% (0.39%)   9.9% (0.39%)
# 95% CI                   [9.2%, 11%]    [9.2%, 11%]

# Posterior tail-area probability p:   0.00111
# Posterior prob. of a causal effect:  99.88901%

# For more details, type: summary(impact, "report")

In this example Average for Actual is 117 and Posterior tail-area probability p is 0.00111.

impact object is a list of 4 objects (str(impact)). We are interested in the object impact$summary: impact$summary["Average","Actual"]
#  117.0485

impact\$summary["Average","p"]
#  0.001109878