Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: multiple variable exponential regression
Replies: 1   Last Post: Nov 6, 2013 12:30 PM

 Messages: [ Previous | Next ]
 Tom Lane Posts: 858 Registered: 12/7/04
Re: multiple variable exponential regression
Posted: Nov 6, 2013 12:30 PM

> I was using other nonlinear regression methods but was getting an
> imaginary solution (a+ib) form

...
> modelfun = @(b, x)((100 - 15*(x(2, :).^b(1)))) - (40*((x(3, :).^b(2)))) -
> (15*((x(4, :).^b(3)))) x = TestData;
> y = x(1, :);
>
> [beta, R, J, CovB, MSE] = nlinfit(x, y, modelfun, beta0, opts);

One thing I see here is that you have not removed the y column from x, so
x(1,:) will refer to the same thing as y. In general, if you have any
negative x values this could yield imaginary results as the nlinfit function
manipulates the b values. You could use abs() in your modelfun to avoid
that, but I don't know if that makes sense in your application.

-- Tom

Date Subject Author
11/4/13 TARUN REDDY
11/6/13 Tom Lane