Statistics for laboratory scientists II

Solutions for the homework problems for lecture 1

  1. We have nA=78 and nB=22. We test that pA=0.75.

    Typing either

      round(binom.test(78, 100, 0.75)$p.value, 2)
    or
      1 - pbinom(77, 100, 0.75) + pbinom(75-3, 100, 0.75)
    returns 0.56 as a p-value.

  • We have the data nAA=35, nAB=43, nBB=22. We test that (pAA, pAB, pBB)=(0.25,0.5,0.25).

    1. Typing
        f <- c(25,50,25)
        fhat <- c(35,43,22)
        lnL <- sum(fhat*log(fhat/f))
        G <- 2*lnL
        round(1-pchisq(G,2),3)
      
      yields a p-value of 0.084.

    2. Typing
        round(1-pchisq(sum((f-fhat)^2/f),2),3)
      
      or
        chisq.test(c(35,43,22),p=c(0.25,0.5,0.25))
      yields a p-value of 0.069.

    [ Main page | 4th term syllabus | R for Windows ]

    Last modified: Tue Mar 28 17:52:38 EST 2006