multiple linear regression in Python

Fernando Perez fperez528 at yahoo.com
Fri May 23 01:12:08 EDT 2003


beliavsky at aol.com wrote:

> Is there public domain Python code to estimate a multiple linear
> regression model and diagnostics such as the standard errors of the
> coefficients?

http://scipy.org  -- use the CVS code, the tarballs are incomplete.

It comes with a reasonably complete set of optimization stuff (including, of
course, plain old least squares).  If you need something fancier, you could do
worse than starting off of scipy. Info follows:

In [7]: scipy.optimize?
Type:           instance
Base Class:     scipy_base.ppimport._ModuleLoader
String Form:    <module 'scipy.optimize' from
'/usr/lib/python2.2/site-packages/scipy/optimize/__init__.py' [import
postponed]>
Namespace:      Interactive
File:           /usr/lib/python2.2/site-packages/scipy/optimize/__init__.py
Docstring:

    Optimization Tools
    ==================

     A collection of general-purpose optimization routines.

       fmin        --  Nelder-Mead Simplex algorithm
                         (uses only function calls)
       fmin_powell --  Powell's (modified) level set method (uses only
                         function calls)
       fmin_bfgs   --  Quasi-Newton method (can use function and gradient)
       fmin_ncg    --  Line-search Newton Conjugate Gradient (can use
                         function, gradient and hessian).
       leastsq     --  Minimize the sum of squares of M equations in
                         N unknowns given a starting estimate.

      Global Optimizers

       anneal      --  Simulated Annealing
       brute       --  Brute Force searching Optimizer

      Scalar function minimizers

       fminbound   --  Bounded minimization of a scalar function.
       brent       --  1-D function minimization using Brent method.
       golden      --  1-D function minimization using Golden Section method
       bracket     --  Bracket a minimum (given two starting points)

     Also a collection of general_purpose root-finding routines.

       fsolve      --  Non-linear multi-variable equation solver.

      Scalar function solvers

       brentq      --  quadratic interpolation Brent method
       brenth      --  Brent method (modified by Harris with
                         hyperbolic extrapolation)
       ridder      --  Ridder's method
       bisect      --  Bisection method
       newton      --  Secant method or Newton's method

       fixed_point -- Single-variable fixed-point solver.


Cheers,

f.




More information about the Python-list mailing list