I have 2 variables with some NaNs. I use bootstrapping to get the slope and intersect from a linear regression:
good = isnan(var1) + isnan(var2);
p_bootstrp = bootstrp(1000, 'polyfit',var1(good == 0),var2(good == 0),1);
med_slope = median(p_bootstrp(:,1));
med_intersect = median(p_bootstrp(:,2));
But, I cannot figure out how to get the confidence intervals for this using bootci. I thought that I could use bootci the same way as when getting a confidence interval for the corelation coefficient but that doesn't work.
ci_slope = bootci(5000, @polyfit, var1(good == 0), var2(good == 0));
How do I calculate the confindence interval for linear regression using bootstrapping? Is there a Matlab function to do it?