0

I have a problem using the nor.test function as a oneway test in R. My data contain yield value (Rdt_pied) that are grouped by treatment (Traitement). In each treatment I have between 60 and 90 values.

> describe(Rdt_pied ~ Traitement, data = dataMax) 

      n     Mean  Std.Dev Median Min  Max   25th    75th  Skewness Kurtosis NA
G(1) 90 565.0222 282.1874  535.0  91 1440 379.00  751.25 0.7364071 3.727566  0
G(2) 90 703.1444 366.1114  632.5 126 1628 431.50 1007.75 0.4606251 2.392356  0
G(3) 90 723.9667 523.5872  650.5  64 2882 293.50 1028.50 1.2606231 5.365014  0
G(4) 90 954.1000 537.0138  834.5  83 2792 565.25 1143.75 1.1695460 4.672321  0
G(A) 60 368.0667 218.1940  326.0  99 1240 243.00  420.00 2.2207612 9.234473  0
G(H) 60 265.4667 148.0383  223.5 107  866 148.00  357.25 1.3759925 5.685456  0
G(S) 60 498.8000 280.1277  401.0 170 1700 292.75  617.50 1.6792061 7.125804  0
G(T) 60 521.7167 374.7822  448.5  74 1560 214.00  733.25 1.1367209 3.737134  0
>  

Why do the nor.test returns me this answer?

> nor.test(Rdt_pied ~ Traitement, data = dataMax) 

Error in shapiro.test(y[which(group == (levels(group)[i]))]) : 
  sample size must be between 3 and 5000

Thank you for your help!

2
  • Dear @DSR, I cannot reproduce your error with the iris dataset (onewaytests::nor.test(Sepal.Length ~ Species, data = iris) works fine). Please try to provide a minimal, reproducible example with some data. This might help figure out what's wrong. Commented Apr 10, 2020 at 9:49
  • Hello, thank you for your answer! I finally succeded to use the function. A group "G" that doesn't appear with the "describe function" contained no values. Even using the function filter(Traitement!="G") the nor.test was pertubated with this. I modified the csv file and it works now... Commented Apr 14, 2020 at 15:56

1 Answer 1

0

Haven't used that package, but per documentation (and your error), nor.test performs Shapiro-Wilk normality test by default, which needs a numeric vector as an input (at least 3 values). My guess is that, there is a group, based on Traitement, which has less than 3 values, or more than 5000. Try to check it with something like

table(dataMax$Traitement)
Sign up to request clarification or add additional context in comments.

2 Comments

Hello, thank you for your answer! I finally succeded to use the function. A group "G" that doesn't appear with the "describe function" contained no values. Even using the function filter(Traitement!="G") the nor.test was pertubated with this. I modified the csv file and it works now...
If it answers your question, consider marking it as 'Accepted'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.