# # Written by: # -- # John L. Weatherwax 2009-04-21 # # email: wax@alum.mit.edu # # Please send comments and especially bug reports to the # above email address. # #----- # Ex 6.12: tv_in = c( 35, 6, 18, 25, 37, 48, 49, 53, 81, 89 ) direct_in = c( 34, 57, 9, 64, 61, 75, 91, 100, 98, 93 ) print( tv_in - direct_in ) print( pbinom( 2, 10, 0.5 ) ) print( sum( c(2, 4, 5, 6, 7, 8, 9, 10 ) ) ) print( 7 / 2^10 ) # Ex 6.14: print( 99 / 2^8 ) # Ex 6.17: ks = 1:4 print( pbinom( ks, 2*ks, 1/2 ) ) print( c(2, 7, 54, 207)/2^( c(2, 4, 6, 8) ) ) # Ex 6.18: ns = c(60, 80, 100) ks = ns/2 E_V = ns * (ns+1) / 4 Std_V = sqrt( ns * (ns+1) * (2*ns+1) / 24 ) v_minus = ks^2 print( pnorm( ( v_minus + 0.5 - E_V ) / Std_V ) ) # Ex 6.22: tv_in = c( 3, 6, 18, 25, 37, 48, 49, 53, 81, 89 ) direct_in = c( 9, 34, 57, 61, 64, 75, 91, 93, 98, 100 ) print( tv_in - direct_in )