{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Quantile regression" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "This example page shows how to use ``statsmodels``' ``QuantReg`` class to replicate parts of the analysis published in \n", "\n", "* Koenker, Roger and Kevin F. Hallock. \"Quantile Regression\". Journal of Economic Perspectives, Volume 15, Number 4, Fall 2001, Pages 143–156\n", "\n", "We are interested in the relationship between income and expenditures on food for a sample of working class Belgian households in 1857 (the Engel data). \n", "\n", "## Setup\n", "\n", "We first need to load some modules and to retrieve the data. Conveniently, the Engel dataset is shipped with ``statsmodels``." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | income | \n", "foodexp | \n", "
---|---|---|
0 | \n", "420.157651 | \n", "255.839425 | \n", "
1 | \n", "541.411707 | \n", "310.958667 | \n", "
2 | \n", "901.157457 | \n", "485.680014 | \n", "
3 | \n", "639.080229 | \n", "402.997356 | \n", "
4 | \n", "750.875606 | \n", "495.560775 | \n", "