Learn R Programming

nadiv (version 2.14.2)

drfx: Simulated design random effects

Description

This function simulates effects for random terms in a linear mixed model based on design matrices. The intended purpose is for simulating environmental effects from a pedigree.

Usage

drfx(G, fac, dataf, ...)

Arguments

G
The variance-covariance matrix to model the effects after
fac
A character indicating the factor in dataf with which to construct the design matrix
dataf
A dataframe with fac in it
...
Arguments to be passed to the internal use of grfx

Value

  • fxA matrix with 'd' columns of random effects
  • ZA design matrix (of the format 'Matrix') from which the random effects in fx were assigned

Details

If G = x, where 'x' is a single number, then 'x' should still be specified as a 1-by-1 matrix (e.g., matrix(x)). Note, the G-matrix should never have a structure which produces a correlation exactly equal to 1 or -1. Instead, covariances should be specified so as to create a correlation of slightly less than (greater than) 1 (-1). For example: 0.9999 or -0.9999.

See Also

grfx

Examples

Run this code
# Create maternal common environment effects for 2 traits
# with perfectly correlated effects
  Gmat <- matrix(c(10, 7.071, 7.071, 5), 2, 2)
  cfx <- drfx(G = Gmat, fac = "Dam", dataf = warcolak[1:200, ])

Run the code above in your browser using DataLab