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. Tom -- View this message in context: http://n4.nabble.com/Ellipse-that-Contains-95-of-the-Observed-Data-tp1694538p1694538.html Sent from the R help mailing list archive at Nabble.com.
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.
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 andgenerate> 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 randomvariables> and generate an empirical ellipse that contains 95% of theobservations,> e.g., > > x <- rnorm(10000) > y <- rnorm(10000) > ? > > I am specifically looking for an ellipse that does not assumenormality. 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}}
for a picture of the bagplot, try going to http://www.statmethods.net/graphs/boxplot.html -- View this message in context: http://n4.nabble.com/Ellipse-that-Contains-95-of-the-Observed-Data-tp1694538p1695236.html Sent from the R help mailing list archive at Nabble.com.