【问题标题】:Fligner and Bartlett tests in RR中的Fligner和Bartlett测试
【发布时间】:2014-09-11 19:17:15
【问题描述】:

我有一个矩阵,其中每一行都是从 100 个对象中提取的样本。我已经采集了 30 个样本,得到了一个 30 x 100 的矩阵。我想使用 Fligner 和 bartlett 检验来显示方差是均匀的。这是一些示例代码。

 data <- Matrix[1:30,]
 groups <- factor(rep(letters[1:30], each = 100))
 fligner.test(data,groups)

我已经让测试适用于较小尺寸 (4x6) 的测试数据,但不适用于我自己的数据。我不断收到以下错误:

Error in complete.cases(x, g) : not all arguments have the same length

【问题讨论】:

  • 好吧,如果它适用于示例,那么错误不是reproducible。您的数据与样本有何不同?只是更大的尺寸?然后创建一个更大的样本,直到重现与数据相同的错误。否则我们真的无法知道您的数据出了什么问题。

标签: r matrix statistics


【解决方案1】:

它不会在与您的描述匹配的测试集上失败(添加或不添加 NA)

> dat <- matrix( sample(c(1:30, NA), 3000, rep=TRUE))
>  groups <- factor(rep(letters[1:30], each = 100))
>  fligner.test(dat,groups)

    Fligner-Killeen test of homogeneity of variances

data:  dat and groups
Fligner-Killeen:med chi-squared = 17.7191, df = 25, p-value = 0.8541

【讨论】:

    猜你喜欢
    • 2020-11-27
    • 2014-09-08
    • 1970-01-01
    • 1970-01-01
    • 2013-04-30
    • 1970-01-01
    • 1970-01-01
    • 2019-05-18
    • 2016-12-20
    相关资源
    最近更新 更多