Learn R Programming

tolerance (version 3.0.0)

plotly_npmvtol: plotting Nonparametric Multivaraite Hyperrectangular Tolerance Region

Description

plotly_npmvtol is plotting function for nonparametric multivaraite hyperrectangular tolerance region. The function takes the outcome of npmvtol.region as an input and provides visualzation for hypperrectangular tolerance regions between two variables.

Usage

plotly_npmvtol(tol.out, 
               x, 
               var.names = NULL, 
               title = NULL,
               x.col = "#4298B5",
               x.cex = 6,
               x.shape = "dot",
               outlier.col = "#A6192E",
               outlier.cex = 8,
               outlier.shape = "triangle-up",
               tol.col = "#D1DDE6",
               tol.opacity = 0.4,
               x.lab.size = 12,
               x.tick.size = 12,
               y.lab.size = 12,
               y.tick.size = 12,
               title.position.x = 0.5,
               title.position.y = 0.98,
               title.size = 12,
               show.bound = TRUE, 
               bound.type = c("dash", "dot", "solid", "longdash", 
                              "dashdot", "longdashdot"), 
               bound.col = "#000000",
               bound.lwd = 1
               )

Value

plotly_npmvtol returns figures of hypperectangular tolerance regions between two random variable generated by npmvtol.region.

Arguments

tol.out

Output from npmvtol.region for multivariate data.

x

Data frame for different variables. Columns of x represent for different variables.

var.names

Labels of variable names. The dimension of var.names needs to be consistent with column dimension of x.

title

The main title on top of the plot. The length of title can be either 1 or multiple. If only 1 title is specified, all plots share the same title. If multiple titles are specified, number of titles needs to be consistent with the number of combinations of variables. For example, if the data has 4 variables, either 1 or 6 (choose 2 out of 4) titles need to be specified.

x.col

Color of original data points, excluding outliers.

x.cex

Size of original data points, excluding outliers.

x.shape

Shape of original data points, excluding outliers.

outlier.col

Color of outliers.

outlier.cex

Size of outliers.

outlier.shape

Shape of outliers.

tol.col

Color of tolerance region.

tol.opacity

Opacity of tolerance region.

x.lab.size

Size of label of the x-axis.

x.tick.size

Size of tick marks on the x-axis.

y.lab.size

Size of label of the y-axis.

y.tick.size

Size of tick marks on the y-axis.

title.position.x

Horizontal position of the title.

title.position.y

Vertical position of the title.

title.size

Size of the title.

show.bound

Logical indicating to show rectanglular boundaries. Default is TRUE.

bound.type

Line type of the rectangle boundaries.

bound.col

Color of the rectangle boundaries.

bound.lwd

Width of the rectangle boundaries.

References

Young, D. S., & Mathew, T. (2020), Nonparametric Hyperrectangular Tolerance and Prediction Regions for Setting Multivariate Reference Regions in Laboratory Medicine. Statistical Methods in Medical Research, 29, 3569--3585.

See Also

npmvtol.region

Examples

Run this code
library(plotly)

mdepth <- function(pts, x){
  mahalanobis(pts, center = rep(0, 3),
              cov = diag(1, 3))
}

set.seed(100)
x <- cbind(X1=rnorm(300), X2=rnorm(300), X3=rnorm(300))
out <-npmvtol.region(x = x, alpha = 0.10, P = 0.90, depth.fn = mdepth,
                     type = "semispace", semi.order = list(lower = 2, 
                                                           center = 3, upper = 1))

gg.out <- plotly_npmvtol(tol.out = out , x = x)

Run the code above in your browser using DataLab