setPheno {AlphaSimR}R Documentation

Set phenotypes

Description

Sets phenotypes for all traits by adding random error from a multivariate normal distribution.

Usage

setPheno(
  pop,
  h2 = NULL,
  H2 = NULL,
  varE = NULL,
  corE = NULL,
  reps = 1,
  fixEff = 1L,
  p = NULL,
  onlyPheno = FALSE,
  traits = NULL,
  simParam = NULL
)

Arguments

pop

an object of Pop-class or HybridPop-class

h2

a vector of desired narrow-sense heritabilities for each trait. See details.

H2

a vector of desired broad-sense heritabilities for each trait. See details.

varE

error (co)variances for traits. See details.

corE

an optional matrix for correlations between errors. See details.

reps

number of replications for phenotype. See details.

fixEff

fixed effect to assign to the population. Used by genomic selection models only.

p

the p-value for the environmental covariate used by GxE traits. If NULL, a value is sampled at random.

onlyPheno

should only the phenotype be returned, see return

traits

an integer vector indicate which traits to set. If NULL, all traits will be set.

simParam

an object of SimParam

Details

There are three arguments for setting the error variance of a phenotype: h2, H2, and varE. The user should only use one of these arguments. If the user supplies values for more than one, only one will be used according to order in which they are listed above.

The h2 argument allows the user to specify the error variance according to narrow-sense heritability. This calculation uses the additive genetic variance and total genetic variance in the founder population. Thus, the heritability relates to the founder population and not the current population.

The H2 argument allows the user to specify the error variance according to broad-sense heritability. This calculation uses the total genetic variance in the founder population. Thus, the heritability relates to the founder population and not the current population.

The varE argument allows the user to specify the error variance directly. The user may supply a vector describing the error variance for each trait or supply a matrix that specify the covariance of the errors.

The corE argument allows the user to specify correlations for the error covariance matrix. These correlations are be supplied in addition to the h2, H2, or varE arguments. These correlations will be used to construct a covariance matrix from a vector of variances. If the user supplied a covariance matrix to varE, these correlations will supercede values provided in that matrix.

The reps parameter is for convenient representation of replicated data. It is intended to represent replicated yield trials in plant breeding programs. In this case, varE is set to the plot error and reps is set to the number of plots per entry. The resulting phenotype represents the entry-means.

Value

Returns an object of Pop-class or HybridPop-class if onlyPheno=FALSE, if onlyPheno=TRUE a matrix is returned

Examples

#Create founder haplotypes
founderPop = quickHaplo(nInd=10, nChr=1, segSites=10)

#Set simulation parameters
SP = SimParam$new(founderPop)
SP$addTraitA(10)

#Create population
pop = newPop(founderPop, simParam=SP)

#Add phenotype with error variance of 1
pop = setPheno(pop, varE=1)


[Package AlphaSimR version 1.3.2 Index]