observLmer3: Variance components for normal data 3

Description Usage Arguments Details Value Note References See Also Examples

View source: R/observLmer3.R

Description

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, dam by sire, and any additional fixed and/or random effects.

Usage

1
observLmer3(observ, dam, sire, response, remain, ml = F, iter = 1000)

Arguments

observ

Data frame of observed data.

dam

Column name containing dam (female) parent identity information.

sire

Column name containing sire (male) parent identity information.

response

Column name containing the offspring (response) phenotype values.

remain

Remaining formula using lme4 package format.

ml

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

iter

Number of iterations for computing the parametric bootstrap significance value for any fixed effects.

Details

Extracts the dam, sire, dam, dam by sire, and residual variance components. Extracts any additional fixed effect and random effect variance components. The fixed-effect variance component is as a single group using the method described by Nakagawa and Schielzeth (2013). 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). Significance values for any fixed effects are determined using likelihood ratio tests and a parametric bootstrap method (Bolker et al. 2009) from the mixed function of the afex package.

Value

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

Note

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.

References

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.

Nakagawa S, Schielzeth H. 2013. A general and simple method for obtaining R2 from generalized linear mixed-effects models. Methods in Ecology and Evolution 4(2): 133-142. DOI: 10.1111/j.2041-210x.2012.00261.x

See Also

observLmer, observLmer2

Examples

1
2
3
4
5
data(chinook_length) #Chinook salmon offspring length
#just a few iterations for the p-value of fixed effect
length_mod3<- observLmer3(observ=chinook_length,dam="dam",sire="sire",response="length",
remain="egg_size + (1|tray)",iter=5)
length_mod3

Example output

[1] "2019-09-10 16:01:03 UTC"
Formula (the first argument) converted to formula.
Numerical variables NOT centered on 0: egg_size
If in interactions, interpretation of lower order (e.g., main) effects difficult.
REML argument to lmer() set to FALSE for method = 'PB' or 'LRT'
Fitting 2 (g)lmer() models:
[boundary (singular) fit: see ?isSingular
.boundary (singular) fit: see ?isSingular
.]
Obtaining 1 p-values:
[boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
.]
boundary (singular) fit: see ?isSingular
refitting model(s) with ML (instead of REML)
Time difference of 3.101615 secs
Warning messages:
1: 'args.test' is deprecated; use 'args_test' instead 
2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model failed to converge with max|grad| = 0.00223238 (tol = 0.002, component 1)
3: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model failed to converge with max|grad| = 0.00427998 (tol = 0.002, component 1)
4: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model failed to converge with max|grad| = 0.00239063 (tol = 0.002, component 1)
$fixed
    effect   variance  percent   Chi.sq p.value
1 egg_size         NA       NA 3.273533     0.2
2  Fix_Tot 0.05967763 5.660252       NA      NA

$LRT.fixed
      term    d.AIC     d.BIC   Chi.sq    p.value
1 egg_size 1.273533 -3.824842 3.273533 0.07040583

$random
    effect     effect2     variance      percent
1 dam:sire (Intercept) 1.788027e-01 1.695892e+01
2     tray (Intercept) 1.197903e-01 1.136176e+01
3     sire (Intercept) 7.596946e-09 7.205486e-07
4      dam (Intercept) 1.461673e-01 1.386355e+01

$LRT.random
            term      d.AIC      d.BIC    Chi.sq      p.value
1      (1 | dam)  14.154638   9.056262  16.15464 5.837547e-05
2     (1 | sire)  -2.000001  -7.098377   0.00000 1.000000e+00
3 (1 | dam:sire) 141.433952 136.335577 143.43395 4.724439e-33
4     (1 | tray) 122.909890 117.811514 124.90989 5.325910e-29

$other
  component  variance   percent
1  Residual 0.5498902  52.15551
2     Total 1.0543281 100.00000

$calculation
  component     variance      percent
1  additive 3.038778e-08 2.882194e-06
2    nonadd 7.152107e-01 6.783569e+01
3  maternal 1.461673e-01 1.386355e+01

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