Re: linregress: Replicate R's lm()

Matthew Brett <[email protected]>
Newsgroups gmane.comp.python.scientific.devel
Message-ID <CAH6Pt5pDoC33DtYdx5zfKJuxW4WPNVb3Trwg_jpMfBp42Lz1Eg@mail.gmail.com>
Hi,

On Tue, Dec 20, 2022 at 1:32 PM <[email protected]> wrote:
>
> I try to replicate R's lm() (linear regression, possibly "Ordinary Least
> Squares") wiht SciPy.
>
> Based on the "mtcars" dataset the formula is 'qsec ~ mpg * wt + gear'.
> This are 3 different types of arguments.
>
> But SciPy's linregress() only offer two arguments [1].
>
> This is not possible of course
> linegress("qsec", "mpeg, wt", "gear", data=mtcars)

Right - Scipy's linregress only does simple (one-regressor) regression
on array input.

Statsmodels or scikit-learn are your best options for packaged
multiple regression.

You can do the estimation yourself, if you really need to - have a look at:

https://textbook.nipraxis.org/glm_intro.html

Cheers,

Matthew
_______________________________________________
SciPy-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/scipy-dev.python.org/
Member address: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.