From: Nuc User on
I'm trying to do a non-linear or perhaps polynomial analysis of covariance (ancova) and can't figure out how to do it with matlab/if it's even possible. Can anyone help me with this issue?

Specifically, I'm trying to test if the difference between two non-linear curves is statistically significant. I need to be able to do this for both cubic and rational (constant numerator and quadratic denominator) polynomials. I have tried approximating a linear fit and using the aoctool but this results in a piecewise function for the rational polynomial which does not represent the data accurately.

Thanks for any help!
From: Tom Lane on
> Specifically, I'm trying to test if the difference between two non-linear
> curves is statistically significant. I need to be able to do this for both
> cubic and rational (constant numerator and quadratic denominator)
> polynomials. I have tried approximating a linear fit and using the aoctool
> but this results in a piecewise function for the rational polynomial which
> does not represent the data accurately.

I can imagine a variety of ways to interpret this. For example:

1. Fit f(x,b)+c*group where group is 1 for one group and 0 for the
other. Then c represents a constant difference between the two groups and
you can test to see if it is zero. You should be able to use nlinfit and
nlparci to do that.

2. Fit f(x,b) to the combined groups. Then separately fit f(x,b1) to the
first group and f(x,b2) to the second group. You can use nlinfit or whatever
to do those fits. Then compare the sum of squared residuals from the
combined fit to the sum of the two sums of squared residuals from the
separate fits. You can use an F test to do that. You'd have to construct the
F statistic yourself, then use the fcdf function to see if it is
significant.

-- Tom


From: Nuc User on
"Tom Lane" <tlane(a)mathworks.com> wrote in message <hjv2jl$kq6$1(a)fred.mathworks.com>...
> > Specifically, I'm trying to test if the difference between two non-linear
> > curves is statistically significant. I need to be able to do this for both
> > cubic and rational (constant numerator and quadratic denominator)
> > polynomials. I have tried approximating a linear fit and using the aoctool
> > but this results in a piecewise function for the rational polynomial which
> > does not represent the data accurately.
>
> I can imagine a variety of ways to interpret this. For example:
>
> 1. Fit f(x,b)+c*group where group is 1 for one group and 0 for the
> other. Then c represents a constant difference between the two groups and
> you can test to see if it is zero. You should be able to use nlinfit and
> nlparci to do that.
>
> 2. Fit f(x,b) to the combined groups. Then separately fit f(x,b1) to the
> first group and f(x,b2) to the second group. You can use nlinfit or whatever
> to do those fits. Then compare the sum of squared residuals from the
> combined fit to the sum of the two sums of squared residuals from the
> separate fits. You can use an F test to do that. You'd have to construct the
> F statistic yourself, then use the fcdf function to see if it is
> significant.
>
> -- Tom
>


Thanks for the reply Tom. I'm actually a complete beginner to both matlab and this type of statistical analysis. I am having a pretty hard time understanding how to use those two functions actually. Is there nothing like the aoctool where I can just plug the two distributions in and get a p-value out? Is there perhaps another program with which I can do this? Thanks for your input.
From: Nuc User on
Does anyone else have any suggestions please?
From: Tom Lane on
> Thanks for the reply Tom. I'm actually a complete beginner to both matlab
> and this type of statistical analysis. I am having a pretty hard time
> understanding how to use those two functions actually. Is there nothing
> like the aoctool where I can just plug the two distributions in and get a
> p-value out? Is there perhaps another program with which I can do this?
> Thanks for your input.

I didn't notice this question from last week until I just saw your more
recent post.

There is nothing like aoctool for nonlinear or higher-order fits. But there
are other things such as nlinfit and nlintool.

My question for you is: when you say you want to test whether two fits are
different between groups, what difference do you want to test for? Examples
include:

1. y = f(x,b) in one group and y = f(x.b)+c in the other, for a constant
difference

2. y = f(x,b1) in one group and y = f(x,b2) in the other, for potentially
completely different parameters but the same model

3. y = f(x,b1) in one group and y = g(x,b2) in the other, for completely
different model forms.

Whatever type of difference you want to model, it's likely MATLAB can help
with it but it's also likely that it will involve something beyond
interation with a GUI. But I can try to point you in the right direction.

-- Tom