[R] Extract Variance Components

robgriffin247 rg.rforum at hotmail.co.uk
Mon May 14 15:43:08 CEST 2012


Well, I'm going to reply to my own thread with a solution  here, turns out
one attempt we made last week nearly had it, slight adjustment made it work.
For anyone that is interested / in the future wants to achieve the same
thing >

*varcomp <- matrix(nrow=0, ncol=3)

        for (i in 1:nlevels(narrow$gene)) {
        x<-lme4::VarCorr(rg.lmer[[i]])
        varcomp <- rbind(varcomp, c(as.numeric(x$"line:sex"),
as.numeric(x$"line"), attr(x, "sc")^2))}

varcomp<-data.frame(varcomp, row.names=levels(narrow$gene))

colnames(varcomp)<-c("sex.line", "line", "residual")*

--
View this message in context: http://r.789695.n4.nabble.com/Extract-Variance-Components-tp4629895p4629932.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list