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 = randn(12,200);
x = [0:size(data,2)-1];
nPatients = 12;
aveData = mean(data)';
smoothData = smooth(aveData, 0.4, 'rlowess');
residuals = aveData-smoothData;
resError = sum(residuals.^2);
This would yield something similar as if I was using:
[p,S] = polyfit(x,smoothData,5);
[y_fit,delta] = polyval(p,x,S);
C95min = y_fit-2*delta;
c95max = y_fit+2*delta;
So, how do I calculate this delta of smoothData?
Thank you in advance!