Package: appelpy
appelpy: Applied Econometrics Library for Pythonappelpyis theApplied Econometrics Library for Python.  It seeks to bridge the gap between the software options that have a simple syntax (such as Stata) and other powerful options that use Python's object-oriented programming as part of data modelling workflows.  ⚗️Econometric modelling and general regression analysis in Python have never been easier!The library builds upon the functionality of the 'vanilla' Python data stack (e.g. Pandas, Numpy, etc.) and other libraries such as Statsmodels.10 Minutes to AppelpyExplore the core functionality of Appelpy in the10 Minutes To Appelpynotebook (click the badges):: interactive experience of the10 Minutes to Appelpytutorial via Binder.: static render of the10 Minutes to Appelpynotebook.InstallationInstall the library via the Pip command:pipinstallappelpySupported for Python 3.6 and higher versions.Why Appelpy?Basic usageIt only takesone line of codeto fit a basic linear model of 'y on X' and another line to return the model's results.fromappelpy.linear_modelimportOLSmodel1=OLS(df,y_list,X_list).fit()# y_list & X_list contain df columnsmodel1.results_output# returns (Statsmodels) summary resultsModel objects have many useful attributes, e.g. the inputs X & y, standardized X and y values, results of fitted models (incl. standardized estimates).  The library also hasdiagnostic classes and functionsthat consume model objects (or else their underlying data).These are more things that can be obtained viaone line of code:Diagnosticscan be called from the object: e.g. produce a P-P plot viamodel1.diagnostic_plot('pp_plot')Model selection statistics: e.g. find the root mean square error of the model frommodel1.model_selection_statsStandardized model estimates:model1.results_output_standardizedClasses in the library have a fluent interface, so that they can be instantiated and have chained methods in one line of code.Features that add value to model workflows in PythonSee Appelpy'skey features(with images), which addso much moreto the vanilla Python data stack, e.g.:Fluent interface and API design make it easier to build pipelines for modelling & data pre-processing.More accessible interface for Stata users, while utilising the benefits of object-orientated programming.One method for callingdiagnostic plotsto assess whether OLS assumptions hold in a model.Useful encodersfor transforming datasets, e.g.DummyEncoderandInteractionEncoder.Standardized model estimates (Beta coefficients).Decomposition of influence analysis into three parts: leverage, outlier and influence measures.Identify extreme observations in a model based on common heuristics.Perform diagnostics not implemented in the main Python libraries, e.g. studentized Breusch–Pagan test of heteroskedasticity.ModulesExploration and pre-processingeda:functions for exploratory data analysis (EDA) of datasets, e.g.statistical_momentsfor obtaining mean, variance, skewness and kurtosis of all numeric columns.utils:classes and functions for data pre-processing, e.g. encoding of interaction effects and dummy variables in datasets.DummyEncoder: encode dummy variables in a dataset based on different policies for dealing with NaN values.InteractionEncoder: encode interaction effects of variables in a dataset.Model fittinglinear_model:classes for linear models such as Ordinary Least Squares (OLS) and Weighted Least Squares (WLS).discrete_model:classes for discrete choice models, e.g. logistic regression (Logit).Model diagnosticsdiagnostics:BadApples: class for inspecting observations that could 'stink up' a model, i.e. the observations that are outliers, high-leverage points or else have high influence in a model.variance_inflation_factors: function that returns variance inflation factor (VIF) scores for regressors in a dataset.partial_regression_plot: also known as 'added variable plot'.  Examine the effect of adding a regressor to a model.