Learn R Programming

AlphaSimR (version 0.10.0)

setPheno: Set phenotypes

Description

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

Usage

setPheno(pop, varE = NULL, reps = 1, fixEff = 1L, p = 0.5,
  onlyPheno = FALSE, simParam = NULL)

Arguments

pop

an object of Pop-class or HybridPop-class

varE

error variances for phenotype. A vector of length nTraits for independent error or a square matrix of dimensions nTraits for correlated errors. If NULL, value in simParam is used.

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.

onlyPheno

should only the phenotype be returned, see return

simParam

an object of SimParam

Value

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

Details

The reps parameter is for convient 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 entry means.

Examples

Run this code
# NOT RUN {
#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)

# }

Run the code above in your browser using DataLab