linear/nonlinear regression and statistical parameters

1 view (last 30 days)
Hello,
I am trying to use linear and nonlinear regression to predict a response. I am wondering how I can get the most possible statistical results from regress or nlinfit (like durbin watson, probabilities, R2, adjusted R2, etc.). (as far as I understood regstat is not a good option since it restricted to a few models.) Here is the piece of code that I am using as a sample and the results. I also couldn't interpret the results of stats that I am getting now. Any help is appreciated. (I post the linear regression code as a separate post to avoid confusing.)
y=(c.^4+2*c.*p+3*p.^3-c+2*d.^0.5)'; % a sample response
X = [c;p;d]';
modelfun = @(b,x) b(1)*x(:,1).^4 + b(2)*x(:,1).*x(:,2)+ ... b(3)*x(:,2).^3 + b(4)*x(:,1)+b(5)+b(6)*x(:,3).^b(7);
beta0 = [1 -2 0 -1 0 1 1];
opts = statset('nlinfit');
opts.RobustWgtFun = 'bisquare';
[beta,stats] = nlinfit(X,y,modelfun,beta0,opts)
Results: beta =
1.0057 -1.4588 2.8133 -15.5212 -18.0241 3.1540 2.7378
stats = (I dont know what the followings are)
1.0e-012 *
0.0071
0.1172
0.1279
0.3979
0.7958

Answers (1)

Star Strider
Star Strider on 20 Apr 2015
I do not know what version of MATLAB (and the Statistics Toolbox) you are using, but in R2015a, the second output (here ‘stats’) are the residuals (differences between the data and model fit to each element in the dependent variable). Your model is nonlinear in the parameters, so nlinfit is appropriate. Consider using fitnlm to get more statistics. (Consider nlinfit and nlparci if you want to get confidence intervals on the parameters.)
  4 Comments
Reza S
Reza S on 29 Apr 2015
I have updated my MATLAB to 2014Ra. Now I am good. Thanks
Star Strider
Star Strider on 29 Apr 2015
My pleasure.
You should also be able to update to R2014b as well with the same license. I suggest that you not uninstall R2014a after you install R2104b because the ‘old’ graphics (and all the File Exchange contributions that use them) will still work with it.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!