Highlight shortcuts using mvOutlier from MVN to R

I am trying to mark outliers on a QQ graph in a Chi square using mvOutlier()the batch function MVNin R.

I was able to identify outliers by their labels and get their x coordinates. I tried to place the first on the chart with text(), but the x- and y-coordinates seem to be inverted.

Based on an example from the documentation:

library(MVN)
data(iris)
versicolor <- iris[51:100, 1:3]
# Mahalanobis distance
result <- mvOutlier(versicolor, qqplot = TRUE, method = "quan")
labelsO<-rownames(result$outlier)[result$outlier[,2]==TRUE]
xcoord<-result$outlier[result$outlier[,2]==TRUE,1]
text(xcoord,label=labelsO)

This gives the following: Resulting plot

I also tried text(x = xcoord, y = xcoord,label = labelsO), which is fine when the points are near the line y = x, but can fail when the normality fails (and the points deviate from this line).

Can anyone suggest how to access the Chi-square quantiles or why the x coordinate of the function text()does not seem to obey the input parameters.

+4
3

mvOutlier, , -. text xcoord y- , x 1:2. , chi-squared , .

result <- mvOutlier(versicolor, qqplot = TRUE, method = "quan")
labelsO<-rownames(result$outlier)[result$outlier[,2]==TRUE]
xcoord<-result$outlier[result$outlier[,2]==TRUE,1]
#recalculate chi-squared values for ranks 50 and 49 (i.e., p=(size:(size-n.outliers + 1))-0.5)/size and df = n.variables = 3
chis = qchisq(((50:49)-0.5)/50,3)
text(xcoord,chis,label=labelsO)
+3

, MVN . , , "labeling outliers" mvOutlier (...). . .

+2

The web version of the package MVNhas the ability to mark outliers (additional parameters on the "Detection" tab). You can access this web tool through http://www.biosoft.hacettepe.edu.tr/MVN/

+2
source

Source: https://habr.com/ru/post/1584975/


All Articles