How to calculate confidence intervals of the output curve from smooth function?
3 次查看(过去 30 天)
显示 更早的评论
I have some data points for which I used the smooth function to obtain a smoother curve. How can I calculate the confidence intervals of this output?
Here is some of my code:
% Data from all patients
data = randn(12,200);
x = [0:size(data,2)-1];
% Number of patients
nPatients = 12;
% Get average data of all patients
aveData = mean(data)'; % Outputs a vector 200x1
% Get smooth
smoothData = smooth(aveData, 0.4, 'rlowess');
% Residuals
residuals = aveData-smoothData;
% Residual error
resError = sum(residuals.^2);
% Get confidence interval of smoothData (?)
This would yield something similar as if I was using:
% Get Polynomial
[p,S] = polyfit(x,smoothData,5);
[y_fit,delta] = polyval(p,x,S);
% Confidence interval
C95min = y_fit-2*delta;
c95max = y_fit+2*delta;
So, how do I calculate this delta of smoothData?
Thank you in advance!
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Curve Fitting Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!