Danny Kaplan
May 14, 2013
mosaic packageThe next slides are about putting some math notation and R calculations in your slides, not about the best way to teach about the standard error of the mean.
You're already familiar with the formula for the standard error of the mean.
Your R computations can be added to the presentation by including them in fences
` ``{r}
3+2
```
This will appear in your finished document like this:
3+2
[1] 5
Each document must be self-contained.
This means that you should include the mosaic package (typically at the top of the document):
require(mosaic)
Use the include=FALSE flag, e.g. {r include=FALSE} to supporess printing.
The wage data: CPS85
nrow(CPS85)
[1] 534
mean(wage, data=CPS85)
[1] 9.024
sd(wage, data=CPS85)
[1] 5.139
The standard error of the mean is:
sd(wage, data=CPS85)/sqrt(nrow(CPS85)-1)
[1] 0.2226
Starting data:
mean(wage ~ sex, data=CPS85)
F M
7.879 9.995
sd(wage ~ sex, data=CPS85)
F M
4.720 5.286
tally(~sex, data=CPS85)
F M Total
245 289 534
You take it from here on.
Do the calculation. Then compare it to the result you get in the t-test:
t.test(wage~sex, data=CPS85)