Worksheet 06: Analysis of One and Two stage Cluster Sampling using R

Worksheet
Published

April 20, 2023

1. High school Algebra

Consider a population of 187 high school algebra classes in a city. An investigator takes an SRS of classes, and gives each student in the sampled classes a test about function knowledge. The (hypothetical) data are given in the file algebra.csv.

  1. Load in the data and look at the first few rows. Explain what the values in each column mean.
  2. Plot the distribution of test score by class. Interpret your graph by comparing the medians, ranges, and variances across classes. What do you notice?
  3. How many psus are there? What is the psu with the highest number of ssus? Which one has the least? You must answer this question using R functions such asunique or table. Don’t count this by hand (practice for when you have a billion rows)
  4. Add variables containing the weights and the fpc to this data set. Assign the value of 187 to a new variable for the fpc.
  5. Using the proper functions from the survey package, estimate the population average algebra score, with a 95% interval and interpret your interval. Be sure to NOT assume a Z-distribution for this confidence interval but use the degf function to get the proper degrees of freedom out of the survey design object and pass it to the confint function.

2. Reading level across a different school district.

The file schools.csv contains data from a two-stage sample of students from hypothetical classes. The final weights are provided in the variable finalwt.

  1. Create side by side boxplots for the reading score for sampled schools. Which do you think is larger, the within or between cluster variance?
  2. Create an ANOVA table for this example. Is your interpretation from the graph upheld by this analysis?
  3. Estimate with proper 95% CI the average reading score for the population of students under consideration. Do not include a value for the fpc in this example.