Chapter 13, Problem 1

You are interested in estimating the population size of ringtails (https://en.wikipedia.org/wiki/Ringtail) across 10 areas that can be split each into six areas. In other words, there is a population of 10 primary units, each of which consists of Mi = 6 secondary units. A two-stage sampling design selects 2 primary units by simple random sampling (without replacement) and 3 secondary units from each selected primary unit, also by simple random sampling. The observed values of counts of ringtails within the secondary units are 7, 5, 3 from the first primary unit selected and 4, 2, 3 from the second primary unit selected.

a) Estimate the population total (\(\tau\)) and mean per primary unit

N = 10 # Total Primary Units
n = 2  # sampled primary units
M = 6  # Total secondary units per primary unit
m = 3  # Sampled secondary units per primary

# Data for primary unit 1
y1 = c(7,5,3)

# Data for primary unit 2
y2 = c(4,2,3)

#Estimate the total of each primary unit
 sample.total.1 = M/m*sum(y1)
 sample.total.1
## [1] 30
 sample.total.2 = M/m*sum(y2)
 sample.total.2
## [1] 18
# Estimate the population total

tau.hat = (N/n)*(sample.total.1+sample.total.2)
tau.hat
## [1] 240
# Mean per primary unit

mu.primary =tau.hat/N

b) Estimate the variance of the total population size (\(\tau\))

# Sample variance between primary units

s2.between = 1/(n-1)*((sample.total.1-mu.primary)^2+(sample.total.1-mu.primary)^2)

s2.within.1 = 1/(m-1)*sum((y1-mean(y1))^2)
s2.within.2 = 1/(m-1)*sum((y2-mean(y2))^2)

var.tau = N*(N-n)*(s2.between/n)  + (N/n)*(  M*(M-m)*(s2.within.1/m)  +  M*(M-m)*(s2.within.2/m) )

var.tau
## [1] 3030