InstrumentalVariable#
- class causalpy.pymc_experiments.InstrumentalVariable[source]#
A class to analyse instrumental variable style experiments.
- Parameters:
instruments_data (
DataFrame
) – A pandas dataframe of instruments for our treatment variable. Should contain instruments Z, and treatment tdata (
DataFrame
) – A pandas dataframe of covariates for fitting the focal regression of interest. Should contain covariates X including treatment t and outcome yinstruments_formula (
str
) – A statistical model formula for the instrumental stage regression e.g. t ~ 1 + z1 + z2 + z3formula (
str
) –A statistical model formula for the
focal regression e.g. y ~ 1 + t + x1 + x2 + x3
model – A PyMC model
priors –
An optional dictionary of priors for the mus and sigmas of both regressions. If priors are not specified we will substitue MLE estimates for the beta coefficients. Greater control can be achieved by specifying the priors directly e.g. priors = {
”mus”: [0, 0], “sigmas”: [1, 1], “eta”: 2, “lkj_sd”: 2, }
Methods
InstrumentalVariable.__init__
(...[, model, ...])Two Stage Least Squares Fit
Naive Ordinary Least Squares
Prints the model coefficients
Attributes
expt_type
idata
Access to the models InferenceData object
model
- __init__(instruments_data, data, instruments_formula, formula, model=None, priors=None, **kwargs)[source]#
- __new__(*args, **kwargs)#