statsmodels/statsmodels — pull request #683 by EnricoGiampieri (2013-02-23 16:40:31+00:00)
Title: Multilinearmodel

I wrote this function as an helper while analyzing microarray data.

It will perform multiple linear regression from one fomula model to several columns in a dataframe and return a summary dataframe with the results of each test

example:

>>> import statsmodels.api as sm
>>> data = sm.datasets.longley.load_pandas()
>>> df = data.exog
>>> df['TOTEMP'] = data.endog
>>> multiOLS('GNP + 1', df)

params pvals statistics std
GNP Intercept _f_test GNP Intercept _f_test adj_r2 r2 GNP Intercept
endogenous vars
YEAR 0.000048 1936.017273 1470.514523 1.395507e-15 1.178992e-43 1.395507e-15 0.989896 0.990569 0.000001 0.496610
GNPDEFL 0.000108 59.941915 821.775887 7.809111e-14 7.889563e-16 7.809111e-14 0.982053 0.983249 0.000004 1.500214
POP 0.069361 90532.884175 775.155906 1.167567e-13 8.212909e-21 1.167567e-13 0.980992 0.982260 0.002491 995.172919
TOTEMP 0.034752 51843.589782 415.102621 8.363479e-12 9.972072e-20 8.363479e-12 0.965043 0.967374 0.001706 681.371636
UNEMP 0.005681 990.807028 8.051803 1.316878e-02 2.357542e-01 1.316878e-02 0.319784 0.365131 0.002002 799.750787
ARMED 0.003126 1394.837592 3.484828 8.301662e-02 5.582322e-02 8.301662e-02 0.142113 0.199306 0.001674 668.871101