File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,25 @@ def plot(self):
111
111
plot_xY (self .datapost .index , self .post_impact_cumulative , ax = ax [2 ])
112
112
ax [2 ].axhline (y = 0 , c = "k" )
113
113
114
+ # Shaded causal effect
115
+ ax [0 ].fill_between (
116
+ self .datapost .index ,
117
+ y1 = az .extract (
118
+ self .post_pred , group = "posterior_predictive" , var_names = "y_hat"
119
+ ).mean ("sample" ),
120
+ y2 = np .squeeze (self .post_y ),
121
+ color = "C0" ,
122
+ alpha = 0.25 ,
123
+ label = "Causal impact" ,
124
+ )
125
+ ax [1 ].fill_between (
126
+ self .datapost .index ,
127
+ y1 = self .post_impact .mean (["chain" , "draw" ]),
128
+ color = "C0" ,
129
+ alpha = 0.25 ,
130
+ label = "Causal impact" ,
131
+ )
132
+
114
133
# Intervention line
115
134
for i in [0 , 1 , 2 ]:
116
135
ax [i ].axvline (
Original file line number Diff line number Diff line change @@ -99,14 +99,14 @@ def plot(self):
99
99
y2 = np .squeeze (self .post_y ),
100
100
color = "C0" ,
101
101
alpha = 0.25 ,
102
- label = "causal impact" ,
102
+ label = "Causal impact" ,
103
103
)
104
104
ax [1 ].fill_between (
105
105
self .datapost .index ,
106
106
y1 = np .squeeze (self .post_impact ),
107
107
color = "C0" ,
108
108
alpha = 0.25 ,
109
- label = "causal impact" ,
109
+ label = "Causal impact" ,
110
110
)
111
111
112
112
# Intervention line
You can’t perform that action at this time.
0 commit comments