Skip to content

Commit

Permalink
expt with repaginating
Browse files Browse the repository at this point in the history
  • Loading branch information
benwhalley committed Jul 3, 2017
1 parent 39a72f1 commit 1fdf925
Show file tree
Hide file tree
Showing 154 changed files with 37,985 additions and 3,798 deletions.
3 changes: 2 additions & 1 deletion _output.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
bookdown::gitbook:
includes:
in_header: hypothesis.html
css: style.css
config:
toc:
collapse: section
before: |
<li><a href="./">Just enough R</a></li>
download: ["pdf", "epub"]
split_by: rmd
split_by: section

bookdown::pdf_book:
includes:
Expand Down
7 changes: 7 additions & 0 deletions airquality-r-values.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"","Ozone","Solar.R","Wind","Temp","Month","Day"
"Ozone",0,0.00197241942881554,1.2981615782337e-11,0,0.561787014869315,1
"Solar.R",0.000179310857165049,0,1,0.00751772924010297,1,0.561787014869315
"Wind",9.27258270166931e-13,0.495955206815127,0,3.43407631220316e-08,0.247105980658337,1
"Temp",0,0.000751772924010297,2.6415971632332e-09,0,7.23144291114863e-07,0.645698579067462
"Month",0.0776000963996033,0.366353350873138,0.0274562200731485,6.02620242595719e-08,0,1
"Day",0.887942543669527,0.0702233768586644,0.738746589753025,0.107616429844577,0.92218998575754,0
8 changes: 5 additions & 3 deletions anova-cookbook.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ output:
knitr::opts_chunk$set(echo = TRUE, collapse=TRUE, cache=TRUE)
library(tidyverse)
library(pander)
library(lmerTest)
```




# Anova 'Cookbook'

This section is intended as a shortcut to running Anova for a variety of common types of model. If you want to understand more about what you are doing, read the section on [principles of Anova in R](anova.html).
Expand All @@ -25,9 +25,8 @@ This section is intended as a shortcut to running Anova for a variety of common

### Factorial anova, no bigger than 2x2

```{r}

```
TODO


### Factorial anova, where one factor has > 2 levels.
Expand All @@ -54,6 +53,9 @@ eysenck %>%
```


[Visual inspection of the data (see Figure X) suggested that older adults recalled more words than younger adults, and that this difference was greatest for the intention, imagery, and adjective conditions. Recall peformance was worst in the counting and rhyming conditions.]{.apa-example}


Or alternatively if we wanted to provde a better summary of the distribution of the raw data we could use a boxplot:

```{r, fig.cap="Boxplot for recall in older and young adults, by condition."}
Expand Down
8 changes: 4 additions & 4 deletions correlations.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ mycorrelations
One thing to be aware of is that by default `corr.test()` produces p values that are adjusted for multiple comparisons in the top right hand triangle (i.e. above the diagonal). If you want the uncorrected values use the values below the diagonal (or pass `adjust=FALSE` when calling the function).


## Making correlation tables for publication
## Tables for publication


### `apaTables`
### Using `apaTables` {-}
If you want to produce output tables for publication the `apaTables` package might be useful. This block saves an APA formatted correlation table to an [external Word document like this](Table1_APA.doc).

```{r}
Expand All @@ -84,7 +84,7 @@ apa.cor.table(airquality, filename="Table1_APA.doc", show.conf.interval=F)
```


### By hand
### By hand {-}

If you're not bothered about strict APA foramt, you might still want to extract the *r* and *p* values as dataframes which can then be saved to a csv and opened in excel, or converted to a table by some other means.

Expand All @@ -108,7 +108,7 @@ mycorrelations$ci %>%
```


## Other types of correlation
## Other correlation methods

By default `corr.test` produces Pearson correlations, but You can pass the `method` argument `psych::corr.test()`:

Expand Down
459 changes: 459 additions & 0 deletions docs/a-real-example.html

Large diffs are not rendered by default.

354 changes: 354 additions & 0 deletions docs/a-warning.html

Large diffs are not rendered by default.

642 changes: 130 additions & 512 deletions docs/anova-cookbook.html

Large diffs are not rendered by default.

21 changes: 12 additions & 9 deletions docs/anova-cookbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ output:




# Anova 'Cookbook'

This section is intended as a shortcut to running Anova for a variety of common types of model. If you want to understand more about what you are doing, read the section on [principles of Anova in R](anova.html).
Expand All @@ -21,6 +20,7 @@ This section is intended as a shortcut to running Anova for a variety of common
### Factorial anova, no bigger than 2x2


TODO


### Factorial anova, where one factor has > 2 levels.
Expand All @@ -40,7 +40,10 @@ eysenck %>%
ylab("Recall (95% CI)") + xlab("")
```

<img src="anova-cookbook_files/figure-html/unnamed-chunk-4-1.png" width="672" />
<img src="anova-cookbook_files/figure-html/unnamed-chunk-3-1.png" width="672" />


[Visual inspection of the data (see Figure X) suggested that older adults recalled more words than younger adults, and that this difference was greatest for the intention, imagery, and adjective conditions. Recall peformance was worst in the counting and rhyming conditions.]{.apa-example}


Or alternatively if we wanted to provde a better summary of the distribution of the raw data we could use a boxplot:
Expand All @@ -54,8 +57,8 @@ eysenck %>%
```

<div class="figure">
<img src="anova-cookbook_files/figure-html/unnamed-chunk-5-1.png" alt="Boxplot for recall in older and young adults, by condition." width="672" />
<p class="caption">(\#fig:unnamed-chunk-5)Boxplot for recall in older and young adults, by condition.</p>
<img src="anova-cookbook_files/figure-html/unnamed-chunk-4-1.png" alt="Boxplot for recall in older and young adults, by condition." width="672" />
<p class="caption">(\#fig:unnamed-chunk-4)Boxplot for recall in older and young adults, by condition.</p>
</div>


Expand Down Expand Up @@ -110,8 +113,8 @@ car::qqPlot(eysenck.model)
```

<div class="figure">
<img src="anova-cookbook_files/figure-html/unnamed-chunk-8-1.png" alt="QQ plot to assess normality of model residuals" width="672" />
<p class="caption">(\#fig:unnamed-chunk-8)QQ plot to assess normality of model residuals</p>
<img src="anova-cookbook_files/figure-html/unnamed-chunk-7-1.png" alt="QQ plot to assess normality of model residuals" width="672" />
<p class="caption">(\#fig:unnamed-chunk-7)QQ plot to assess normality of model residuals</p>
</div>


Expand All @@ -131,8 +134,8 @@ data_frame(
```

<div class="figure">
<img src="anova-cookbook_files/figure-html/unnamed-chunk-9-1.png" alt="Residual vs fitted (spread vs. level) plot to check homogeneity of variance." width="672" />
<p class="caption">(\#fig:unnamed-chunk-9)Residual vs fitted (spread vs. level) plot to check homogeneity of variance.</p>
<img src="anova-cookbook_files/figure-html/unnamed-chunk-8-1.png" alt="Residual vs fitted (spread vs. level) plot to check homogeneity of variance." width="672" />
<p class="caption">(\#fig:unnamed-chunk-8)Residual vs fitted (spread vs. level) plot to check homogeneity of variance.</p>
</div>


Expand Down Expand Up @@ -315,7 +318,7 @@ lme4::sleepstudy %>%
geom_label(aes(y=450, x=9, label="imagine how bad\nyou feel by this point"), color="red")
```

<img src="anova-cookbook_files/figure-html/unnamed-chunk-13-1.png" width="672" />
<img src="anova-cookbook_files/figure-html/unnamed-chunk-12-1.png" width="672" />


If we want to test whether there are significant differences in RTs between `Days`, we could fit something very similar to a traditional repeat measures Anova using the `lme4::lmer()` function, and obtain an Anova table for the model using the special `lmerTest::anova()` function:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/anova-cookbook_files/figure-html/unnamed-chunk-4-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/anova-cookbook_files/figure-html/unnamed-chunk-8-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1fdf925

Please sign in to comment.