フィルターのクリア

How to obtain confidence level and coefficient of determination?

12 ビュー (過去 30 日間)
Fabian Moreno
Fabian Moreno 2021 年 7 月 7 日
コメント済み: Fabian Moreno 2021 年 7 月 8 日
Hello, I am comparing two regression models (linear fit and theil-sen). In the linear fit I can get confidence level (CI=95%) of the slop and intersection, and coefficient of determination (R2). But I don't know how to get the CI and R2 for theil sen model. I appreciate any help. Here is my code.
%Option MRL
mdl = fitlm(x, y,'linear','Intercept',true,'RobustOpts','on'); % Fit Data
B = mdl.Coefficients.Estimate;
B=[B(2) B(1)];% Coefficients
y_robus = polyval(B,x(:,1));
R1=sqrt(mdl.Rsquared.Adjusted);
% Confidence intervals
CI = coefCI(mdl,0.05);
%Option Theil-Sen
[r1,pval1]=corr(x,y,'Type','Kendall');
[s1, b1] = tsreg(x,y);
S1 =[s1 b1];
y_Theil1=polyval(S1,x);
% Confidence intervals
CI =

採用された回答

the cyclist
the cyclist 2021 年 7 月 8 日
編集済み: the cyclist 2021 年 7 月 8 日
tsreg is not a MathWorks function. Are you using this code from the File Exchange?
Obviously, the author of that code has not provide any additional functionality beyond calculating the slope and intercept. You could post a comment and ask your question there.
The wikipedia page for the Theil-Sen method briefly discusses how to calculate the confidence interval, using resampling. Perhaps that will be helpful.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFit Postprocessing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by