Population:
Statistical Population:
Here is example code for the case where we know that Toyota Tacoma’s are assembled in San Antionio, Texas and Baja California, Mexico. Let’s suppose that 13% are assembled in Baja California and the other 87% in San Antonio. We are asked to evaluate an issue with the alignment of the headlights as they come off the assembly line. Headquarters is investigating this issue after varied dealers receiving cars from both plants haver reported customer complaints. On any given day 690 cars are assembled in total.
# For a given day we could randomly select the day of the week. After the day of the week is settled we could use
tacoma_day = c(rep("San Antonio",600),c(rep("Baja",90)))
random_picks = sample(690,100)
table(tacoma_day[random_picks])
##
## Baja San Antonio
## 11 89
# the random_picks could the specific car order.
# For a given week we would just use the same code with 7*690
# For a stratified sample there a few ways this could be done. One example is
tacoma_sa = sample(600,100*.87)
tacoma_baja = sample(90,100*.13)