简体   繁体   English

R中的Levene测试

[英]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. 我在R中进行Levene测试时遇到了一些问题。我没有得到任何输出值,只有NaN。 Anyone know what the problem might be? 有人知道可能是什么问题吗?

Have used the code: 使用过的代码:

with(Test,levene.test(Sample1,Sample2,location="median")) 与(测试,levene.test(样本1,样本2,位置= “中间”))

The problem 问题

Best regards 最好的祝福

The levene.test function assumes the data are in a single vector. levene.test函数假定数据在单个向量中。 The second argument is a grouping variable. 第二个参数是分组变量。

Concatenate your data using the c() function: data=c(Sample1, Sample2) . 使用c()函数连接数据: data=c(Sample1, Sample2) Construct a vector of group names like gp = rep('Gp1','Gp2', each=240) . 构造一个组名称向量,例如gp = rep('Gp1','Gp2', each=240) Then, call the function as follows: levene.test(data, gp, location='median') . 然后,按如下所示调用函数: levene.test(data, gp, location='median')

This can also be done directly: 这也可以直接完成:

levene.test(c(Sample1, Sample2), rep('Gp1', 'Gp2', each=240)), location='median')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM