Date: Nov 4, 2013 2:32 PM
Author: TARUN REDDY
Subject: multiple variable exponential regression

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

I need to solve y = a0 + (a1*(x1^b1)) + (a2*(x2^b2)) + (a3*(x3^b3))

a0, a1, a2, a3 are known

I have data set for y, x1, x2, x3

I need to calculate b1, b2, b3

I was using following code till (this yields imaginary solutions)

opts = statset ('nlinfit');
opts.RobustWgtFun = 'bisquare';
beta0 = [0, 0, 0, 0];
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);
SSresidual=sum(R.^2);
SStotal =sum((y-mean(y)).^2);
rsquare =1-(SSresidual/SStotal);