Re: Multivariate linear (bilinear) fit (Charles R Harris)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Re: Multivariate linear (bilinear) fit (Charles R Harris)

Justus Schwabedal
Indeed, in statistics it's a linear model.  Try r2py.  R's really good in linear models and will give you additional information on significance tests.

Best, Jus

On Apr 20, 2017 02:14, <[hidden email]> wrote:
Send SciPy-User mailing list submissions to
        [hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
or, via email, send a message with subject or body 'help' to
        [hidden email]

You can reach the person managing the list at
        [hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of SciPy-User digest..."

Today's Topics:

   1. Re: Multivariate linear (bilinear) fit (Charles R Harris)


Message: 1
Date: Wed, 19 Apr 2017 18:12:49 -0600
From: Charles R Harris <[hidden email]>
To: SciPy Users List <[hidden email]>
Subject: Re: [SciPy-User] Multivariate linear (bilinear) fit
        <CAB6mnxKo15OS45qnj6TvXxoea2fQcre3og3vxCjDFNDEH=[hidden email]>
Content-Type: text/plain; charset="utf-8"

On Wed, Apr 19, 2017 at 4:38 PM, Joe Kington <[hidden email]> wrote:

> They're relatively recent additions, but numpy.polynomial.polyvander2d and
> numpy.polynomial.polyval2d should also do what you want, unless I'm
> misunderstanding the problem.
> numpy.polynomial.polynomial.polyvander2d.html#numpy.polynomial.polynomial.
> polyvander2d
> numpy.polynomial.polynomial.polyval2d.html#numpy.polynomial.polynomial.
> polyval2d
> You can also do things like (you could generalize this to N-dimensions, as
> well):
> def polyfit2d(x, y, z, order=3):
>     ncols = (order + 1)**2
>     G = np.zeros((x.size, ncols))
>     ij = itertools.product(range(order+1), range(order+1))
>     for k, (i,j) in enumerate(ij):
>         G[:,k] = x**i * y**j
>     m, _, _, _ = np.linalg.lstsq(G, z)
>     return m
> def polyval2d(x, y, m):
>     order = int(np.sqrt(len(m))) - 1
>     ij = itertools.product(range(order+1), range(order+1))
>     z = np.zeros_like(x)
>     for a, (i,j) in zip(m, ij):
>         z += a * x**i * y**j
>     return z
I think the "bilinear" is a mistake, as bilinear usually means terms of
degree two. AFAICT, this question is just about multivariate linear fits



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>


Subject: Digest Footer

SciPy-User mailing list
[hidden email]


End of SciPy-User Digest, Vol 164, Issue 16

SciPy-User mailing list
[hidden email]