library(stats) # Section 2; Question 1: # source('chap_10_sect_2_question_1_data.R') print( dmultinom( c(0, 0, 1, 2, 3), prob=DF$Probability ) ) # Section 2; Question 2: # print( dmultinom( c(1, 1, 1, 1), prob=c( 9/16, 3/16, 3/16, 1/16 ) ) ) # Section 2; Question 3: # m = 124 s = 13.7 p1 = pnorm( (140-m)/s ) p2 = pnorm( (160-m)/s ) - p1 p3 = 1 - p2 - p1 prob = c( p1, p2, p3 ) print( prob ) print( dmultinom( c( 6, 3, 1 ), prob=prob ) ) # Section 2; Question 4: # m = 100 s = 16 p1 = pnorm( (90-m)/s ) p2 = pnorm( (110-m)/s ) - p1 p3 = 1 - p2 - p1 prob = c( p1, p2, p3) print( prob ) print( dmultinom( c( 2, 4, 1 ), prob=prob ) ) # Section 2; Question 5: # prob = c( 2/9, 5/18, 5/18, 2/9 ) print( dmultinom( c( 0, 2, 4, 0 ), prob=prob ) ) # Section 2; Question 6: # source('chap_10_sect_2_question_6_data.R') print( dmultinom( c(2, 2, 1, 0, 0), prob=DF$Probability ) ) # Section 2; Question 7: # n = 50 probs = c( 1, 7, 19, 37 )/64 print( n * probs[3] * ( 1 - probs[3] ) )