Main Content

rcoplot

Residual case order plot

Syntax

rcoplot(r,rint)
rcoplot(ax,r,rint)

Description

rcoplot(r,rint) displays an error bar plot of the confidence intervals on the residuals from a regression. The residuals appear in the plot in case order.

rcoplot(ax,r,rint) plots into the axes specified by ax instead of the current axes (gca). (since R2024a)

Examples

The following plots residuals and prediction intervals from a regression of a linearly additive model to the data in moore.mat:

load moore
X = [ones(size(moore,1),1) moore(:,1:5)];
y = moore(:,6);
alpha = 0.05;
[betahat,Ibeta,res,Ires,stats] = regress(y,X,alpha);
rcoplot(res,Ires)

Plot of residuals versus case number. The prediction interval is shown for each data point.

The interval around the first residual, shown in red, does not contain zero. This indicates that the residual is larger than expected in 95% of new observations, and suggests the data point is an outlier.

Version History

Introduced before R2006a

expand all

See Also