# Section 2; Question 3: # data = c( 8.2, 9.1, 10.6, 4.9 ) print( 1/mean(data) ) # Section 2; Question 5: # data = c( 2.3, 1.9, 4.6 ) print( mean(data)/4 ) # Section 2; Question 6: # data = c( 6.2, 7.0, 2.5, 4.2 ) print( 1 / mean(sqrt(data)) ) # Section 2; Question 7: # data = c( 0.77, 0.82, 0.92, 0.94, 0.98 ) print( -1 / mean(log(data)) ) # Section 2; Question 8: # n = 1011 p = n / ( 1*(678) + 2*(227) + 3*(56) + 4*(28) + 5*(8) + 6*(14) ) print( p ) ks = 1:6 print( n * p * (1-p)^(ks-1) ) # expected frequencies # Section 2; Question 9: # n = ( 6 + 19 + 12 + 13 + 9 ) lam = ( 6*(0) + 19*(1) + 12*(2) + 13*(3) + 9*(4) ) / n print( lam ) pt_1 = dpois( 0:3, lam ) pt_2 = 1-ppois( 3, lam ) print( round( n * c( pt_1, pt_2 ), 1 ) ) # Section 2; Question 16: # data = c( 17, 92, 46, 39, 56 ) print( 3*mean(data)/2 ) # Section 2; Question 25: # n = 250 p = n / ( 1*(132) + 2*(52) + 3*(34) + 4*(9) + 5*(7) + 6*(5) + 7*(5) + 8*(6) ) print( p ) ks = 1:8 print( round( n * p * (1-p)^(ks-1), 2 ) ) # expected frequencies (need to put sum_{k >= 8} all into last bucket)