## Run flight model
## source("http://web.as.uky.edu/statistics/users/pbreheny/701/S13/notes/4-2a.R")

## Finite-population standard deviatons
s <- cbind(apply(a, 1, function(x) sqrt(mean((x-mean(x))^2))),
           apply(b, 1, function(x) sqrt(mean((x-mean(x))^2))))
B1 <- psm(s)
B2 <- psm(sigma)[2:3,]
rownames(B1) <- rownames(B2) <- c("a", "b")

CIplot(B1, xlab="", labels=c("", ""), mar=c(5, 1.5, 0, 1), xlim=c(0,1))
text(-0.05, 2, ~s[alpha], xpd=TRUE)
text(-0.05, 1, ~s[beta], xpd=TRUE)

CIplot(B2, xlab="", labels=c("", ""), mar=c(5, 1.5, 0, 1), xlim=c(0,1))
text(-0.05, 2, ~sigma[alpha], xpd=TRUE)
text(-0.05, 1, ~sigma[beta], xpd=TRUE)

## Finite population/superpopulation for mu
abar <- apply(a, 1, mean)
bbar <- apply(b, 1, mean)
psm(mu)
psm(mu+bbar)
psm(mu+abar+bbar)
