[Rd] [Package car/data.ellipse]: confidence intervals off by factor sqrt(2)??? (PR#2584)

volker.franz@tuebingen.mpg.de volker.franz@tuebingen.mpg.de
Wed Feb 26 21:40:03 2003


Full_Name: Volker Franz
Version: Version 1.6.2  (2003-01-10)
OS: Debian
Submission from: (NULL) (192.124.28.104)


Hi there, 

it seems to me that data.ellipse of package "car" (Version 1.0-1)
produces confidence interval's which are too big. To see this, do:

library(car)
plot(c(-2,2),c(-2,2),pch=0)
data.ellipse(rnorm(10000),rnorm(10000),levels=0.68,plot.points=F)
abline(v=+1)
abline(v=-1)
abline(h=+1)
abline(h=-1)

To my knowledge, this should result in a circle with radius
1. However, the circle is larger. It seems that the problem is due to
an erroneous specification of the degrees of freedom and can be fixed
with the following patch:

======================================================================
--- Ellipse.R	Wed Feb 26 17:49:43 2003
+++ Ellipse.orig	Thu Sep 19 18:20:41 2002
@@ -34,7 +34,7 @@
         stop("x and y must be vectors of the same length")
     if (plot.points & !add) plot(x, y, xlab=xlab, ylab=ylab, col=col, pch=pch,
las=las, ...)
     if (plot.points & add) points(x, y, col=col, pch=pch, ...)
-    dfn<-1
+    dfn<-2
     dfd<-length(x)-1
     if (robust) {
         require(MASS)
======================================================================

Or --- am I totally on the wrong track here?

Best 
Volker