why regstats give an error when I try to build a quadratic model
4 views (last 30 days)
Show older comments
Hello
I am trying a very simple model for a parabola with noise
>> Y=sin([0:0.01:pi])+rand(1,315)/1; >> X=[1:315]+rand(1,315); >> % X is my data and Y is considered to be the response >> regstats(Y,X,'quadratic')
returns
Warning: The exact method is impossible. Will be forced to use approximate method. > In stats/private/pvaluedw at 46 In dwtest at 74 In regstats at 352 In regstats at 155
If I inverse
>> s=regstats(X,Y,'quadratic')
>> s.rsquare
ans =
1.3575e-04
it works but then the rsquare is close to zero while it is a simple parabola and the model should be efficient. I expect a rsquare close to 1 ?
Any help for the two different issues is welcome
Vincent
Thanks in advance
Vincent
0 Comments
Accepted Answer
Tom Lane
on 11 Jan 2013
Edited: Tom Lane
on 11 Jan 2013
The warning is just an indication that the significance of the Durbin-Watson statistic is outside the range of a table of exact values, so the quantity is being approximated. That should not be a problem for you.
When I try your example I get rsquare around 0.5 each time. If you plot X vs. Y you will see there is substantial scatter, so I would not expect a value near 1. I can't reproduce your result showing a value near 0.
0 Comments
More Answers (0)
See Also
Categories
Find more on Model Building and Assessment in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!