How can i include error calculation in the linear regression in a for loop?

조회 수: 2 (최근 30일)
Joseph
Joseph 2020년 2월 12일
답변: the cyclist 2020년 2월 13일
Hi everyone,
I have two arrays X(150,3) and Y(150,3). does any one know how to calculate regression for each row including uncertainity in the slop?
I tried
for i=1:length(X)
[p(i,:),bint(i,:)] = polyfit(X,Y,1)
b_err(i,:) = sqrt(diag((bint(i,:).R)\inv(bint(i,:).R'))./bint(i,:).normr.^2./bint(i,:).df);
end;
but b_err give unrealstic values.
Thank you all,

답변 (1개)

the cyclist
the cyclist 2020년 2월 13일
The regress function outputs confidence intervals for the slope and intercept.

카테고리

Help CenterFile Exchange에서 Spline Postprocessing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by