How do I find the uncertainty in b and R^2

4 ビュー (過去 30 日間)
Emilee Burris
Emilee Burris 2019 年 3 月 26 日
I have a to vaiables x and y and I preformed a linear fit on them and was given the uncertainty of yi to be 1.5 and already found the minimum chi-squared for the fit, how do I find the uncertainty in b and R^2 which I have already found?
This is what I did so far but I don't think it is right
This is what I did so far
x=[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24];
y=[5.3, 14.4, 20.7, 30.1, 35.0, 41.3, 52.7, 55.7, 63.0, 72.1, 80.5, 87.9];
format long
cb=y/x;
yCalc = b1*x;
scatter(x,y)
hold on
plot(x,yCalc)
xlabel('xi')
ylabel('yi')
%Chi Squared value from derived equation to find smallest value
X22=1/1.5^2*(14.4-b*(4))^2;
%smallest value = 0.00002 from x2 and y2
%b value = 3.6017
%uncertainty in b
eb = sqrt(yi.^2*diff(b,yi)^2 + xi.^2*diff(b,xi)^2);
% R^2 value (R^2= 1- SSr/SSt)
Rsq=1 - sum((y-yCalc).^2)/sum((y - mean(y)).^2);
% R^2 value = 0.9965
%uncertainty in R^2
eRsq = sqrt(y.^2*diff(b,y)^2 + yCalc.^2*diff(b,yCalc)^2);

回答 (0 件)

カテゴリ

Help Center および File ExchangeElementary Math についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by