-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.

1
  • 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, 2016 at 12:38

1 Answer 1

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".

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.