getError: Get residuals coming from a given distribution

Description Usage Arguments Examples

View source: R/getError.R

Description

Get residuals coming from a distribution with a given set of parameters

Usage

1
getError(H2, freqs, means, ninds)

Arguments

H2

Heritability

freqs

Allele frequencies

means

Phenotype means per genotype

ninds

Number of individuals

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (H2, freqs, means, ninds) 
{
    if (length(freqs) < 3) {
        freqs[3] <- 0
    }
    VG <- freqs[1] * (means[1])^2 + freqs[2] * (means[2])^2 + 
        freqs[3] * (means[3])^2
    sigmaSq <- (VG - H2 * VG)/H2
    error <- rnorm(ninds, 0, sqrt(sigmaSq))
  }

AcceptABEL documentation built on May 31, 2017, 3:27 a.m.