drfx {nadiv}R Documentation

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

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.

Value

fx

A matrix with 'd' columns of random effects

Z

A design matrix (of the format 'Matrix') from which the random effects in fx were assigned

Author(s)

matthewwolak@gmail.com

See Also

grfx

Examples


# 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, ])



[Package nadiv version 2.18.0 Index]