[R-sig-ME] CANNOT PARTITION ERROR VARIANCE AMONG EXPERIMENTS

Paul Johnson paul.johnson at glasgow.ac.uk
Wed Apr 25 16:34:14 CEST 2018


Hi Kassim,

fit <- lmer(yield~Experiment+(1|Genotype), data = MET)

# variance "explained" by fixed effects, i.e. between experiments
fitval <- model.matrix(fit) %*% fixef(fit)
n <- length(fitval)
Vf <- sum((fitval - mean(fitval))^2)/n
#  var(fitval) would be simpler but uses n-1 as the denominator whereas I think (?!) n is correct
# (in practice it'll only make a substantial difference if n is very small)

# genotype random effect variance (unexplained variation among genotypes)
Vr <- VarCorr(fit)$Genotype[, ]
# (note that this doesn't work when there are random slopes)

# residual/error variance (unexplained variation between observations)
Ve <- attr(VarCorr(fit), "sc")^2

var(MET$yield)
# ...should be not too far from
Vf + Vr + Ve

Best wishes,
Paul


________________________________________
From: R-sig-mixed-models [r-sig-mixed-models-bounces at r-project.org] on behalf of Kassim Baba Yussif [babayussifk at gmail.com]
Sent: 24 April 2018 15:35
To: r-sig-mixed-models at r-project.org
Subject: [R-sig-ME] CANNOT PARTITION ERROR VARIANCE AMONG EXPERIMENTS

 I am analyzing data from multiple experiments using linear mixed effect
model. However, I cannot partition the error variance based on each
experiment. I will therefore be grateful if I can be guided on how to go
about it.

Below is the model I used:

lmer(yield~Experiment+(1|Genotype), data = MET)

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-mixed-models at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models



More information about the R-sig-mixed-models mailing list