[R] no slot of name "fixef" for this object of class "lmerMod"
Iker Vaquero Alba
karraspito at yahoo.es
Thu Jul 2 19:14:16 CEST 2015
Hello everyone.
I am trying to re-analyse some data with an R function I last used in 2011. Everything seemed to work fine then, but now, using the same code, it gives me this error:
Error in R.pe(y, group1, group2, returnR = FALSE) :
no slot of name "fixef" for this object of class "lmerMod"
This is the part of the function that I think is relevant for the problem:
# preparation
#n <- rowSums(y)
N <- length(y)
k <- length(unique(group1)) # clone
g <- length(unique(group2)) # round
#
require(lme4)
# functions
R.pe <- function(y, group1, group2, returnR=TRUE) {
mod <- lmer(y ~ 1 + (1|group1)+(1|group2),verbose=FALSE)
VarComp <- lme4::VarCorr(mod)
beta0 <- as.numeric(mod at fixef)
var.e <- attr(VarComp, "sc")^2 # residual variance
var.a1 <- (as.numeric(VarComp[1])) # e.g. get clone R
var.a2 <- (as.numeric(VarComp[2])) # e.g. get round R
R.group1 <- var.a1/(var.a1+var.e) # clone level
R.group2 <- var.a2/(var.a2+var.e)
R.groupr <- var.a1/(var.a1+var.e+var.a2)
if(returnR) return(list(R.group1=R.group1,R.group2=R.group2,R.groupr=R.groupr))
else return(list(beta0=beta0, var.e=var.e, var.a1=var.a1, var.a2=var.a2))
}
I would appreciate any help about this. Let me know if you need more code, the function is obviously longer.
Thank you very much in advance.
Iker
__________________________________________________________________
Dr. Iker Vaquero-Alba
Daphne du Maurier
Centre for Ecology and Conservation
College of Life and Environmental Sciences
University of Exeter, Cornwall Campus
TR10 9FE
Penryn
U.K.
http://biosciences.exeter.ac.uk/cec/staff/postgradresearch/ikervaquero-alba/
https://eric.exeter.ac.uk/repository/handle/10036/3381
[[alternative HTML version deleted]]
More information about the R-help
mailing list