R 中的重复测量/受试者内方差分析 [英] Repeated-measures / within-subjects ANOVA in R

查看:49
本文介绍了R 中的重复测量/受试者内方差分析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 R 运行重复测量方差分析.我已经浏览了各种网站上的各种示例,但他们似乎从未谈论过我遇到的错误.我想我误解了一些重要的事情.

I'm attempting to run a repeated-meaures ANOVA using R. I've gone through various examples on various websites, but they never seem to talk about the error that I'm encountering. I assume I'm misunderstanding something important.

我尝试运行的方差分析基于使用人类参与者进行的实验中的一些数据.它有一个DV和三个IV.所有 IV 的所有水平都在所有参与者身上运行,使其成为三向重复测量/受试者内方差分析.

The ANOVA I'm trying to run is on some data from an experiment using human participants. It has one DV and three IVs. All of the levels of all of the IVs are run on all participants, making it a three-way repeated-measures / within-subjects ANOVA.

我在R中运行的代码如下:

The code I'm running in R is as follows:

aov.output = aov(DV~ IV1 * IV2 * IV3 + Error(PARTICIPANT_ID / (IV1 * IV2 * IV3)),
                 data=fulldata)

当我运行它时,我收到以下警告:

When I run this, I get the following warning:

Error() model is singular

知道我可能做错了什么吗?

Any ideas what I might be doing wrong?

推荐答案

尝试使用 lme4 包中的 lmer 函数.aov 函数在这里可能不合适.寻找 Dougles Bates 的参考资料,例如http://lme4.r-forge.r-project.org/book/Ch4.pdf(其他章节也很棒,但那是重复测量章节,这是介绍:http://lme4.r-forge.r-project.org/book/Ch1.pdf).R 代码在同一个地方,对于纵向数据,现在似乎普遍认为只适合 OLS 而不是像 lme4 包或 nlme 中的方差模型的组件,这对我来说似乎是错误的最近流行度被 lme4 疯狂超越.您可能会注意到 Brian Ripley 在上面的评论部分中引用的帖子只是建议也切换到 lme.

Try using the lmer function in the lme4 package. The aov function is probably not appropriate here. Look for references from Dougles Bates, e.g. http://lme4.r-forge.r-project.org/book/Ch4.pdf (the other chapters are great too, but that is the repeated measures chapter, this is the intro: http://lme4.r-forge.r-project.org/book/Ch1.pdf). The R code is at the same place and for longitudinal data, it seems to be generally considered wrong these days to just fit OLS instead of a components of variance model like in the lme4 package, or in nlme, which to me seems to have been wildly overtaken by lme4 in popularity recently. You may note Brian Ripley's referenced post in the comments section above just recommends switching to lme also.

顺便说一句,跳跃的一个巨大优势是,您将能够使用典型语法对每个效果的水平进行估计,作为对总均值的调整:

By the way, a huge advantage off the jump is you will be able to get estimates for the level of each effect as adjustments to the grand mean with the typical syntax:

lmer(DV ~ 1  +IV1*IV2*IV3 +(IV1*IV2*IV3|Subject), dataset))

请注意,您的随机效应将是矢量值.

Note your random effects will be vector valued.

这篇关于R 中的重复测量/受试者内方差分析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆