Tom La Bone <booboo <at> gforcecable.com> writes:

> 
> 
> 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@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.

Reply via email to