Chapter 3, Problem 1

From the data of parts (a) and (b) of Exercise 1 of Chapter 2, construct approximate 95% confidence intervals for the population total. Also construct approximate 95% confidence intervals for the population mean per unit. On what assumptions or results is the confidence interval procedure based, and how well does the method apply here?

Part a

# Data

y = c(0, 1, 1, 1, 1, 3, 1, 0, 4, 0)
N = 100
n = length(y)

#Estimated total population size
  tau = N*mean(y)

# Create 95% CIs for the population total
  
# Upper  
  tau + qt(0.975,df=n-1)*sqrt(N*(N-n)*(var(y)/n))
## [1] 209.348
# Lower
  tau + qt(0.025,df=n-1)*sqrt(N*(N-n)*(var(y)/n))
## [1] 30.65195
# Create 95% CIs for the population mean

# Upper limit
  mean(y) + qt(0.975,df=n-1) * sqrt(((N-n)/N)*(var(y)/n))
## [1] 2.09348
# Lower Limit
  mean(y) + qt(0.025,df=n-1) * sqrt(((N-n)/N)*(var(y)/n))
## [1] 0.3065195

Part b

# Data
  y <- c(1, 0, 1, 1, 3, 1, 1, 0, 2, 2)
  N = 100
  n = length(y)

#Estimated total population size
  tau = N*mean(y)

# Create 95% CIs for the population total
  
# Upper  
  tau + qt(0.975,df=n-1)*sqrt(N*(N-n)*(var(y)/n))
## [1] 182.3634
# Lower
  tau + qt(0.025,df=n-1)*sqrt(N*(N-n)*(var(y)/n))
## [1] 57.63663
# Create 95% CIs for the population mean

# Upper limit
  mean(y) + qt(0.975,df=n-1) * sqrt(((N-n)/N)*(var(y)/n))
## [1] 1.823634
# Lower Limit
  mean(y) + qt(0.025,df=n-1) * sqrt(((N-n)/N)*(var(y)/n))
## [1] 0.5763663