# 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?

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.