-1

I have three groups on which I have performed a Kruskal-Wallis test in R. The data is as follows

A = c(178.53, 226.87,219.78)
B = c(<16.00,   <16.00, <16.00)   
C = c(<16.00,   <16.00, <16.00)

dat = list(g1=A, g2=B, g3=C)

kruskal.test(dat)

I am getting the following error:

Error: Unexpected '<' in B and C. How can I deal with variables that have "<" symbol.

Cettt
  • 11,460
  • 7
  • 35
  • 58
Musa Gabere
  • 553
  • 1
  • 5
  • 8
  • please clarify your question. It is unclear if `c(<16.00, <16.00, <16.00)` is what you data looks like or if you are adding these `<`s. This vector does not make sense. – lmo May 15 '16 at 12:38

1 Answers1

1

I believe you need to correct how you organize your data. In your case all the <16 are simply 16. The less thans are treated as ties regardless of their numerical value as they are numerically less than the smallest non-censored value (i.e., all the 16's need to be a single number less than 178.53) and you'll get the same answer.

test <- data.frame(Gp = c("A","A","A","B","B","B","C","C","C"),
                   Y  = c(178.53, 226.87, 219.78, 16.00, 16.00, 
                          16.00, 16.00, 16.00, 16.00))

with(test, kruskal.test(Y~Gp))

Keep in mind that if your data set were

A = 178.53, 226.87, 219.78,   5
B = <16.00,   <16.00, <16.00, 5
C = <16.00,   <16.00, <16.00, 5

then you would need to re-code all the 5's in the same way as you code the <16's since you dont know whether 5 is > or < a "<16".

greengrass62
  • 968
  • 7
  • 19