简体   繁体   中英

Levene test in R

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

The problem

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')

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