Learn R Programming

epinetr (version 0.96)

getAddOffset: Retrieve additive offset.

Description

Retrieve offset used for calculating additive component.

Usage

getAddOffset(pop)

Arguments

pop

A valid Population object with additive effects attached

Value

The additive offset is returned.

Details

In order for the initial population to have an additive component with a mean of 0 for its phenotype, an offset is added, and it remains fixed across generations. This function retrieves that offset.

See Also

getAddCoefs, addEffects

Examples

Run this code
# NOT RUN {
# Construct a new population with additive effects
pop <- Population(
  popSize = 20, map = map100snp, QTL = 20,
  broadH2 = 0.4, narrowh2 = 0.4, traitVar = 40,
  alleleFrequencies = runif(100, 0.05, 0.5)
)
pop <- addEffects(pop)

# Find the additive contribution to the individuals' phenotypes
hap <- getHaplo(pop)
hap <- (hap[[1]] + hap[[2]])[, getQTL(pop)$Index]
(hap %*% getAddCoefs(pop))[, 1] + getAddOffset(pop)

# Compare with additive component from getComponents()
getComponents(pop)$Additive
# }

Run the code above in your browser using DataLab