How to evalute the accuracy of the regressed model?
1 次查看(过去 30 天)
显示 更早的评论
The simple model configuration is supposed as y = k/x. I want to use this to fit the scatter data. Using the command "regress" we could obtain the coefficient k but the R2 in the states is negative always because of the lack of constant coefficient. A simple example shown below:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x = 5:1:35;
x = x(:);
y = 90./x+10.*rand(size(x));
figure
plot(x,y,'bo');
axis([0 40 0 25]);
[b,bint,r,rint,stats] = regress(y,(1./x));
y1 = b./x;
corrcoef(y,y1)
y2 = 90./x;
corrcoef(y,y2)
y3 = 200./x;
corrcoef(y,y3)
corrcoef(y1,y2)
corrcoef(y1,y3)
corrcoef(y2,y3)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
I thought I could use "corrcoef" to evaluate the correlation between the data and the prediction. But the codes above show that the results are independent of the coefficient values. If the model is in the inverse function, the results are the same. How can I assess the accuracy of the specific regressed model like "y1 = b./x" in the example?
A similar question is related to this URL: http://mathworks.com/matlabcentral/answers/16215-how-to-regress-with-the-simple-model-like-y-kx-or-y-k-x#answer_21948
Thank you.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Descriptive Statistics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!