observLmer2: Variance components for normal data 2

Description Usage Arguments Details Value Note References See Also Examples

View source: R/observLmer2.R


Extracts additive genetic, non-additive genetic, and maternal variance components from a linear mixed-effect model using the lmer function of the lme4 package. Model random effects are dam, sire, and dam by sire. Options to include one random position and/or one random block effect(s).


observLmer2(observ, dam, sire, response, position = NULL, block = NULL, ml = F)



Data frame of observed data.


Column name containing dam (female) parent identity information.


Column name containing sire (male) parent identity information.


Column name containing the offspring (response) phenotype values.


Optional column name containing position factor information.


Optional column name containing block factor information.


Default is FALSE for restricted maximum likelihood. Change to TRUE for maximum likelihood.


Extracts the dam, sire, dam, dam by sire, and residual variance components. Extracts optional position and block variance components. Calculates the total variance component. Calculates the additive genetic, non-additive genetic, and maternal variance components (see Lynch and Walsh 1998, p. 603). Significance values for the random effects are determined using likelihood ratio tests (Bolker et al. 2009).


A list object containing the raw variance components, the variance components as a percentage of the total variance component. Also, contains the difference in AIC and BIC, and likelihood ratio test Chi-square and p-value for all random effects.


Maximum likelihood (ML) estimates the parameters that maximize the likelihood of the observed data and has the advantage of using all the data and accounting for non-independence (Lynch and Walsh 1998, p. 779; Bolker et al. 2009). On the other hand, ML has the disadvantage of assuming that all fixed effects are known without error, producing a downward bias in the estimation of the residual variance component. This bias can be large if there are lots of fixed effects, especially if sample sizes are small. Restricted maximum likelihood (REML) has the advantage of not assuming the fixed effects are known and averages over the uncertainty, so there can be less bias in the estimation of the residual variance component. However, REML only maximizes a portion of the likelihood to estimate the effect parameters, but is the preferred method for analyzing large data sets with complex structure.


Bolker BM, Brooks ME, Clark CJ, Geange SW, Poulsen JR, Stevens MHH, White J-SS. 2009. Generalized linear mixed models: a practical guide for ecology and evolution. Trends in Ecology and Evolution 24(3): 127-135. DOI: 10.1016/j.tree.2008.10.008

Lynch M, Walsh B. 1998. Genetics and Analysis of Quantitative Traits. Sinauer Associates, Massachusetts.

See Also

observLmer, observLmer3


data(chinook_length) #Chinook salmon offspring length
length_mod2<- observLmer2(observ=chinook_length,dam="dam",sire="sire",response="length",

Example output

Registered S3 methods overwritten by 'car':
  method                          from
  influence.merMod                lme4
  cooks.distance.influence.merMod lme4
  dfbeta.influence.merMod         lme4
  dfbetas.influence.merMod        lme4
[1] "2021-02-04 13:11:09 UTC"
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
Time difference of 1.261411 secs
    effect  variance  percent     d.AIC      d.BIC    Chi.sq      p.value
1 dam:sire 0.1798015 17.28121 141.49865 136.400272 143.49865 4.573043e-33
2     tray 0.1077362 10.35482 121.50329 116.404911 123.50329 1.082069e-28
3     sire 0.0000000  0.00000  -2.00000  -7.098376   0.00000 1.000000e+00
4      dam 0.2029810 19.50905  29.98924  24.890867  31.98924 1.550287e-08

  component  variance   percent
1  Residual 0.5499266  52.85493
2     Total 1.0404453 100.00000

  component  variance  percent
1  additive 0.0000000  0.00000
2    nonadd 0.7192061 69.12483
3  maternal 0.2029810 19.50905

fullfact documentation built on March 14, 2021, 5:08 p.m.