save_figs = FALSE N = 10 r = 0.95 s2 = 0.0385348 # from the previous exercise f_crit = qf(1-0.05, 2, 7) se_beta_hat= 0.628672 t_crit = qt(1-0.05/2, N-1) beta_1_grid = seq( -3, +3, length.out=50 ) # x beta_2_grid = seq( -2, +2, length.out=70 ) # y LHS = outer(beta_1_grid^2, beta_2_grid^2, '+') + 2*r*outer(beta_1_grid, beta_2_grid, '*') RHS = 2*s2*f_crit if( save_figs ){ postscript("../../WriteUp/Graphics/Chapter5/ex_5_2_beta_region.eps", onefile=FALSE, horizontal=FALSE) } contour(beta_1_grid, beta_2_grid, LHS, levels=RHS, xlab='beta_1_hat', ylab='beta_2_hat') grid() points( x=1.118, y=-0.28, cex=1.5, pch=19 ) # the location of the estimate beta_hat rect( -se_beta_hat*t_crit, -se_beta_hat*t_crit, +se_beta_hat*t_crit, +se_beta_hat*t_crit ) if( save_figs ){ dev.off() }