[SciPy-user] matlab's regress

Wes McKinney wesmckinn@gmail....
Mon Apr 7 23:12:09 CDT 2008


On Apr 7, 2008, at 11:54 PM, Angus McMorland wrote:
>
>
> (1) Have I missed some multilinear regression routine directly
> implemented in scipy? If yes, how can we improve the documentation so
> the next person can find it more easily.

scipy.stats.models in the current SVN branch has a bunch of modelling  
tools for least-squares estimation, robust estimation, and some other  
statistical methods. It's more object oriented than the matlab  
equivalent, but you can do simple multivariate regressions without  
too much work:

 >>> import scipy.stats.models.regression as R
 >>> from numpy.random import standard_normal as W
 >>> X = W((40,10))
 >>> Y = W((40,))
 >>> model = R.OLSModel(design=X)
 >>> result = model.fit(Y)
 >>> result.beta
array([-0.2296546 , -0.15835343, -0.07127199,  0.02934717,  0.15778939,
         0.14087653,  0.09279021, -0.03412604, -0.28726236,   
0.03078167])




More information about the SciPy-user mailing list