-The two main functionalities of `afex` are (1) to provide a coherent and intuitive interface to run standard ANOVAs with any number of within- or between-subjects variables (the relevant functions are now called `aov_car`, `aov_ez`, and `aov_4`) and (2) to provide *p*-values for fixed effects in mixed models using `lme4` via function `mixed`. The default outputs of those functions can be directly passed to `lsmeans` for post-hoc tests or contrasts.
+The two main functionalities provided by `afex` are:
+
+1. A coherent and intuitive interface to run standard ANOVAs with any number of within- or between-subjects variables (the relevant functions are now called `aov_car`, `aov_ez`, and `aov_4`).
+2. Fit mixed models (via `lme4``lmer` or `glmer`) and obtain *p*-values for fixed effects in one call to function `mixed`.
+
+The default outputs of those functions can be directly passed to `lsmeans` for post-hoc/follow-up tests or contrasts.
+
+For `afex` support visit: [afex.singmann.science](http://afex.singmann.science/)
##Installation
@@ -19,40 +26,170 @@ The two main functionalities of `afex` are (1) to provide a coherent and intuiti
- To install the latest development version you will need the [`devtools`](https://github.com/hadley/devtools) package:
-As of version `0.14` several changes to the interface were introduced:
-
-- ANOVA functions renamed to `aov_car`, `aov_ez`, and `aov_4`. Old ANOVA functions are now deprecated.
-
-- new default return argument for ANOVA functions `afex_aov`, an S3 object containing the following:
- 1. ANOVA table of class `"anova"`
- 2. ANOVA fitted with base R's `aov` (can be passed to `lsmeans` for post-hoc tests)
- 3. output from `car::Anova` (for tests of effects), ANOVA table 1. is based on this model
- 4.`lm` object passed to `car::Anova`
- 5. data used for estimating 2. and 4.
-
-- added support for `lsmeans`: objects of class `afex_aov` can be passed to `lsmeans` directly. `afex` now depends on `lsmeans`.
-
-- added three new real example data sets and a [vignette](http://htmlpreview.github.io/?https://raw.githubusercontent.com/singmann/afex/master/inst/doc/anova_posthoc_singmann_klauer_2011.html) showing how to calculate contrasts after ANOVA.
-
-- added `expand_re` argument to `mixed` which, if `TRUE`, correctly interprets the `||` notation in random effects with factors (i.e., suppresses estimation of correlation among random effects). `lmer_alt` is a wrapper for `mixed` which uses `expand_re = TRUE`, returns an object of class `merMod` (i.e., does not calculate p-values), and otherwise behaves like `g/lmer` (i.e., does not enforce certain contrasts)
-
--`nice.anova` was renamed to `nice` (and now also works with `mixed` objects).
-
-- Returned objects of `mixed` and the ANOVA functions (i.e., of class `afex_aov`) are similar:
- - Both have a numeric Anova table as first element called `anova_table` (which is of class `c("anova", "data.frame")`).
- - calling `nice` on either returns a nicely rounded Anova table (i.e., numbers converted to characters). This table is also per default printed.
- - calling `anova` on either will return the numeric Anova table (for which print methods exist as well).
-
-- added `afex_options()` functionality for setting options globally.
-
--`afex` does not depend on `car` package anymore, it is only imported.
-
-- first element in mixed object renamed to `anova_table`.
-
--`summary` method for `mixed` objects now calls `summary.merMod` on full model.
+##ANOVA functionality
+
+To calculate an ANOVA, `afex` requires the data to be in the long format (i.e., one row per data point/observation). An ANOVA can then be calculated via one of three functions that only differ in the way how to specify the ANOVA:
+
+- In `aov_ez` the columns containing dependent variable, id variable, and factors need to be specified as character vectors.
+-`aov_car` behaves similar to standard `aov` and requires the ANOVA to be specified as a formula containing an `Error` term (at least to identify the id variable).
+-`aov_4` allows the ANOVA to be specified via a formula similar to `lme4::lmer` (with one random effects term).
+
+A further overview is provided by the [vignette](https://cran.rstudio.com/web/packages/afex/vignettes/afex_anova_example.html). The following code provides a simple example for an ANOVA with both between- and within-subject factors, see also `?aov_car` in `R`.
+
+```
+require(afex)
+# examples data set with both within- and between-subjects factors (see ?obk.long)
+data(obk.long, package = "afex")
+head(obk.long) # data in long format
+# id treatment gender age phase hour value
+# 1 1 control M -4.75 pre 1 1
+# 2 1 control M -4.75 pre 2 2
+# 3 1 control M -4.75 pre 3 4
+# 4 1 control M -4.75 pre 4 2
+# 5 1 control M -4.75 pre 5 1
+# 6 1 control M -4.75 post 1 3
+
+# estimate mixed ANOVA on the full design:
+aov_ez("id", "value", obk.long, between = c("treatment", "gender"),
+ within = c("phase", "hour"), observed = "gender")
+Function `mixed()` fits a mixed model with `lme4::lmer` (or `lme4::glmer` if a `family` argument is passed) and then calculates *p*-values for fixed effects using a variety of methods. The formula to `mixed` needs to be the same as in a call to `lme4::lmer`. The default method for calculation of *p*-values is `'KR'` (Kenward-Roger) which only works for linear mixed models (i.e., no `family` argument) and can require considerable RAM and time, but provides the best control of Type I errors. Other methods are `'S'` (Satterthwaite, similar to `'KR'` but requires less RAM), `'PB'` (parametric bootstrap), and `'LRT'` (likelihood-ratio test).
+
+More examples are provided in the [vignette](https://cran.rstudio.com/web/packages/afex/vignettes/afex_mixed_example.html), the following is a short example using some published data (see also `?mixed`).
+
+```
+require(afex)
+data("sk2011.2")
+
+# use only affirmation problems (S&K also splitted the data like this)
Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by its terms.
0 comments on commit
4028b17