SimParam_rescaleTraits {AlphaSimR}R Documentation

Rescale traits

Description

Linearly scales all traits to achieve desired values of means and variances in the founder population.

Arguments

mean

a vector of new trait means

var

a vector of new trait variances

varEnv

a vector of new environmental variances

varGxE

a vector of new GxE variances

useVarA

tune according to additive genetic variance if true

Usage

SP$rescaleTraits(mean = 0, var = 1, relAA = 1e-6, varEnv = 0, varGxE = 1e-6, useVarA = TRUE)

Note

By default the founder population is the population used to initalize the SimParam object. This population can be changed using the switchFounderPop function in the SimParam object (see SimParam_switchFounderPop). You must run resetPop on existing populations to obtain the new trait values.

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)
meanG(pop)

#Change mean to 1
SP$rescaleTraits(mean=1)
#Run resetPop for change to take effect
pop = resetPop(pop, simParam=SP) 
meanG(pop)


[Package AlphaSimR version 0.10.0 Index]