繁体   English   中英

重复测量因子的方差分析:使用model.table时出错

[英]ANOVA with repeated measures factors: Error using model.table

我正在遵循此网页中有关重复测量的单因素设计的示例。 最后,我希望使用model.tables计算Grand Mean 每当我收到此错误消息:

model.tables(aov.out,"means")
Error in FUN(X[[1L]], ...) : 
  eff.aovlist: non-orthogonal contrasts would give an incorrect answer

这些是我的数据:

    subject<- c(1,2,3,4,5,6,7,8,9,10)
    time1 <- c(5040,3637,6384,5309,5420,3549,2385,5140,3890,3910)
    time2 <- c(5067, 3668, 6689, 6489, 5246, 3922, 3408, 6613, 4063, 3937)
    time3 <- c( 3278, 3814, 8745, 4760, 4911, 5716, 5547, 5844, 4914, 4390)
    time4 <- c(   0, 2971,    0, 2776, 2128, 1208, 2935, 2739, 3054, 3363)
    time5 <- c(4161, 3483, 6728, 5008, 5562, 4380, 4006, 7536, 3805, 3923)
    time6 <- c( 3604, 3411, 2523, 3264, 3578, 2941, 2939,   47, 3612, 3604)
    mydata <- data.frame(time1, time2, time3, time4, time5, time6)
    mydata2 = stack(mydata)
    subject = rep(subject,6)
    mydata2[3] = subject
    colnames(mydata2) = c("values", "time", "subject") 
    aov.out = aov(values ~ time + Error(subject/time), data=mydata2)
    summary(aov.out)
    model.tables(aov.out,"means")

您可能应该将“主题”视为类别变量而不是数字。 您可以使用

subject = factor(rep(subject,6)) 

在上面的示例中。

暂无
暂无

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

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