Results for Additional Exercise 2 for Session 2. pnorm(-qnorm(.975)+sqrt(15/2)*1/1) pt(qt(.975,28),df=28,ncp=sqrt(15/2)*1/1,lower.tail=FALSE) library(MASS) # reproduces the values in the table on p. 29 (compound symmetry (rho)) x <- matrix(c(1,1,1,0,2,5),nrow=2,ncol=3,byrow=TRUE) n.list <- c() for (i in 0:2) { r <- 0.2+0.3*i e <- ginv(x%*%ginv(matrix(c(1,r,r,r,1,r,r,r,1),nrow=3,ncol=3))%*%t(x))[2,2] for (j in 1:3) { s2 <- j*100 n.list <- c(n.list,2*(qnorm(.05)+qnorm(.2))^2*e*s2/.5^2) } } n.list [1] 312.38184 624.76368 937.14552 195.23865 390.47730 585.71595 78.09546 156.19092 234.28638 # table for 1st order autoregressive (rho) n.list <- c() for (i in 0:2) { r <- 0.2+0.3*i e <- ginv(x%*%ginv(matrix(c(1,r,r^2,r,1,r,r^2,r,1),nrow=3,ncol=3))%*%t(x))[2,2] for (j in 1:3) { s2 <- j*100 n.list <- c(n.list,2*(qnorm(.05)+qnorm(.2))^2*e*s2/.5^2) } } n.list [1] 373.4542 746.9085 1120.3627 289.8074 579.6147 869.4221 137.9320 275.8640 413.7959 # reproduces the values in the table on p. 30 (compound symmetry (rho)) x <- rep(c(1),3) n.list <- c() for (i in 0:2) { r <- 0.2+0.3*i e <- t(x)%*%ginv(matrix(c(1,r,r,r,1,r,r,r,1),nrow=3,ncol=3))%*%x for (j in 0:3) { d <- (20+j*10)/100 n.list <- c(n.list,2*(qnorm(.05)+qnorm(.2))^2/d^2/e) } } n.list [1] 144.25967 64.11541 36.06492 23.08155 206.08524 91.59344 51.52131 32.97364 267.91081 119.07147 66.97770 42.86573 # table for 1st order autoregressive (rho) x <- rep(c(1),3) n.list <- c() for (i in 0:2) { r <- 0.2+0.3*i e <- t(x)%*%ginv(matrix(c(1,r,r^2,r,1,r,r^2,r,1),nrow=3,ncol=3))%*%x for (j in 0:3) { d <- (20+j*10)/100 n.list <- c(n.list,2*(qnorm(.05)+qnorm(.2))^2/d^2/e) } } n.list [1] 132.48337 58.88150 33.12084 21.19734 185.47672 82.43410 46.36918 29.67627 252.92280 112.41013 63.23070 40.46765