Plot3dMedian | R Documentation |
This function plots multivariate medians in the three-dimensional case. The grey dots presented in the figure are the data points and the Spatial, Component-wise (CWmed), Tukey's, Liu's, Projection medians as well as the mean value of the data set are plotted in the figure. Oja's median is no longer used, as the package used to compute it has been archived from CRAN.
Plot3dMedian(data, xvec, yvec, zvec, yamm.nprojs = 2000, PmedMCInt.nprojs = 20000, no.subinterval = c(18,36), opt.method = "BFGS", xlab = "Component1", ylab = "Component2", zlab = "Component3")
data |
The data as a matrix or data frame, with each row being viewed as one multivariate observation. |
xvec |
A numeric vector containing the maximum and minimum values you desire for the x-axis. |
yvec |
A numeric vector containing the maximum and minimum values you desire for the y-axis. |
zvec |
A numeric vector containing the maximum and minimum values you desire for the z-axis. |
yamm.nprojs |
The number of projections for the dataset when computing |
PmedMCInt.nprojs |
The number of projections for the dataset when computing |
no.subinterval |
A numeric vector of two entries which represents the number of subintervals chosen while using the trapezoidal rule to approximate the projection median with |
opt.method |
The method chosen for the optimiser when computing the |
xlab |
Title for x-axis. Must be a character string. |
ylab |
Title for y-axis. Must be a character string. |
zlab |
Title for z-axis. Must be a character string. |
The Spatial median is obtained using L1median
in the Rpackage robustX. The Component-wise (CWmed), and Tukey's median are produced using function med
in the Rpackage depth. Oja's median is no longer
computed here. Liu's median is not available in higher dimensions (>2), so it is not shown here. When computing the projection median, three approximations are implemented and diplayed in the plot, where PmedMCInt
uses Monte Carlo method, PmedTrapz
is computed by the trapezoidal rule, and yamm
uses an optimiser.
The argument xvec
, yvec
and zvec
are useful when there are outliers in the dataset, which are not expected to be shown in the figure in some cases. Determining the x-axis y-axis, and z-axis allows you to zoom in the plot and see the difference between multivariate medians and mean value.
Chen, F. and Nason, Guy P. (2020) A new method for computing the projection medi an, its influence curve and techniques for the production of projected quantile plots. PLOS One, doi: 10.1371/journal.pone.0229845
PmedMCInt
,
PmedTrapz
yamm
,
yamm.obj
,
optim
.
# Load a data frame with 105 rows and 3 columns. # The last five rows of the data are the outliers. data(clusters3d) # # Remove the outliers of the dataset. cluster_without_outlier <- clusters3d[c(1:100),] myxvec <- c(min(cluster_without_outlier[,1]), max(cluster_without_outlier[,1])) myyvec <- c(min(cluster_without_outlier[,2]), max(cluster_without_outlier[,2])) myzvec <- c(min(cluster_without_outlier[,3]), max(cluster_without_outlier[,3])) # # Plot the figure. set.seed(15) Plot3dMedian(cluster_without_outlier, myxvec, myyvec, myzvec, yamm.nprojs = 2000, PmedMCInt.nprojs = 15000, no.subinterval = c(18,36),opt.method = "BFGS", xlab = "Component1",ylab = "Component2", zlab = "Component3")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.