Exercise

Randomized data under null model of independence

The infer package will allow you to model a particular null hypothesis and then randomize the data to calculate permuted statistics. In this exercise, after specifying your null hypothesis you will permute the home ownership variable 10 times. By doing so, you will ensure that there is no relationship between home ownership and gender, so any difference in home ownership proportion for female versus male will be due only to natural variability.

This exercise will demonstrate the first three steps from the infer package:

  • specify will specify the response and explanatory variables.
  • hypothesize will declare the null hypothesis.
  • generate will generate resamples, permutations, or simulations.

The dplyr, ggplot2, NHANES, and infer packages have been loaded for you and the homes dataset you created in the last exercise is available in your workspace.

Instructions 1/3

undefined XP
    1
    2
    3
  • Using the infer framework, step through specifying the null model and then performing 10 permutations to evaluate whether home ownership status (i.e. HomeOwn) differs between the "female" and "male" groups:
    • specify that the relationship of interest is HomeOwn vs. Gender and a success in this context is homeownership, set success to "Own".