Exercise

Inference with and without outlier (randomization)

Using the randomization test, you can again evaluate the effect of an outlier on the inferential conclusions of a linear model. Run a randomization test on the hypdata_out data twice: once with the outlying value and once without it. Note that the extended lines of code communicate clearly the steps of the randomization tests.

Instructions

100 XP

Using the data frames hypdata_out (containing an outlier) and hypdata_noout (outlier removed), the data frames perm_slope_out and perm_slope_noout were created to contain the permuted slopes the original datasets, respectively. The observed values are stored in the variables obs_slope_out and obs_slope_noout.

  • Find the p-values by finding the proportion of ( absolute value) permuted slopes which are larger than or equal to the ( absolute value of the) observed slopes. As before, use mean on the binary inequality to find the proportion.