필터 지우기
필터 지우기

How to calculate error in trend?

조회 수: 4 (최근 30일)
SONI SONI
SONI SONI 2015년 5월 12일
댓글: Star Strider 2015년 5월 13일
I have estimated slope from least square method. Now I need to calculate error of this slope at 95% confidence interval. kindly suggest me a MATLAB code in this regard. I'll be thankful remaining you.
  댓글 수: 1
Brendan Hamm
Brendan Hamm 2015년 5월 12일
편집: Brendan Hamm 2015년 5월 12일
Are you using the fitlm function in the Statistics and Machine Learning Toolbox or polyfit/ polyval? Please provide an example of what you have done, so that it is easier to help you.

댓글을 달려면 로그인하십시오.

답변 (1개)

Star Strider
Star Strider 2015년 5월 12일
If you used polyfit, I strongly recommend polyparci!
If you used another method, you need to specify the function or other code you used. It is not possible to answer your Question otherwise.
  댓글 수: 4
SONI SONI
SONI SONI 2015년 5월 13일
Yes you are right 'regls_E' returns slope value of time series and 'stats_E' returns p-value of this slope value. I need to calculate error value of this slope value. How would I coding in order to get error value ?
Star Strider
Star Strider 2015년 5월 13일
Unfortunately, regress is not going to give you the covariance matrix, and you need it to compute the standard errors. I would use fitlm instead, since it will give you the output you want.
If you must use regress, you can calculate the standard errors as:
x = randi(10, 10, 1); % Create Data
y = randi(100, 10, 1); % Create Data
X = [ones(10,1) x]; % Design Matrix
[b,bint,r,rint,stats] = regress(y,X); % Estimate Parameters
rvar = r'*r/(size(X,1)-length(b)); % Residual Variance
covb = rvar./(X'*X); % Covariance Matrix
SE = sqrt(diag(covb)); % Standard Errors
That would be the same for the ‘covb’ field of the ‘stats’ structure returned by robustfit.

댓글을 달려면 로그인하십시오.

카테고리

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