[SciPy-user] Multivariate regression?

Matthew Brett matthew.brett@gmail....
Sat Oct 6 12:34:23 CDT 2007


> > I study econometrics and statistics, and i wanted to try out my
> > favourite programming as a scientific tool. Unfortunately, I could not
> > find a function for ordinary least squares estimation. The
> > stats.linregress() is insufficient for my needs, and stats.glm() seems
> > to be for something else (not sure really).

I think you may want the OLS model in scipy.stats.models:

import numpy as N
import scipy.stats.models as SSM

covariates = N.random.normal(size=(100,3))
intercept = N.ones((100,1))
design = N.c_[covariates, intercept]
data = N.random.normal(size=(100,1))

model = SSM.regression.ols_model(design)
results = model.fit(data)


The models package is still being developed, but it already does the
basic stuff,



More information about the SciPy-user mailing list