# # 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. # # Computations used for the problems in this section of the text. # #----- save_plots = F # Ex 6.21 # 28^2 / ( 16500 / 20 ) alpha = 1 / 0.2 beta = 28 / gamma( 1 + 1/alpha ) # Ex 6.22 # data = c( .92, .79, .90, .65, .86, .47, .73, .97, .94, .77 ) x_bar = mean( data ) ( 1 - 2 * x_bar ) / ( x_bar - 1 ) -1 - 1 / mean( log( data ) ) # Ex 6.25 # data = c( 392, 376, 401, 367, 389, 362, 409, 415, 358, 375 ) m = mean( data ) s = sqrt( sum( ( data - m )^2 ) / length(data) ) z_crit = qnorm( 1-0.05 ) m + z_crit * s # Ex 6.26 # pnorm( (400-m)/s ) # Ex 6.29 # data = c( 3.11, .64, 2.55, 2.20, 5.44, 3.42, 10.39, 8.93, 17.82, 1.30 ) # the ML estimates: # theta_ML = min( data ) lambda_ML = 1 / ( mean(data) - theta_ML ) # Ex 6.33 EPage 252 # data = c( 25.2, 41.7, 51.2, 55.5, 59.5, 61.8 ) data = c( 0, data ) 1 / mean( diff( data ) * (1:(length(data)-1)) ) # Ex 6.35 # DF = read.csv( "../../Data/CH01/ex01-44.txt", header=TRUE, quote="'" ) X = DF$O2_consump pairwise_averages = outer( X, X, FUN="+" )/2 UT_mask = upper.tri( pairwise_averages, diag=TRUE ) median( pairwise_averages[ UT_mask ] ) # Ex 6 36 # DF = read.csv( "../../Data/CH06/exp06-02.txt", header=TRUE, quote="'" ) X = DF$voltage x_tilde = median( X ) median( abs( X - x_tilde ) ) / 0.6745 sd( X ) # EX 6.37 # n = 20 numer = gamma( (n-1)/2 ) denom = gamma( n/2 ) * sqrt( 2 / (n-1) ) numer / denom