# CausalImpact with Panel Data

The way I understand it, the CausalImpact package estimates a Bayesian model meant to analyse time-series data. What if, instead, I want to use panel data (i.e. repeated observations of the same individuals over time)? Is the estimator still valid, or should I look for something else?

## 1 Answer

There are at least two ways of analysing panel data with CausalImpact.

1. One option is to align your individual time series at the point at which the intervention in each individual began. Then average or sum all time series and use this aggregate time series as the response variable in CausalImpact(). This is the simplest approach, and it's probably the thing I would begin with.

2. Another option is to analyse each of your units separately by running independent CausalImpact() analyses, then combine the resulting posterior inferences. This approach is more principled as you are modelling all the available data without pre-aggregating them, however combining the posterior inferences will require a little additional coding. Rather than simply aggregating your posterior expectations, you want to aggregate the individual MCMC traces and then summarise the result in terms of an expectation and a credible interval.

• could you expand a little on #2? Say I run CausalImpact once each on two different states and use monthly unemployment rates as the response. And I use a bunch of other (state-level) economic indicators as predictors in the regressions. If one of the states increases the minimum wage I would expect to see some changes. How would I describe the global, i.e. both states', change in monthly unemployment rates attributable to the intervention? I can turn this into a full question if you'd prefer. Feb 10 '17 at 5:53