PmedMCInt | R Documentation |
This function approximates the projection median using Monte Carlo integration, which can be used for any dimensions. PmedMCInt
is implemented internally using C code CPmedMCInt
and hence is much faster than coding with R only.
PmedMCInt(x, nprojs = 20000)
x |
The data as a matrix or data frame, with each row being viewed as one multivariate observation. |
nprojs |
The number of projections when using the Monte Carlo method to approximate the integration. The default value is 20000, since |
The projection median was introduced by Durocher and Kirkpatrick (2009) and generalised by Basu, Bhattacharya and Talukdar (2012). PmedMCInt
produces the projection median using Monte Carlo approximation, which is valid in any multi-dimensional data. However, a large number of projections is sometimes required to ensure accuracy, which will also increase the running time. In this case, PmedTrapz
is preferred for the two- or three-dimensional data, which is fast and accurate in general. In higher dimensions, yamm
is another alternative for computing the projection median.
A vector of the projection median for n-dimensional data.
Durocher, S. and Kirkpatrick, D. (2009), The projection median of a set of points, Computational Geometry,42, 364-375.
Basu, R., Bhattacharya, B.B., and Talukdar, T. (2012) The projection median of a set of points in Rd CCCG., 47, 329-346. doi: 10.1007/s00454-011-9380-6
PmedTrapz
,
yamm
# Load a 2-dimensional data set data(clusters2d) # # Set seed for reproduction. set.seed(5) # # Projection median approximated by Monte Carlo Integration. PmedMCInt(clusters2d, nprojs = 50000) # [1] 4.3246488 -0.1535201 # # # Load a 6-dimensional data set data(beetle) # set.seed(5) PmedMCInt(beetle,nprojs = 150000) # [1] 179.92439 125.16939 50.01176 136.55460 13.22277 95.04224
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.