Skip to content
Facundo Muñoz edited this page Jan 18, 2022 · 5 revisions

Frequently Asked Questions

How to install breedR manually

## Where to install the packages
dest.dir <- .libPaths()[1]

## Download breedR source
## (linux or MAC, use `method = 'libcurl'`)
fn <- file.path(dest.dir, 'breedR-master.zip')
method <- ifelse(.Platform$OS.type == 'windows', 'wininet', 'libcurl')
if(isTRUE(file.info("/Library")$isdir && file.info("/Applications")$isdir))
  method <- 'curl'  # if Mac
download.file('https://github.com/famuvie/breedR/archive/master.zip',
               method = method, fn)
unzip(fn, exdir = dest.dir)

## Install dependencies (and their subsequent deps) in the selected destination 
## from internet
pkg.nms <- c("colorspace", "dichromat", "digest", "ggplot2", "gtable",
"HaploSim", "labeling", "lme4", "magrittr", "minqa", "munsell", "nloptr", 
"pedigree", "pedigreemm", "plyr", "proto", "RColorBrewer", "Rcpp", "RcppEigen",
"reshape", "reshape2", "scales", "sp", "stringi",
"stringr")
install.packages(pkg.nms, lib = dest.dir)

## Install from source in the selected destination
install.packages(file.path(dest.dir, 'breedR-master'),
                 repos = NULL, type = 'source', lib = dest.dir)
                 

How to obtain a AOV table with p-values for the fixed-effects

It is not clear how to implement such a method in the context of Mixed Models, particularly with random effects at individual levels. The approach used by SAS (for instance) is questionable (see https://stat.ethz.ch/pipermail/r-help/2006-May/094765.html), which is why the authors of lme4 neither supply p-values.

Instead, I suggest using a resampling technique such as Bootstrap, where you can control exactly how to handle the random effects (e.g. simulate from the estimated distribution, fix at group means or specific values, etc.).

S.E. of variance component are different than those from lme4

  • The standard deviations given by lme4::lmer() are not the standard errors of the variance estimates, but simply their square root.

  • The authors of lme4 have chosen not to report standard errors for variance estimates, since they are often rough and misleading approximations. Literally (Bates 2010, p. 19):

      In most cases summarizing the precision of a variance component estimate by
      giving an approximate standard error is woefully inadequate.
    
  • Instead, they provide alternative and more reliable methods for assessing the variability of the parameter estimates (Bates 2010, Section 1.5)

  • Lacking this functionality, breedR::remlf90() with method = 'ai' yields the standard errors estimated from the average-information matrix. Take these results with care.

References

  • Bates, Douglas M (2010). lme4: Mixed-effects modeling with R. Chapter drafts.