I want to draw a 95% confidence ellipse around my bivariate data. Using ggplot2::stat_ellipse()
with type="t"
(for a bivariate-t distribution) the confidence region is tighter than for type="norm"
. This is counter-intuitive, and there is very little description of the methods used in both ggplot2::stat_ellipse()
or car::confidenceEllipse()
(on which the ggplot2 command is based).
Any explanations as to why this result shows up this way are greatly appreciated. Ideally, I would want the ellipse based on the t-distribution because of a small sample size (n=15), but I want to be confident that I know what it's doing.
# Some simulated correlated data:
foo.x <- rnorm(15, mean=10, sd=5)
foo.err <- rnorm(15, mean=0, sd=1)
foo.df <- data.frame(x=foo.x, y=foo.x+foo.err)
# plot data with confidence ellipses
ggplot(data=foo.df, aes(x,y)) +
geom_point(size=2) +
stat_ellipse(type = "norm", lty=1, col=1) +
stat_ellipse(type = "t", lty=2, col=2)
In this plot, the red dashed line is the ellipse based on the t-distribution, and the solid black line the ellipse based on the normal. (Sorry there is no legend on the plot to show what the line types represent; I tried to make that happen, but gave up before finding success.)