[R] Ellipse that Contains 95% of the Observed Data
S Ellison
S.Ellison at lgc.co.uk
Mon Mar 29 11:40:19 CEST 2010
The bagplot at
http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=112
gives a nonparametric 2-d view analagous to a boxplot.
S Ellison
>
> I can take the results of a simulation with one random variable and
generate
> an empirical interval that contains 95% of the observations, e.g.,
>
> x <- rnorm(10000)
> quantile(x,probs=c(0.025,0.975))
>
> Is there an R function that can take the results from two random
variables
> and generate an empirical ellipse that contains 95% of the
observations,
> e.g.,
>
> x <- rnorm(10000)
> y <- rnorm(10000)
> ?
>
> I am specifically looking for an ellipse that does not assume
normality.
I'll be interested to hear what others come up with.
I'm not sure the problem as you have stated it is well-posed, or
necessarily possible. Suppose there is a true unknown
bivariate probability distribution with a non-elliptical 95%
quantile region. Will you be able to draw an ellipse that
has the properties you want?
Here's one possible alternative:
library(coda)
library(emdbook)
plot(x,y)
z = HPDregionplot(as.mcmc(cbind(x,y)),add=TRUE,col=2,lwd=2)
is not an ellipse, but does contain (approximately) 95% of
the points.
Convex hulls are another plausible approach.
______________________________________________
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.
*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}
More information about the R-help
mailing list