Session Ready
Exercise

Randomized statistics and dotplot

By permuting the home ownership variable multiple times, you generate differences in proportions that are consistent with the assumption that the variables are unrelated. The statistic of interest is the difference in proportions given by stat = "diff in props". After calculating the randomized statistics, you will plot them in a dotplot.

This exercise shows all four 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.
  • calculate will calculate summary statistics.

Each step will be covered throughout the course; in this exercise you'll write code for calculate().

The dplyr, ggplot2, NHANES, and infer packages have been loaded for you. Repeat the permuting and plotting with 100 differences in proportions generated by shuffling the HomeOwn variable.

Instructions 1/2
undefined XP
  • 1
  • 2
  • Using the infer framework, step through specifying the null model and then performing 100 permutations to evaluate whether home ownership status (i.e. HomeOwn) differs between the "female" and "male" groups:
    • specify(), hypothesize(), and generate() have been done for you.
    • calculate() the statistic "diff in props" with the order of c("male", "female").