How to evalute the accuracy of the regressed model?

조회 수: 1 (최근 30일)
Jiazeng Shan
Jiazeng Shan 2011년 9월 28일
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?
Thank you.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by