- Using R Randomization Test -
"When waiting to get someone's parking space, have you everthought that the driver you are waiting for is taking longer thannecessary? Ruback and Juieng (1997) ran a simple experiment toexamine that question. They hung out in parking lots and recordedthe time that it took for a car to leave a parking place. Theybroke the data down on the basis of whether or not someone inanother car was waiting for the space.
The data are positively skewed, because a driver can safelyleave a space only so quickly, but, as we all know, they cansometimes take a very long time. But because the data are skewed,we might feel distinctly uncomfortable using a parametric t test.So we will adopt a randomization test."
```{r}
# no waiting records the time it took a driver to leave the parkingspot if no one was waiting for the driver
no_waiting <- c(36.30, 42.07, 39.97, 39.33, 33.76, 33.91, 39.65,84.92, 40.70, 39.65,
39.48, 35.38, 75.07, 36.46, 38.73, 33.88, 34.39, 60.52, 53.63,50.62)
# waiting records the time it takes a driver to leave if someonewas waiting on the driver
waiting <- c(49.48, 43.30, 85.97, 46.92, 49.18, 79.30, 47.35,46.52, 59.68, 42.89,
49.29, 68.69, 41.61, 46.81, 43.75, 46.55, 42.33, 71.48, 78.95,42.06)
mean(waiting)
mean(no_waiting)
obs_dif <- mean(waiting) - mean(no_waiting)
```
Conduct a randomization test to test the hypothesis that thereis no difference in average time for drivers who have a personwaiting vs those who do not have a person waiting, against thealternative that drivers who have a person waiting will take*longer* than if they did not.
Be sure to calculate an empirical p-value and make theappropriate conclusion.