mahad | R Documentation |
Takes a matrix of item responses and computes Mahalanobis D. Can additionally return a
vector of binary outlier flags.
Mahalanobis distance is calculated using the function psych::outlier
of the psych
package, an implementation which supports missing values.
mahad(x, plot = TRUE, flag = FALSE, confidence = 0.99, na.rm = TRUE)
x |
a matrix of data |
plot |
Plot the resulting QQ graph |
flag |
Flag potential outliers using the confidence level specified in parameter |
confidence |
The desired confidence level of the result |
na.rm |
Should missing data be deleted |
Richard Yentes ryentes@gmail.com, Francisco Wilhelm franciscowilhelm@gmail.com
Meade, A. W., & Craig, S. B. (2012). Identifying careless responses in survey data. Psychological Methods, 17(3), 437-455. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1037/a0028085")}
psych::outlier
on which this function is based.
mahad_raw <- mahad(careless_dataset) #only the distances themselves
mahad_flags <- mahad(careless_dataset, flag = TRUE) #additionally flag outliers
mahad_flags <- mahad(careless_dataset, flag = TRUE, confidence = 0.999) #Apply a strict criterion
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.