How to evalute the accuracy of the regressed model?

1 visualizzazione (ultimi 30 giorni)
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.

Risposte (0)

Categorie

Scopri di più su Descriptive Statistics in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by