Multivariate simulation for a breeding program

13/01/2009

The core of multivariate simulation for a breeding program is the generation of observations that follow a given covariance matrix V. Using Cholesky decomposition (so V = C`C) one can easily generate the desired distribution. I use the R core.sim function as the basic building block for creating base populations, and progeny tests.

# core.sim generates n.obs observations, which follow a
# n.vars multivariate normal distribution with mean 0
# and variance C`C. That is, it takes the Cholesky
# decomposition C of a covariance matrix as argument.
# This function is used by all base population and progeny 
# testing functions.
core.sim <- function(C, n.obs, n.vars){
	N <- matrix(data = rnorm(n.obs*n.vars), 
	            nrow = n.vars, ncol = n.obs)
	S <- t(C %*% N)
	return(S)
	}

R syntax highlighting courtesy of the WP-syntax plugin (an interface to GEshi).

Filed in research, software, statistics

No comments yet.

Write a comment: