MATLAB: Plotting curved confidence intervals for linear regression

boundsintervallinearplotregressionstatistics

I am using coefCI function to estimate the confidence intervals of a linear model. I can plot this and get linear confidence bands for the regression line, but, I've seen plots of linear regression where the bands are curved. How can I get those? Thanks.

Best Answer

I did not see your post before.
Use the appropriate version of the predict (link) function for a compact linear model, predict (link) for a generalised linear model, or others, depending on what you are doing.
Those will give the confidence intervals. If you want to plot smooth curves, use:
xv = linspace(min(x), max(x), 1000);
for the independent variable ‘Xnew’ to use with predict.