我的实验包括根据不同产仔的后代的母亲的变量x评估两个变量y(y1,y2)。我使用lme4在R中运行线性混合模型,方法如下:y1〜x +(1 | mom)和y2〜x +(1 | mom)
在第一种情况下,模型运行,但是在第二种情况下,我获得了奇异警告消息。数据很小(11胎和29个后代),我知道奇异性可能源于这个有限的样本。但是,我想知道为什么在一种情况下会发生这种情况,而在另一种情况下却不会从完全相同的结构发生这种情况吗?
请在下面找到代码以重现该问题。预先感谢您的帮助。
y1=c(0.26903580,0.13365153,-0.41765552,-0.80636189,-0.49945988,-1.00212371,-0.17151876,-0.61706171,-0.14339771,-2.25371738,-1.25717754,1.80143680,-1.03968678,
0.05024469,0.82305674,0.37280972,-0.39462624,0.16851854,-0.79639251,-0.23391974,2.04901986,1.83841657,1.91358574,-0.19369511,0.91614178,0.40747619,
0.01780726,-0.42882124,-0.50558551)
y2=c(2.09592403,0.33716864,-0.85235144,0.12872470,-1.58329485,-0.02413419,-1.49157952,1.39589172,-0.40489178,-0.46881459,-0.52717889,-0.24647439,-0.88570247,
1.10209720,0.50799603,-1.51275803,-0.17421382,0.29270060,0.70680923,-0.34652748,-1.34705839,0.76795278,-0.64390750,-0.78564938,0.68735446,2.02139567,
1.17928216,-0.54663366,0.61787315)
x=c(-0.3802510,-0.3802510,-0.3802510,-0.3802510,2.0006079,2.0006079,2.0006079,2.0006079,0.4383239,0.4383239,0.4383239,0.3318247,-0.1488276,-0.7796731,
-0.7796731,-0.7796731,-0.1179862,-0.1179862,-0.3221202,-0.3221202,0.4910143,0.4910143,0.4910143,-0.1179862,-1.5813074,-1.5813074,-0.9842020,-0.9842020,
-0.9842020)
mom=c("a","a","a","a","b","b","b","b","c","c","c","d","e","f","f","f","g","g","h","h","i","i","i","g","j","j","k","k","k")
d = data.frame(y1,y2,x,mom)
summary(lmer(formula = y1~x+(1|mom), data = d)) #Model 1
summary(lmer(formula = y2~x+(1|mom), data = d)) #Model 2