使用RLRsim测试随机效应会导致错误消息随机效应不是独立的

时间:2018-12-10 23:41:42

标签: r nlme

问题出在标题上。

问题是,是否有人知道该问题的解决方案?由于数据集包含来自情侣研究的数据,因此随机效应不是独立的。还是我要测试它们的重要性。

dataset and if prefered r-script replex_RLRsim can be retrieved here

#Replex for RLRsim:

##reduced model-specific data-set:
datafclr <-read.csv("datafclr.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)

##Testing female random intercept:

#The full-model maf is already prepared --> tim2!

tim2 <- lme(fixed=EERTmn ~ male + female + 
              (male:time7c)          + (female:time7c)          +                           
              (male:IERT_Cp)         + (female:IERT_Cp)         + 
              (male:IERT_Cp_Partner) + (female:IERT_Cp_Partner)-1,

            control=list(maxIter=100000), data=datafclr,                                             

            random=~male + female -1|dyade, correlation=corAR1(), na.action=na.omit)

mA.f <-tim2

#control:

summary(mA.f)

#The model m0 containing only the other random effect not to be tested needs
#to be created first:

m0.f <- lme(fixed=EERTmn ~ male + female + 
              (male:time7c)          + (female:time7c)          +                           
              (male:IERT_Cp)         + (female:IERT_Cp)         + 
              (male:IERT_Cp_Partner) + (female:IERT_Cp_Partner)-1,

            control=list(maxIter=100000), data=datafclr,                                             

            random=~male -1|dyade, correlation=corAR1(), na.action=na.omit) 

#control:

summary(m0.f)

#The model m containing only the effect to be tested also:

m.f <- lme(fixed=EERTmn ~ male + female + 
             (male:time7c)          + (female:time7c)          +                           
             (male:IERT_Cp)         + (female:IERT_Cp)         + 
             (male:IERT_Cp_Partner) + (female:IERT_Cp_Partner)-1,

           control=list(maxIter=100000), data=datafclr,                                             

           random=~female -1|dyade, correlation=corAR1(), na.action=na.omit)

#control:
summary(m.f)

#Now test the female random intercept for significance:

#basic pattern of the cmd: exactRLRT(m, mA, m0)

#inserted:

exactRLRT(m.f, mA.f, m0.f)

#Output:

#Error in exactRLRT(m.f, mA.f, m0.f) : 
#  Random effects not independent - covariance(s) set to 0 under H0.

#exactRLRT can only test a single variance.
#In addition: Warning message:
#  In extract.lmeDesign(m) : Removing incomplete cases from supplied data.

非常感谢!

最好,帕特里克

0 个答案:

没有答案