[SciPy-User] ODR multiresponse multidimensional

Thomas Howells t.howells42 at gmail.com
Tue Sep 29 10:16:09 EDT 2015


On Tue, Sep 29, 2015 at 2:00 PM Robert Kern <robert.kern at gmail.com> wrote:

> On Tue, Sep 29, 2015 at 1:43 PM, Thomas Howells <t.howells42 at gmail.com>
> wrote:
> >
> > Dear Pythonistas,
> >
> > I'm new to the mailing list, my question here is related to scipy's
> Orthogonal Distance Regression (ODR) wrapper module. My apologies if you've
> received this before, I had some trouble with the mail delivery system.
> >
> > From perusal of the documentation for the wrapper and the underlying
> Fortran routines, it seems the Fortran code can handle a dataset that is
> both multiresponse and multidimensional. I have such a dataset that I would
> like to try and use the algorithm for; however as far as I can tell the ODR
> wrapper doesn't have the machinery to support this usage.
>
> What do you mean by "both multiresponse and multidimensional"? That the
> model is a function `f(x; beta) -> y` such that x and y are each vectors?
> Yes, it certainly supports this, and I think the docstrings are pretty
> clear about it. What did you read that makes you think otherwise?
>
> http://docs.scipy.org/doc/scipy/reference/generated/scipy.odr.Model.html
>
> --
> Robert Kern
>
>
I'll elucidate a little more: I have data with two control variables, theta
and E, for angle and energy. Each energy is measured at each angle; this
makes the data multidimensional (after checking the ODR reference guide,
http://docs.scipy.org/doc/external/odrpack_guide.pdf, this is also referred
to as multivariate; sorry if this caused confusion).

For each combination of theta and E, I get two linked readings (or
responses), alpha and beta, that I want to fit simultaneously. This makes
it multi-response, as well as multivariate, a situation described on page 6
of the ODR reference guide.

Ideally I need to find the best fit to all angles & both responses
simultaneously to reduce correlation between parameters. The odr.Model
object has instructions to handle multidimensional input x, and
corresponding multidimensional response y, but not what to do if you have
both a multidimensional input and multiresponse.

My input array x is [m,n] where m is the dimensionality of the input and n
is the number of observations. (In my case [3,56])
My response array y is then in fact [2,3,56] as I have two responses for
each x. I arranged it this way after inspecting the test_odr.py function,
in which a single-dimensional array x is matched with a two-dimensional, or
multi-response, return array y in test_multi.

Unfortunately attempting to generalise in this way results in an error when
the odr module analyses my array shapes. I could not find any way to tell
the code that my y array is multiresponse, even having inspected the source
code. I hope this explanation makes things clearer!

Thanks, Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20150929/019eaa48/attachment.html>


More information about the SciPy-User mailing list