Quantile for a single variable is easy to implement in R. However, it is not an easy task to quantile for multivariate data. There are several papers have been proposed to quantile for multivariate data such as Chaudhuri, P (1996), On a geometric notion of quantiles for multivariate data, Journal of the American Statistical Association 91, 862-872. The existing approaching is not easy to implement. Is there any R package can do quantiles for multivariate data? many thanks in advance
3 Answers
I would try here (mvnormtest, mvoutlier, mvtnorm): http://cran.r-project.org/web/views/Multivariate.html
Why don't you try my package cepp. It can compute PC's quantiles for you!
http://cran.r-project.org/web/packages/cepp/index.html
You need the function $evaluator$ in this package. It takes two arguments which correspond to the number of rows and columns in the data. It returns a function which can be optimized to get the spatial quantiles.
For a minimal example, see this snippet from the package documentation.
x <- rnorm(500)
dim(x) <- c(250,2)
ev <- evaluator(250,2)
##The Spatial Median
trust(ev, parinit=c(median(x[1,]), median(x[2,])), u=c(0,0),
rinit=0.5, rmax=2e5, samp = x)
##Quantile for vector (0.2,0.3)
trust(ev, parinit=c(median(x[1,]), median(x[2,])), u=c(0.2,0.3),
rinit=0.5, rmax=2e5, samp = x)
-
$\begingroup$ Would it be possible to give a short code example or perhaps show what function you refer to? $\endgroup$ Commented Nov 9, 2014 at 23:07
You need to compute the CDF of the joint distribution f(x1,x2,...,xn). The CDF will give you the quantiles you seek.
depth plot
package (pdf). $\endgroup$