why regstats give an error when I try to build a quadratic model

5 次查看(过去 30 天)
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

采纳的回答

Tom Lane
Tom Lane 2013-1-11
编辑:Tom Lane 2013-1-11
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 个)

类别

Help CenterFile Exchange 中查找有关 Model Building and Assessment 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by