admin管理员组

文章数量:1122832

I have been analyzing strip plot (split block) experiments using the aov() function from R:base with an Error term and got correct numbers for degrees of freedom (df) of the residuals of main effects and interaction.

However, I was told that using linear mixed models would be advantageous, and so I tried the lmer() function from library lme4.

Unfortunately, the resulting number of df for residuals seems to depend on the data. Does that mean that the lmer() function is not applicable to each and every data set?

Here is an example:

In 3 blocks, two factors A (4 levels) and B (3 levels) are laid out as orthogonal strips.

The classical ANOVA gives for:

*aov(y~A*B + Error(block/(A+b))

Residuals (block): 2df

Residuals (A): 6 df

Residuals (B): 4 df

Residuals (A x B): 12 df

With the lmer function (using libraries lme4 and lmerTest):

anova(lmer(y~A*B + (1|block/A) + (1|block/B))

I get sometimes correct numbers of DenDF, but not all the times it do, for example:

Residuals (A): 6

Residuals (B): 16

Residuals (A x B): 16

How can the number of df depend on the values of the depending variable y?

Do I have a mistake in my formula?

本文标签: