Friday, September 10, 2010

standard deviation given MAF using Hardy Weinberg Equilibrium

## compute variance of X with maf
## assuming Hardy Weinberg equilibrium

funvarx = function(maf)
  {
    paa = maf^2
    pAA = (1-maf)^2
    pq2 = 2*maf*(1-maf)
    
    varx = pAA*(1-pAA) + paa*(1-paa) + 2*pAA*paa

    return(varx)
  }
funsdx = function(maf) return(sqrt(funvarx(maf)))

maf = 0.25
fundsdx(maf)

No comments:

Post a Comment

Subscribe via email

Enter your email address:

Delivered by FeedBurner

Followers

Blog Archive

google analytics