简体   繁体   中英

How can I do one-sided Grubb's test for outlier in R as in Minitab?

In minitab we can do grubbs test with three options: 1.Smallest or largest data value is an outlier 2.Smallest data value is an outlier 3.Largest data value is an outlier

I am doing it in R now. Here is the code for tow-sided test.

library(outliers)   。
x=rnorm(30) 
x[21]=10 
grubbs = grubbs.test(x, type = 10, opposite = FALSE, two.sided = TRUE)

If I set 'two.sided=FALSE', R gives me either lowest or largerst value as an outlier.

grubbs = grubbs.test(x, type = 10, opposite = FALSE, two.sided = FALSE)

Is there a way that I can set as minitab does? Thanks

I figured it myself:

  1. for minitab (1.Smallest or largest data value is an outlier): two.sided = TRUE

2) for minitab (3.Largest data value is an outlier): two.sided = FALSE Because by default, the test is performed on the highest value.

  1. for minitab(2.Smallest data value is an outlier )

If you want to do the test for the lowest value, use two.sided = FALSE , and simply add the argument opposite = TRUE :

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM