The Math Forum

Search All of the Math Forum:

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

Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Tom Lane

Posts: 858
Registered: 12/7/04
Re: multiple variable exponential regression
Posted: Nov 6, 2013 12:30 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

> 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

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.