twopq: Calculate binomial variance 2p(1-p)

Description Usage Arguments Value Author(s) Examples

View source: R/transform.R

Description

Convenience function to calculate variance of a binomial variable with n=2 and p=p, equal to the variance of coded genotype under an additive genetic model and Hardy-Weinberg proportions.

Usage

1
twopq(p)

Arguments

p

a vector of allele frequencies

Value

The vector of binomial variances, 2p(1-p).

Author(s)

Toby Johnson Toby.x.Johnson@gsk.com

Examples

1
2
  MAF <- rbeta(100, shape1 = 0.6, shape2 = 1)
  plot(MAF, twopq(MAF), xlim = c(0, 1), ylim = c(0, 0.5))

tobyjohnson/gtx documentation built on Aug. 30, 2019, 8:07 p.m.