CausalPy
CausalPy copied to clipboard
Add penalised synthetic control model
As of now, we have "vanilla" synthetic control working with ~~cp.pymc_experiments.SyntheticControl
~~ cp.SyntheticControl
as the experiment class, and that is fed the cp.pymc_models.WeightedSumFitter
as the model.
It is the cp.pymc_models.WeightedSumFitter
which does the vanilla synthetic control model - as in weightings which sum to 1, and that is done via a Dirichlet distribution.
We want to add the ability to do penalised synthetic control. This will still use the ~~cp.pymc_experiments.SyntheticControl
~~ cp.SyntheticControl
experiment class, but instead we will feed it a new model, something like cp.pymc_models.PenalizedSyntheticControlModel
. (However, see below because we may no need a new model)
Implementation notes
As far as I understand constraining the sum of the weights of control units to sum to 1 is optional in penalised synthetic control.
If we want to keep the sum to 1 constraint, then we could just keep the existing cp.pymc_models.WeightedSumFitter
model, but change the hyper parameters of the Dirichlet distribution to bias towards more sparsity in the coefficients.
If we don't want to keep the sum to 1 constraint, then we could create a new model class and implement the L1 or L2 constraint via Laplace or Normal priors on coefficients.