Examples

This page provides a series of examples, tutorials and recipes to help you get started with statsmodels. Each of the examples shown here is made available as an IPython Notebook and as a plain python script on the statsmodels github repository.

We also encourage users to submit their own examples, tutorials or cool statsmodels trick to the Examples wiki page

Linear Regression Models

Ordinary Least Squares

../_images/ols.png

Generalized Least Squares

../_images/gls.png

Quantile Regression

../_images/quantile_regression.png

Recursive Least Squares

../_images/recursive_ls.png

Rolling Least Squares

../_images/rolling_ls.png

Regression Diagnostics

../_images/regression_diagnostics.png

Weighted Least Squares

../_images/wls.png

Linear Mixed-Effects

../_images/mixed_lm.png

Plotting

Regression Plots

../_images/regression_plots.png

Categorical Interactions

../_images/categorical_interaction_plot.png

Box Plots

../_images/plots_boxplots.png

Discrete Choice Models

Getting Started

../_images/discrete_overview.png

Fair’s Affairs Data

../_images/fairs_data.png

Nonparametric Statistics

Univariate Kernel Density Estimator

../_images/kde_overview.png

Generalized Linear Models

Generalized Linear Models Overview

../_images/glm_overview.png

Using Formulas with GLMs

../_images/glm_formulas.png

Weighting Observations with GLMs

../_images/glm_weights.png

Influence Measures for GLMs

../_images/influence_glm_logit.png

Robust Regression

M-estimators for Robust Regression

../_images/rlm_overview.png

Comparing OLS and RLM

../_images/rlm.png

Generalized Estimating Equations

GEE Nested Covariance Structure

../_images/gee-cov-struct.png

GEE Score Tests

../_images/gee-score-tests.png

Statistics

ANOVA

../_images/anova.png

Time Series Analysis

Autoregressions

../_images/autoregressions.png

ARMA: Sunspots Data

../_images/tsa_arma0.png

ARMA: Artificial Data

../_images/tsa_arma1.png

Time Series Filters

../_images/tsa_filters.png

Markov switching dynamic regression

../_images/markov_regression.png

Markov switching autoregression

../_images/markov_autoregression.png

Exponential Smoothing

../_images/exponential_smoothing.png

Seasonal Decomposition

../_images/stl_decomposition.png

State space models

SARIMAX: Introduction

../_images/statespace_sarimax_stata.png

SARIMAX: Model selection, missing data

../_images/statespace_sarimax_internet.png

VARMAX: introduction

../_images/statespace_varmax.png

Dynamic Factor Models: Application

../_images/statespace_dfm_coincident.png

Unobserved Components: Application

../_images/statespace_structural_harvey_jaeger.png

Trends and cycles in unemployment

../_images/statespace_cycles.png

State space modeling: Local Linear Trends

../_images/statespace_local_linear_trend.png

Statespace ARMA: Sunspots Data

../_images/statespace_arma0.png

Seasonality in Time Series Data

../_images/statespace_seasonal.png

Fixed / constrained parameters in state space models

../_images/statespace_fixed_params.png

State space models - Technical notes

State space models: concentrating out the scale

../_images/statespace_concentrated_scale.png

User Notes

Contrasts

../_images/contrasts.png

Formulas

../_images/formulas_intro.png

Prediction

../_images/prediction.png

Forecasting in statsmodels

../_images/statespace_forecasting.png

Generic Maximum Likelihood

../_images/generic_mle.png

Dates in Time-Series Models

../_images/tsa_dates.png

Least squares fitting of models to data

../_images/chi2_fitting.png

Distributed Estimations

../_images/distributed_estimation.png

Principal Component Analysis

../_images/pca_fertility_factors.png