Question

In: Math

- Using R Randomization Test - "When waiting to get someone's parking space, have you ever...

- Using R Randomization Test -

"When waiting to get someone's parking space, have you ever thought that the driver you are waiting for is taking longer than necessary? Ruback and Juieng (1997) ran a simple experiment to examine that question. They hung out in parking lots and recorded the time that it took for a car to leave a parking place. They broke the data down on the basis of whether or not someone in another car was waiting for the space.

The data are positively skewed, because a driver can safely leave a space only so quickly, but, as we all know, they can sometimes 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 parking spot 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 someone was 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 there is no difference in average time for drivers who have a person waiting vs those who do not have a person waiting, against the alternative 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 the appropriate conclusion.

Solutions

Expert Solution

Here to test the difference in average time for drivers, we use Two-sample t-test.

Here, the hypothesis is: H0: µ1=µ2 v/s H1: µ1≠µ2   

  

output of the test: (R-output)

> 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)

> no_waiting

[1] 36.30 42.07 39.97 39.33 33.76 33.91 39.65 84.92 40.70 39.65 39.48

[12] 35.38 75.07 36.46 38.73 33.88 34.39 60.52 53.63 50.62

> 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)

> waiting

[1] 49.48 43.30 85.97 46.92 49.18 79.30 47.35 46.52 59.68 42.89 49.29

[12] 68.69 41.61 46.81 43.75 46.55 42.33 71.48 78.95 42.06

> mean(waiting)

[1] 54.1055

> mean(no_waiting)

[1] 44.421

> obs_dif <- mean(waiting) - mean(no_waiting)

> obs_dif

[1] 9.6845

> t.test(waiting,no_waiting)

Welch Two Sample t-test

data: waiting and no_waiting

t = 2.1496, df = 37.984, p-value = 0.03802

alternative hypothesis: true difference in means is not equal to 0

95 percent confidence interval:

0.5639702 18.8050298

sample estimates:

mean of x mean of y

54.1055 44.4210

this is the output of given data-set.

conclusion:

Here, the p-value=0.0382 if we consider at 5% level of significance then, in this case, p-value(0.0382) is less than 0.05(level of significance) and we reject the null hypothesis.


Related Solutions

Have you ever had to deal with a virus? What steps did you take to get...
Have you ever had to deal with a virus? What steps did you take to get rid of the virus? Could you have avoided infection in the first place? What did you learn from the experience?
can you think of a time when you satisfied when making a decision? have you ever...
can you think of a time when you satisfied when making a decision? have you ever suboptimized?
Have you ever noticed that, when you tear a fingernail, it tends to tear to the...
Have you ever noticed that, when you tear a fingernail, it tends to tear to the side and not down into the finger? (Actually, the latter doesn’t bear too much thinking about.). Why might this be so? One possibility is that fingernails are tougher in one direction than another. A study of the toughness of human fingernails compared the toughness of nails along a transverse dimension (side to side) compared with a longitudinal direction, with 15 measurements of each (Farren...
Have you ever tried to get out of jury duty? About 25% of those called will...
Have you ever tried to get out of jury duty? About 25% of those called will find an excuse (work, poor health, travel out of town, etc.) to avoid jury duty.† (a) If 11 people are called for jury duty, what is the probability that all 11 will be available to serve on the jury? (Round your answer to three decimal places.) (b) If 11 people are called for jury duty, what is the probability that 5 or more will...
Calcucate the factor of production for car parking space using a table. Question: Calcuate Fixed cost,...
Calcucate the factor of production for car parking space using a table. Question: Calcuate Fixed cost, Variable cost and total cost.
How does the term 'Mock" fit with testing in software engineering? When someone's test doesn't pass...
How does the term 'Mock" fit with testing in software engineering? When someone's test doesn't pass we mock them until they cry. A mock is an object used to replace a dependency so a function can be tested Mocks are used to replace a function in our code during testing A mock is a simulation of the entire application What are the benefits of testing code? Testing cuts downtime in debugging and rewriting code. Testing allows even bad code to...
When conducting a two sample t-test using R, which of the following is not a possible...
When conducting a two sample t-test using R, which of the following is not a possible alternative hypothesis? A. true difference in means is not equal to zero B. true difference in means is greater than zero C. true difference in means is less than zero D. true difference in means is equal to zero
Have you ever wondered, when you weigh yourself on a scale, how the scale is calibrated?...
Have you ever wondered, when you weigh yourself on a scale, how the scale is calibrated? How is it known that 150 pounds on that scale is the same as 150 pounds on another? Scales are calibrated by comparison to standard weights. Of course, millions of instruments require calibration and they cannot all be compared to the same weight. Rather, there is a single definitive weight, and a hierarchy of other weights that are compared to it. The U.S. National...
Have you ever had to negotiate your salary? Have you ever had to negotiate any pay...
Have you ever had to negotiate your salary? Have you ever had to negotiate any pay or benefits? If so, what worked? What didn't work? What would you recommend a friend do if they are going into salary negotiations?A California law was passed in 2017 that bans employers from asking about salary history. Will this help negotiations or hurt one of the negotiating parties? Who will have more power because of this law?
Have you ever wondered what it means to click the “offset carbon emissions” button when you...
Have you ever wondered what it means to click the “offset carbon emissions” button when you book a flight or train trip? It adds a small cost to your ticket, but how does this reduce emissions? The money is typically used to fund projects that reduce carbon emissions. One such project type is the introduction of more efficient cooking stoves into communities. Much of the world uses inefficient charcoal or wood stoves that result in excessive indoor air pollution, deforestation,...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT