I am Having a little problem doing a Levene test in R. I does not get any output value, only NaN. Anyone know what the problem might be?
Have used the code:
with(Test,levene.test(Sample1,Sample2,location="median"))
Best regards
I am Having a little problem doing a Levene test in R. I does not get any output value, only NaN. Anyone know what the problem might be?
Have used the code:
with(Test,levene.test(Sample1,Sample2,location="median"))
Best regards
The levene.test
function assumes the data are in a single vector. The second argument is a grouping variable.
Concatenate your data using the c()
function: data=c(Sample1, Sample2)
. Construct a vector of group names like gp = rep('Gp1','Gp2', each=240)
. Then, call the function as follows: levene.test(data, gp, location='median')
.
This can also be done directly:
levene.test(c(Sample1, Sample2), rep('Gp1', 'Gp2', each=240)), location='median')