[SciPy-User] ODR fitting several equations to the same parameters

Bruce Southey bsouthey@gmail....
Wed Nov 11 11:04:14 CST 2009


On 11/11/2009 10:26 AM, ms wrote:
> Hi,
>
> Probably it is a noobish question, but statistics is still not my cup of
> tea as I'd like it to be. :)
>
> Let's start with a simple example. Imagine I have several linear data
> sets y=ax+b which have different b (all of them are known) but that
> should fit to the same (unknown) a. To have my best estimate of a, I
> would want to fit them all together. In this case it is trivial, you
> just subtract the known b from the data set and fit them all at the same
> time.
>    
Although b is known without error you still have potentially effects due 
to each data set.

What I would do is fit:
y= mu + dataset + a*x + dataset*a*x

Where mu is some overall mean,
dataset is the effect of the ith dataset - allows different intercepts 
for each data set
dataset*a is the interaction between a and the dataset - allows 
different slopes for each dataset.

Obviously you first test that interaction is zero. In theory, the 
difference between the solutions of dataset should equate to the 
differences between the known b's.


> In my case it is a bit different, in the sense that I have to do
> conceptually the same thing but for a highly non-linear equation where
> the equivalent of "b" above is not so simple to separate. I wonder
> therefore if there is a way to do a simultaneous fit of different
> equations differing only in the known parameters and having a single
> output, possibly with the help of ODR. Is this possible? And/or what
> should be the best thing to do, in general, for this kind of problems?
>
> Many thanks,
> M.
>    

Now you just expand your linear model to nonlinear one. The formulation 
depends on your equation. But really you just replace f(a*x) with 
f(a*x+dataset*a*x).

So I first try with a linear model before a nonlinear. Also I would see 
if I could linearize the non-linear function.

Bruce



More information about the SciPy-User mailing list