• Statistics for Human Genetics
  • 1 Preface
    • 1.1 Acknowledgements
    • 1.2 About the author
  • 2 New Intro
  • I Statistics and Programming
  • 3 Why we use statistics
  • 4 An introduction to R
    • 4.1 Installing R and Rstudio
    • 4.2 Using R as a calculator
    • 4.3 Using variables
    • 4.4 Bring some external data into R
    • 4.5 Analyze the data
    • 4.6 Making a plot
    • 4.7 Saving the plot and saving everything
    • 4.8 Keeping a record of everything using R markdown.
  • 5 Summary statistics
    • 5.1 Central tendency
      • 5.1.1 Mean
      • 5.1.2 Median
    • 5.2 Variability
      • 5.2.1 Variance
      • 5.2.2 Standard deviation
    • 5.3 Degrees of freedom
  • 6 Sampling from populations
    • 6.1 Sampling from populations
    • 6.2 Simulating a population of student heights
      • 6.2.1 Generate a histogram that summarizes the distribution of heights in the entire population.
      • 6.2.2 Simulating the process of sampling from a large population.
    • 6.3 Repeating the process of sampling over and over
    • 6.4 Exercises
  • 7 Statistical testing
  • II Part II: Mendelian Genetics
  • 8 The distribution of human phenotypes
    • 8.1 Human Phenotypes
      • 8.1.1 Binary traits
      • 8.1.2 Continuous traits
    • 8.2 The genetics of human phenotypes
  • 9 Mendel’s Experiments
    • 9.1 Mendel’s monohybrid crosses
    • 9.2 Some key terminology
  • 10 Mendel’s Model
    • 10.1 Mendel’s first law
    • 10.2 Mendel’s second law
    • 10.3 Probability
      • 10.3.1 Additive Law of Probability
      • 10.3.2 Multiplicative Law of Probability
  • 11 Chi squared test
    • 11.1 Chi-squared probability densities
    • 11.2 Chi-square cumulative probability distributions
    • 11.3 Assess results of mendel’s dihybrid cross using chi-square test statistic
    • 11.4 Assessing the results from the Bateson and Punnetts’s dihybrid cross using chi-square test statistic
      • 11.4.1 Log transformation
    • 11.5 Analysis of Bateson and Punnett’s data using internal R functions
  • 12 Mendelian inheritance in humans
    • 12.1 Five Basic Mendelian Patterns in Humans
      • 12.1.1 Autosomal
      • 12.1.2 Sex linked
      • 12.1.3 Special cases
    • 12.2 Variations on Mendelian Inheritance in Humans
      • 12.2.1 Incomplete Dominance
      • 12.2.2 Co-dominance
      • 12.2.3 Expressivity
      • 12.2.4 Penetrance
    • 12.3 Drawing pedigrees in R
  • 13 Pedigree analysis
    • 13.1 Human Pedigrees
    • 13.2 Drawing pedigrees in R
  • 14 The binomial distribution
    • 14.1 Combinations
    • 14.2 The binomial distribution
    • 14.3 Binomial probabilities and sample size
  • 15 The poisson distribution
  • 16 Likelihood
  • 17 LOD scores
    • 17.1 Phase known
    • 17.2 Phase unknown
  • 18 Conditional Probability
  • 19 Bayes Theorem
  • 20 Hardy Weinberg Equilibrium
  • 21 Inbreeding
  • 22 Genetic Drift
  • 23 Selection
  • 24 Genetic Diversity
  • III Part IV: Quantitative Genetics
  • 25 The normal distribution
    • 25.1 Many Human Phenotypes are normally distributed
  • 26 The normal distribution
  • 27 The t test
    • 27.1 One sample t test
    • 27.2 Exploring T-tests
    • 27.3 Produce the null distribution of the t statistic by simulation
  • 28 ANOVA: analysis of variance
    • 28.1 Performing ANOVA in R
    • 28.2 The F distribution
  • 29 Covariance and correlation
    • 29.1 Covariance
    • 29.2 Correlation
    • 29.3 Generaing simulated datasets
  • 30 Linear Regression
    • 30.1 Linear Regression in R
    • 30.2 Diagnostics
  • 31 Nonparametric methods
    • 31.1 The sign test.
    • 31.2 Performing sign tests in R
    • 31.3 A more interesting example.
    • 31.4 The Mann-Whitney test.
    • 31.5 Spearman (rank) correlation
      • 31.5.1 Comparing spearman and pearson correlation
  • IV Part V: Genomics
  • 32 Looking at all the genes
    • 32.1 How do we analyze thousands of genes
  • 33 Simulation
  • 34 Randomization
  • 35 Bootstrapping
  • 36 Statistical Power
    • 36.1 What is statistical power?
    • 36.2 Performing Power Analysis
  • 37 The Winner’s Curse
    • 37.1 Simulating the winners curse when using a t-test
  • References
  • Made using bookdown

Statistics for Human Genetics

Chapter 22 Genetic Drift

In this chapter we will examine the concept of genetic drift.

evo<-function(t,pop,ip){
pplot<-matrix(NA,t,10)
pplot[1,]<-ip

for (i in 1:10){
p<-ip
for (t in 2:t){
x<-rbinom(1,pop,p)
p<-x/pop
pplot[t,i]<-p}}
pplot
}

a<-evo(2000,10,0.5)
b<-evo(2000,100,0.5)
c<-evo(2000,1000,0.5)

par(mfrow=c(3,1))
t<-1:2000
matplot(t,a,type='l',main='Population size = 10',xlab='Time',ylab='Allele frequency', ylim=c(0,1))
matplot(t,b,type='l',main='Population size = 100',xlab='Time',ylab='Allele frequency', ylim=c(0,1))
matplot(t,c,type='l',main='Population size = 1000',xlab='Time',ylab='Allele frequency', ylim=c(0,1))