SpecificationCurve
SpecificationCurve(self, df, y_endog, x_exog, controls, exclu_grps=[[None]], cat_expand=[], always_include=[])
Specification curve object. Uses a model to perform all variants of a specification. Stores the results of those regressions in a tidy format pandas dataframe. Plots the regressions in chart that can optionally be saved. Will iterate over multiple inputs for exog. and endog. variables. Note that categorical variables that are expanded cannot be mutually excluded from other categorical variables that are expanded.
Methods
Name | Description |
---|---|
fit | Fits a specification curve by performing regressions. |
plot | Makes plots of fitted specification curve. |
fit
SpecificationCurve.fit(estimator=sm.OLS)
Fits a specification curve by performing regressions. Args: estimator (statsmodels.regression.linear_model or statsmodels.discrete.discrete_model, optional): statsmodels estimator. Defaults to sm.OLS.
plot
SpecificationCurve.plot(save_path=None, pretty_plots=True, preferred_spec=[])
Makes plots of fitted specification curve. Args: save_path (type, optional): Exported fig filename. Defaults to None. pretty_plots (bool, optional): whether to use this package’s figure formatting. Defaults to True. preferred_spec (list, optional): preferred specification. Defaults to [].