diff --git a/inst/doc/afex_anova_example.R b/inst/doc/afex_anova_example.R index 840c4f7..68b5b4d 100644 --- a/inst/doc/afex_anova_example.R +++ b/inst/doc/afex_anova_example.R @@ -5,6 +5,8 @@ options(width = 90) require(afex) # needed for ANOVA, lsmeans is loaded automatically. require(multcomp) # for advanced control for multiple testing/Type 1 errors. require(lattice) # for plots +lattice.options(default.theme = standard.theme(color = FALSE)) # black and white +lattice.options(default.args = list(as.table = TRUE)) # better ordering ## --------------------------------------------------------------------------------------- data(sk2011.1) diff --git a/inst/doc/afex_anova_example.Rmd b/inst/doc/afex_anova_example.Rmd index 8d953b7..01416a3 100644 --- a/inst/doc/afex_anova_example.Rmd +++ b/inst/doc/afex_anova_example.Rmd @@ -41,6 +41,8 @@ In contrast to the analysis reported in the manuscript, we initially do not sepa require(afex) # needed for ANOVA, lsmeans is loaded automatically. require(multcomp) # for advanced control for multiple testing/Type 1 errors. require(lattice) # for plots +lattice.options(default.theme = standard.theme(color = FALSE)) # black and white +lattice.options(default.args = list(as.table = TRUE)) # better ordering ``` ```{r} diff --git a/inst/doc/afex_anova_example.html b/inst/doc/afex_anova_example.html index 9845836..dd157c8 100644 --- a/inst/doc/afex_anova_example.html +++ b/inst/doc/afex_anova_example.html @@ -12,7 +12,7 @@ - +
require(afex) # needed for ANOVA, lsmeans is loaded automatically.
require(multcomp) # for advanced control for multiple testing/Type 1 errors.
-require(lattice) # for plotsdata(sk2011.1)
str(sk2011.1)## 'data.frame': 640 obs. of 9 variables:
@@ -243,8 +245,8 @@ 2017-04-11
Alternatively, the anova method for afex_aov objects returns a data.frame of class anova that can be passed to, for example, xtable for nice formatting:
print(xtable::xtable(anova(a1), digits = c(rep(2, 5), 3, 4)), type = "html")
-
-
+
+
@@ -469,13 +471,13 @@ 2017-04-11
## Simultaneous Tests for General Linear Hypotheses
##
## Linear Hypotheses:
-## Estimate Std. Error t value Pr(>|t|)
-## MP - MT == 0 10.831 4.612 2.349 0.0689 .
-## MP - AC == 0 18.100 4.612 3.925 0.0010 **
-## MP - DA == 0 4.556 4.612 0.988 0.3253
-## MT - AC == 0 7.269 4.612 1.576 0.2819
-## MT - DA == 0 -6.275 4.612 -1.361 0.2969
-## AC - DA == 0 -13.544 4.612 -2.937 0.0180 *
+## Estimate Std. Error t value Pr(>|t|)
+## MP - MT == 0 10.831 4.612 2.349 0.068859 .
+## MP - AC == 0 18.100 4.612 3.925 0.000777 ***
+## MP - DA == 0 4.556 4.612 0.988 0.325273
+## MT - AC == 0 7.269 4.612 1.576 0.281590
+## MT - DA == 0 -6.275 4.612 -1.361 0.296932
+## AC - DA == 0 -13.544 4.612 -2.937 0.017800 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## (Adjusted p values reported -- free method)
@@ -608,7 +610,7 @@ 2017-04-11
Plotting
Function lsmip from package lsmeans can be used for plotting the data directly from an afex_aov object. As said initially, we are interested in the three-way interaction of instruction with inference, plausibility, and instruction. A plot of this interaction could be the following:
lsmip(a1, instruction ~ inference|plausibility)
-
+
@@ -647,7 +649,7 @@ 2017-04-11
at = 1:4,
labels = c("pl:v", "im:v", "pl:i", "im:i")
)))
-
+
We see the critical predicted cross-over interaction in the left of those two graphs. For valid but implausible problems (im:v) deductive responses are larger than probabilistic responses. The opposite is true for invalid but plausible problems (pl:i). We now tests these differences at each of the four x-axis ticks in each plot using custom contrasts (diff_1 to diff_4). Furthermore, we test for a validity effect and plausibility effect in both conditions.
(m4 <- lsmeans(a2, ~instruction+plausibility+validity|what))
## what = affirmation:
@@ -716,10 +718,10 @@ 2017-04-11
##
## Linear Hypotheses:
## Estimate Std. Error t value Pr(>|t|)
-## diff_1 == 0 4.175 8.500 0.491 0.623874
-## diff_2 == 0 34.925 8.500 4.109 0.000244 ***
-## diff_3 == 0 -23.600 8.500 -2.777 0.017105 *
-## diff_4 == 0 -8.100 8.500 -0.953 0.564739
+## diff_1 == 0 4.175 8.500 0.491 0.62387
+## diff_2 == 0 34.925 8.500 4.109 0.00023 ***
+## diff_3 == 0 -23.600 8.500 -2.777 0.01733 *
+## diff_4 == 0 -8.100 8.500 -0.953 0.56474
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## (Adjusted p values reported -- free method)
@@ -731,10 +733,10 @@ 2017-04-11
##
## Linear Hypotheses:
## Estimate Std. Error t value Pr(>|t|)
-## diff_1 == 0 -22.425 8.500 -2.638 0.033 *
-## diff_2 == 0 -2.700 8.500 -0.318 0.955
-## diff_3 == 0 -0.925 8.500 -0.109 0.955
-## diff_4 == 0 -3.650 8.500 -0.429 0.955
+## diff_1 == 0 -22.425 8.500 -2.638 0.0331 *
+## diff_2 == 0 -2.700 8.500 -0.318 0.9554
+## diff_3 == 0 -0.925 8.500 -0.109 0.9554
+## diff_4 == 0 -3.650 8.500 -0.429 0.9554
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## (Adjusted p values reported -- free method)
@@ -815,7 +817,7 @@ 2017-04-11
(function () {
var script = document.createElement("script");
script.type = "text/javascript";
- script.src = "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
+ script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
document.getElementsByTagName("head")[0].appendChild(script);
})();
diff --git a/inst/doc/afex_mixed_example.R b/inst/doc/afex_mixed_example.R
index 3c40153..a359f2d 100644
--- a/inst/doc/afex_mixed_example.R
+++ b/inst/doc/afex_mixed_example.R
@@ -3,13 +3,13 @@ options(width = 90)
## ----message=FALSE, warning=FALSE-------------------------------------------------------
require(afex) # needed for ANOVA, lsmeans is loaded automatically.
+require(dplyr) # for working with data frames
+require(tidyr) # for transforming data frames from wide to long and the other way round.
require(multcomp) # for advanced control for multiple testing/Type 1 errors.
require(lattice) # for plots
require(latticeExtra) # for combining lattice plots, etc.
lattice.options(default.theme = standard.theme(color = FALSE)) # black and white
lattice.options(default.args = list(as.table = TRUE)) # better ordering
-require(dplyr) # for working with data frames
-require(tidyr) # for transforming dtaa frames from wide to long and the other way round.
data("fhch2010") # load
fhch <- droplevels(fhch2010[ fhch2010$correct,]) # remove errors
diff --git a/inst/doc/afex_mixed_example.Rmd b/inst/doc/afex_mixed_example.Rmd
index 56fb638..814a96c 100644
--- a/inst/doc/afex_mixed_example.Rmd
+++ b/inst/doc/afex_mixed_example.Rmd
@@ -32,13 +32,13 @@ After loading the packages, we will load the data (which comes with `afex`), rem
```{r message=FALSE, warning=FALSE}
require(afex) # needed for ANOVA, lsmeans is loaded automatically.
+require(dplyr) # for working with data frames
+require(tidyr) # for transforming data frames from wide to long and the other way round.
require(multcomp) # for advanced control for multiple testing/Type 1 errors.
require(lattice) # for plots
require(latticeExtra) # for combining lattice plots, etc.
lattice.options(default.theme = standard.theme(color = FALSE)) # black and white
lattice.options(default.args = list(as.table = TRUE)) # better ordering
-require(dplyr) # for working with data frames
-require(tidyr) # for transforming dtaa frames from wide to long and the other way round.
data("fhch2010") # load
fhch <- droplevels(fhch2010[ fhch2010$correct,]) # remove errors
diff --git a/inst/doc/afex_mixed_example.html b/inst/doc/afex_mixed_example.html
index fa455ab..f250c0d 100644
--- a/inst/doc/afex_mixed_example.html
+++ b/inst/doc/afex_mixed_example.html
@@ -12,7 +12,7 @@
-
+
Mixed Model Reanalysis of RT data
@@ -70,7 +70,7 @@
Mixed Model Reanalysis of RT data
Henrik Singmann
-2017-04-11
+2017-05-25
@@ -106,13 +106,13 @@ 2017-04-11
We start with loading some packages we will need throughout this example. For data manipulation we will be using the dplyr and tidyr packages from the tidyverse. A thorough introduction to these packages is beyond this example, but well worth it, and can be found in ‘R for Data Science’ by Wickham and Grolemund. For plotting we will be diverging from the tidyverse and use lattice instead. In my opinion lattice provides the best combination of expressive power and abstraction. Specifically, like in base graph, we can fully decide what gets plotted.
After loading the packages, we will load the data (which comes with afex), remove the errors, and take a look at the variables in the data.
require(afex) # needed for ANOVA, lsmeans is loaded automatically.
+require(dplyr) # for working with data frames
+require(tidyr) # for transforming data frames from wide to long and the other way round.
require(multcomp) # for advanced control for multiple testing/Type 1 errors.
require(lattice) # for plots
require(latticeExtra) # for combining lattice plots, etc.
lattice.options(default.theme = standard.theme(color = FALSE)) # black and white
lattice.options(default.args = list(as.table = TRUE)) # better ordering
-require(dplyr) # for working with data frames
-require(tidyr) # for transforming dtaa frames from wide to long and the other way round.
data("fhch2010") # load
fhch <- droplevels(fhch2010[ fhch2010$correct,]) # remove errors
@@ -142,7 +142,7 @@ 2017-04-11
ungroup() %>%
group_by(task) %>%
summarise(n = n())
-## # A tibble: 2 × 2
+## # A tibble: 2 x 2
## task n
## <fctr> <int>
## 1 naming 20
@@ -155,7 +155,7 @@ 2017-04-11
summarise(min = min(items),
max = max(items),
mean = mean(items))
-## # A tibble: 2 × 4
+## # A tibble: 2 x 4
## stimulus min max mean
## <fctr> <int> <int> <dbl>
## 1 word 139 150 147.4667
@@ -164,7 +164,7 @@ 2017-04-11
fhch_long <- fhch %>% gather("rt_type", "rt", rt, log_rt)
histogram(~rt|rt_type, fhch_long, breaks = "Scott", type = "density",
scale = list(x = list(relation = "free")))
-
+
Descriptive Analysis
@@ -181,7 +181,7 @@ 2017-04-11
panel.points(tmp$x, tmp$y, pch = 13, cex =1.5)
}) +
bwplot(mean ~ density:frequency|task+stimulus, agg_p, pch="|", do.out = FALSE)
-
+
Now we plot the same data but aggregated across items:
agg_i <- fhch %>% group_by(item, task, stimulus, density, frequency) %>%
summarise(mean = mean(log_rt)) %>%
@@ -194,7 +194,7 @@ 2017-04-11
panel.points(tmp$x, tmp$y, pch = 13, cex =1.5)
}) +
bwplot(mean ~ density:frequency|task+stimulus, agg_i, pch="|", do.out = FALSE)
-
+
These two plots show a very similar pattern and suggest several things:
- Responses to
nonwords appear slower than responses to words, at least for the naming task.
@@ -590,7 +590,7 @@ 2017-04-11
(function () {
var script = document.createElement("script");
script.type = "text/javascript";
- script.src = "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
+ script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
document.getElementsByTagName("head")[0].appendChild(script);
})();
diff --git a/vignettes/afex_anova_example.Rmd b/vignettes/afex_anova_example.Rmd
index 8d953b7..01416a3 100644
--- a/vignettes/afex_anova_example.Rmd
+++ b/vignettes/afex_anova_example.Rmd
@@ -41,6 +41,8 @@ In contrast to the analysis reported in the manuscript, we initially do not sepa
require(afex) # needed for ANOVA, lsmeans is loaded automatically.
require(multcomp) # for advanced control for multiple testing/Type 1 errors.
require(lattice) # for plots
+lattice.options(default.theme = standard.theme(color = FALSE)) # black and white
+lattice.options(default.args = list(as.table = TRUE)) # better ordering
```
```{r}
diff --git a/vignettes/afex_mixed_example.Rmd b/vignettes/afex_mixed_example.Rmd
index 56fb638..814a96c 100644
--- a/vignettes/afex_mixed_example.Rmd
+++ b/vignettes/afex_mixed_example.Rmd
@@ -32,13 +32,13 @@ After loading the packages, we will load the data (which comes with `afex`), rem
```{r message=FALSE, warning=FALSE}
require(afex) # needed for ANOVA, lsmeans is loaded automatically.
+require(dplyr) # for working with data frames
+require(tidyr) # for transforming data frames from wide to long and the other way round.
require(multcomp) # for advanced control for multiple testing/Type 1 errors.
require(lattice) # for plots
require(latticeExtra) # for combining lattice plots, etc.
lattice.options(default.theme = standard.theme(color = FALSE)) # black and white
lattice.options(default.args = list(as.table = TRUE)) # better ordering
-require(dplyr) # for working with data frames
-require(tidyr) # for transforming dtaa frames from wide to long and the other way round.
data("fhch2010") # load
fhch <- droplevels(fhch2010[ fhch2010$correct,]) # remove errors