simulTraits12: Simul breeding game

View source: R/breeding_game.R

simulTraits12R Documentation

Simul breeding game

Description

Simulate phenotypes of traits 1 and 2 jointly: Y = Z.J * Alpha + Z.I * G.A + E.

Usage

simulTraits12(
  dat,
  mu = c(trait1 = 100, trait2 = 15),
  sigma.alpha2 = c(trait1 = 230, trait2 = 10),
  Alpha = NULL,
  X,
  afs,
  Beta,
  h2 = NULL,
  sigma2 = c(trait1 = 330, trait2 = 0.6),
  cor.E.inter.trait = 0,
  set.neg.to.zero = TRUE,
  verbose = 1
)

Arguments

dat

data.frame specifying the structure of the initial data set of phenotypes, with columns "ind", "year", etc

mu

vector of global means, for each trait

sigma.alpha2

vector of variance for the "year" effects, for each trait (ignored if Alpha is not NULL)

Alpha

matrix of "year" effects, for each trait, the years corresponding to those indicated in dat (if NULL, will be simulated using sigma.alpha2)

X

matrix of bi-allelic SNP genotypes encoded in allele dose in 0,1,2, with individuals in rows in the same order as the levels of dat$ind

afs

vector of allele frequencies (to center X so that the genotypic values are also centered) which names are the SNPs

Beta

matrix of additive SNP effects, for each trait

h2

vector of heritabilities, with the name of each trait, for instance c(trait1=0.3, trait2=0.4) (if NULL, sigma2 will be used, but do not specify both)

sigma2

vector of error variances, with the name of each trait, for instance c(trait1=0.467, trait2=0.210) (if NULL, h2 will be used, but do not specify both)

cor.E.inter.trait

correlation of errors between both traits

set.neg.to.zero

if TRUE, the negative phenotypic values, if any, will be set to zero

verbose

verbosity level (0/1)

Value

list

Author(s)

Timothee Flutre

See Also

simulSnpEffectsTraits12, makeDfInitPhenos

Examples

## Not run: set.seed(1859)
X <- simulGenosDose(nb.genos=825, nb.snps=2000)
snp.effects12 <- simulSnpEffectsTraits12(snp.ids=colnames(X))
dat <- makeDfInitPhenos(line.ids=rownames(X))
phenos <- simulTraits12(dat, X=X, Beta=snp.effects12$Beta)
regplot(phenos$G.A[,1], phenos$G.A[,2])

## End(Not run)

timflutre/rutilstimflutre documentation built on Feb. 7, 2024, 8:17 a.m.