Skip to content

Commit

Permalink
Reworded hw4
Browse files Browse the repository at this point in the history
  • Loading branch information
bcaffo committed Jul 8, 2014
1 parent bd3ba1e commit abf411d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
14 changes: 9 additions & 5 deletions 06_StatisticalInference/homework/hw4.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ Creating Data Products


--- &multitext
Load the data set `mtcars` in the `datasets` R package. You want
to test whether the MPG is $\mu_0$ or smaller using a one sided
Load the data set `mtcars` in the `datasets` R package. Assume that the data set mtcars is a random sample. Compute the mean MPG, $\bar x,$ of this sample.

You want
to test whether the true MPG is $\mu_0$ or smaller using a one sided
5% level test. ($H_0 : \mu = \mu_0$ versus $H_a : \mu < \mu_0$).
Using that data set and a Z test:

1. what is the smallest value of $\mu_0$ that you would reject for (to two decimal places)?
1. . Based on the mean MPG of the sample $\bar x,$ and by using a Z test: what is the smallest value of $\mu_0$ that you would reject for (to two decimal places)?

*** .hint
This is the inversion of a one sided hypothesis test. It yields confidence
Expand All @@ -55,10 +57,12 @@ We want to solve
$$
\frac{\sqrt{n}(\bar{X} - \mu_0)}{s} = Z_{0.05}
$$
Or $$\mu_0 = \bar{X} - Z_{0.05} s / \sqrt{n} = \bar{X} + Z_{0.95} s / \sqrt{n}$$. Note that the quantile is negative.
Or $$\mu_0 = \bar{X} - Z_{0.05} s / \sqrt{n} = \bar{X} + Z_{0.95} s / \sqrt{n}$$ Note that the quantile is negative.

```{r}
mn <- mean(mtcars$mpg); s <- sd(mtcars$mpg); z <- qnorm(.05)
mn <- mean(mtcars$mpg)
s <- sd(mtcars$mpg)
z <- qnorm(.05)
mu0 <- mn - z * s / sqrt(nrow(mtcars))
```
Note, it's easy to get tripped up in this problem on signs. If you get a value
Expand Down
14 changes: 9 additions & 5 deletions 06_StatisticalInference/homework/hw4.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,15 @@ <h2>About these slides</h2>
<article data-timings="">

<div class="quiz-text quiz-multitext well">
<p>Load the data set <code>mtcars</code> in the <code>datasets</code> R package. You want
to test whether the MPG is \(\mu_0\) or smaller using a one sided
<p>Load the data set <code>mtcars</code> in the <code>datasets</code> R package. Assume that the data set mtcars is a random sample. Compute the mean MPG, \(\bar x,\) of this sample.</p>

<p>You want
to test whether the true MPG is \(\mu_0\) or smaller using a one sided
5% level test. (\(H_0 : \mu = \mu_0\) versus \(H_a : \mu < \mu_0\)).
Using that data set and a Z test:</p>

<ol>
<li>what is the smallest value of \(\mu_0\) that you would reject for (to two decimal places)?</li>
<li class = ''>Based on the mean MPG of the sample \(\bar x,\) and by using a Z test: what is the smallest value of \(\mu_0\) that you would reject for (to two decimal places)?</li>
</ol>

<button class="quiz-submit btn btn-primary">Submit</button>
Expand All @@ -88,9 +90,11 @@ <h2>About these slides</h2>
\[
\frac{\sqrt{n}(\bar{X} - \mu_0)}{s} = Z_{0.05}
\]
Or \[\mu_0 = \bar{X} - Z_{0.05} s / \sqrt{n} = \bar{X} + Z_{0.95} s / \sqrt{n}\]. Note that the quantile is negative.</p>
Or \[\mu_0 = \bar{X} - Z_{0.05} s / \sqrt{n} = \bar{X} + Z_{0.95} s / \sqrt{n}\] Note that the quantile is negative.</p>

<pre><code class="r">mn &lt;- mean(mtcars$mpg); s &lt;- sd(mtcars$mpg); z &lt;- qnorm(.05)
<pre><code class="r">mn &lt;- mean(mtcars$mpg)
s &lt;- sd(mtcars$mpg)
z &lt;- qnorm(.05)
mu0 &lt;- mn - z * s / sqrt(nrow(mtcars))
</code></pre>

Expand Down
14 changes: 9 additions & 5 deletions 06_StatisticalInference/homework/hw4.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ Creating Data Products


--- &multitext
Load the data set `mtcars` in the `datasets` R package. You want
to test whether the MPG is $\mu_0$ or smaller using a one sided
Load the data set `mtcars` in the `datasets` R package. Assume that the data set mtcars is a random sample. Compute the mean MPG, $\bar x,$ of this sample.

You want
to test whether the true MPG is $\mu_0$ or smaller using a one sided
5% level test. ($H_0 : \mu = \mu_0$ versus $H_a : \mu < \mu_0$).
Using that data set and a Z test:

1. what is the smallest value of $\mu_0$ that you would reject for (to two decimal places)?
1. . Based on the mean MPG of the sample $\bar x,$ and by using a Z test: what is the smallest value of $\mu_0$ that you would reject for (to two decimal places)?

*** .hint
This is the inversion of a one sided hypothesis test. It yields confidence
Expand All @@ -41,11 +43,13 @@ We want to solve
$$
\frac{\sqrt{n}(\bar{X} - \mu_0)}{s} = Z_{0.05}
$$
Or $$\mu_0 = \bar{X} - Z_{0.05} s / \sqrt{n} = \bar{X} + Z_{0.95} s / \sqrt{n}$$. Note that the quantile is negative.
Or $$\mu_0 = \bar{X} - Z_{0.05} s / \sqrt{n} = \bar{X} + Z_{0.95} s / \sqrt{n}$$ Note that the quantile is negative.


```r
mn <- mean(mtcars$mpg); s <- sd(mtcars$mpg); z <- qnorm(.05)
mn <- mean(mtcars$mpg)
s <- sd(mtcars$mpg)
z <- qnorm(.05)
mu0 <- mn - z * s / sqrt(nrow(mtcars))
```

Expand Down

0 comments on commit abf411d

Please sign in to comment.