[R] Observation in a confidence ellipse

Greg Snow Greg.Snow at imail.org
Sat May 28 22:33:22 CEST 2011


There are point in polygon functions in some of the spatial packages that would tell you if a point is within a polynomial approximation of the ellipse.  But in your case I would take a different approach.  Generally confidence ellipses are based on manhalobis distances, so you can just compute the manhalobis distance of the point relative to the mean vector (taking the appropriate covariance matrix into account), then if that distance is above a certain value it is outside the ellipse, if less it is inside.

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Jessica Minkue
Sent: Saturday, May 28, 2011 11:45 AM
To: r-help at r-project.org
Subject: [R] Observation in a confidence ellipse


Hello everyone
I really need some help here. I made a confidence ellipse using the function ellipse from the package ellipse:

ellipse(SD, centre=colMeans(pcsref),t=sqrt((p * (n-1)/(n-p))*qf(0.99, p,n-p))


Now, I want to write a function whom return TRUE or FALSE if a given observation is in the confidence ellipse. But I have no clue how to do it
Can anyone help me?

Best regards

Jessica


 		 	   		  
	[[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list