Goal: Practice estimation and the bootstrap.

Use the Labour Fource Survey (LFS) data for Toronto.

lfs = read_csv('./data/LFS_Toronto.csv') 
  1. Give point estimates of the unemployment rate broken down by education level (variable educ; see codebook ). The answer should give an unemployment rate for each education level.

  2. Use the infer package to generate 500 bootstrap samples for the BSc education level (educ == 5), and calculate their unemployment rate.

  3. Use your boostrap samples to create a histogram of the sampling distribution of the BSc-level unemployment rate. Overlay the value of the point estimate as a vertical line (geom_vline()).

4.Use your boostrap samples to create a quantile-based 90% confidence interval for the BSc unemployment rate.

  1. Going back to the original LFS data, focus on currently working individuals (lfsstat == 1) with a BSc degree (educ == 5), and estimate the BSc-level average hourly earnings (hrlyearn) for each sex (1=MALE, 2=FEMALE). Note that there are missing values (NA) in earnings, which you can remove from your analysis. What is a potential sampling problem with the missing values?

  2. Assume you wanted to create a bootstrap CI around each mean hourly earnings. Would you resample from each sex separately, or from both sexes combined? Justify your answer.

  3. Use bootstrap sampling with 500 iterations for each sex separately, to create standard error-based 95% CI’s for the mean hourly earnings.

  4. [EXTRA] The final weight variable (fweight) provides a number corresponding to the size of the population represented by that particular observation. E.g. if you were randomly sampling 20 observations from a population of size 1,000, each observation would receive an equal weight of 50 (=1,000/20). Differences in fweight reflect varying coverage of different geographic areas in the survey.
    Estimate the total number of working individuals (lfsstat==1) in the month of Nov. 2018 (survmnth==11) for different education levels, by summing up their fweight values. Plot your estimates in a barplot like the one below:

LS0tDQp0aXRsZTogIlNUQUE1NyAtIFdvcmtTaGVldCAxMCINCmF1dGhvcjogJ05hbWU6ICAgICwgSUQjOiAgICcNCm91dHB1dDogaHRtbF9ub3RlYm9vaw0KZWRpdG9yX29wdGlvbnM6IA0KICBjaHVua19vdXRwdXRfdHlwZTogaW5saW5lDQotLS0NCg0KKioqDQoNCioqR29hbCoqOiBQcmFjdGljZSBlc3RpbWF0aW9uIGFuZCB0aGUgYm9vdHN0cmFwLg0KDQpgYGB7ciwgaW5jbHVkZT1GQUxTRX0NCmxpYnJhcnkodGlk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