View source: R/multivariate_diagnostic_plot.R
multivariate_diagnostic_plot | R Documentation |
Generates either a Mahalanobis Q-Q plot, an interactive 3D kernel density surface plot, or a 2D kernel density contour plot for exactly two numeric variables. The function is intended for assessing multivariate normality or exploring the bivariate distribution of the input data.
multivariate_diagnostic_plot(
data,
type = c("qq", "persp", "contour"),
tol = 1e-25,
use_population = TRUE
)
data |
A numeric vector, matrix, or data frame. Non-numeric columns are dropped with a warning; incomplete rows are removed. The input must contain exactly two numeric variables. |
type |
Character string specifying the type of plot to generate.
Must be one of |
tol |
Numeric tolerance for matrix inversion passed to |
use_population |
Logical; if |
If type = "qq"
, returns a ggplot2
object representing a Mahalanobis Q-Q plot.
If type = "persp"
or "contour"
, returns an interactive plotly
widget
displaying the KDE surface or contour, respectively.
## Not run:
library(MASS)
data(iris)
# Mahalanobis Q-Q plot
multivariate_diagnostic_plot(iris[, 1:2], type = "qq")
# 3D KDE surface
multivariate_diagnostic_plot(iris[, 1:2], type = "persp")
# 2D KDE contour
multivariate_diagnostic_plot(iris[, 1:2], type = "contour")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.