samedi 15 septembre 2018

Intercept of random effect - library(sommer)

When I'm run this mixed model I get all of the statistics I need.

library(sommer)
data(example)
#Model without intercept - OK
ans1 <- mmer2(Yield~Env,
              random= ~ Name + Env:Name,
              rcov= ~ units,
              data=example, silent = TRUE)
summary(ans1)
ans1$u.hat #Random effects

However if I try to get the intercept to random effects like in the R library(lme4), I get a error like:

Error in dimnames(x) <- dn : 
  length of 'dimnames' [2] not equal to array extent

#Model with intercept
ans2 <- mmer2(Yield~Env,
              random= ~ 1+Name + Env:Name,
              rcov= ~ units,
              data=example, silent = TRUE)
summary(ans2)
ans2$u.hat #Random effects

What Can I do to overcome that?




Aucun commentaire:

Enregistrer un commentaire