-
Notifications
You must be signed in to change notification settings - Fork 9
/
README.Rmd
executable file
·171 lines (128 loc) · 6.94 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
---
output: github_document
---
# ARTool: R Package for the Aligned Rank Transform for Nonparametric Factorial ANOVAs
[![R build status](https://github.com/mjskay/ARTool/workflows/R-CMD-check/badge.svg)](https://github.com/mjskay/ARTool/actions)
[![Coverage status](https://codecov.io/gh/mjskay/ARTool/branch/master/graph/badge.svg)](https://codecov.io/github/mjskay/ARTool?branch=master)
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/ARTool)](https://CRAN.R-project.org/package=ARTool)
[![GPL >= 2](https://img.shields.io/badge/GPL-%E2%89%A52-brightgreen.svg)](https://cran.r-project.org/web/licenses/GPL-3)
[![DOI](https://zenodo.org/badge/19809/mjskay/ARTool.svg)](https://zenodo.org/badge/latestdoi/19809/mjskay/ARTool)
[![DOI](https://img.shields.io/badge/DOI-10.1145%2F1978942.1978963-blue.svg)](https://dx.doi.org/10.1145/1978942.1978963)
_Matthew Kay, Northwestern University <[email protected]>_<br>
_Lisa A. Elkin, University of Washington, <[email protected]>_<br>
_James J. Higgins, Kansas State University, <[email protected]>_<br>
_Jacob O. Wobbrock, University of Washington <[email protected]>_
ARTool is an R package implementing the Aligned Rank Transform for conducting
nonparametric analyses of variance on factorial models. This implementation is
based on the ART procedure as used in the original implementation of
[ARTool](https://depts.washington.edu/acelab/proj/art/) by Wobbrock et al.
The package automates the Aligning-and-Ranking process using the `art` function.
It also automates the process of running a series of ANOVAs on the transformed
data and extracting the results of interest. It supports traditional ANOVA
models (fit using `lm`), repeated measures ANOVAs (fit using `aov`), and
mixed effects models (fit using `lmer`); the model used is determined by the
formula passed to `art`.
__Note__: The documentation of this package assumes some level of familiarity
with when and why you may want to use the aligned rank transform; the
[ARTool page](https://depts.washington.edu/acelab/proj/art/) provides a more in-depth (and
highly approachable) introduction to the aligned rank transform and the
motivation for its use.
## Installation
You can install the latest released version from CRAN with this R command:
```{r, eval=FALSE}
install.packages("ARTool")
```
__Or__, you can install the latest development version from GitHub with these R
commands:
```{r, eval=FALSE}
install.packages("devtools")
devtools::install_github("mjskay/ARTool")
```
## Example
The general approach to using ART is to transform your data using `art` , verify
the ART procedure is appropriate to the dataset using `summary` , and then run an
ANOVA on the transformed data using `anova` .
First, let us load some example data:
```{r, message=FALSE}
library(ARTool)
data(Higgins1990Table5, package = "ARTool")
```
`Higgins1990Table5` is a data frame from an experiment in which the effects of `Moisture`
and `Fertilizer` on `DryMatter` in peat pots was tested. Four pots were placed on
each `Tray` , with `Moisture` varied between `Tray` s and `Fertilizer` varied
within `Tray` s. We can see the basic structure of the data:
```{r}
str(Higgins1990Table5)
head(Higgins1990Table5, n=8)
```
### Step 1: Transform the data
To analyze this data using the aligned rank transform, we first transform the
data using `art` . We specify the response variable (`DryMatter` ), the fixed
effects and all of their interactions (`Moisture*Fertilizer`, or equivalently
`Moisture + Fertilizer + Moisture:Fertilizer`), and any grouping terms if
present (here, `(1|Tray)` ).
While `(1|Tray)` has no effect on the results of
the aligned rank transformation, it will be used by `anova` to determine the
type of model to run: when grouping terms are present, mixed effects models
are run using `lmer`. If you wish to use a repeated measures ANOVA instead of
a mixed effects model, you can use an `Error` term instead (see below for an
example of this). If you do not having repeated measures, do not include
any grouping terms or error terms.
```{r}
m <- art(DryMatter ~ Moisture*Fertilizer + (1|Tray), data=Higgins1990Table5)
```
### Step 2: Verify appropriateness of ART
To verify that the ART procedure was correctly applied and is appropriate for
this dataset, we can look at the output of `summary` :
```{r}
summary(m)
```
We see that the columns sums of aligned responses and the F values of ANOVAs on
aligned responses not of interest are all ~0, indicating that the alignment
correctly "stripped out" effects not of interest. Thus, we can apply the ANOVA
on the transformed data.
### Step 3: Run the ANOVA
ARTool automatically selects the model to be used
for the ANOVA. Because we have included a grouping term, `(1|Tray)`, ARTool
will fit mixed effects models using `lmer` and run the ANOVAs on them:
```{r}
anova(m)
```
### Alternative model: Repeated Measures ANOVA
This particular study could also be analyzed using a repeated measures ANOVA,
yielding the same results (note that repeated measures ANOVAs and mixed
effects models will not always yield the same results). To instead run
a repeated measures ANOVA, add an `Error` term to the model as you
might for a call to `aov`:
```{r}
m <- art(DryMatter ~ Moisture*Fertilizer + Error(Tray), data=Higgins1990Table5)
anova(m)
```
## Contrast tests
For an example of how to run contrast tests on an `art` model, see this vignette:
```{r eval=FALSE}
vignette("art-contrasts")
```
This vignette is also available [here](https://cran.r-project.org/package=ARTool/vignettes/art-contrasts.html).
## Problems
Should you encounter any bugs in this package, please file it
[here](https://github.com/mjskay/ARTool/issues/new) with minimal code to
reproduce the issue.
## Citations
Kay, M., Elkin, L. A., Higgins, J. J., and Wobbrock, J. O. (`r format(Sys.Date(), "%Y")`).
_ARTool: Aligned Rank Transform for Nonparametric Factorial ANOVAs_.
R package version `r getNamespaceVersion("ARTool")`, <https://github.com/mjskay/ARTool>.
DOI: [10.5281/zenodo.594511](https://dx.doi.org/10.5281/zenodo.594511).
For the *ART* procedure used by `art()` and `anova.art()`, cite:
Wobbrock, J. O., Findlater, L., Gergle, D., and Higgins, J. J. (2011). The Aligned
Rank Transform for Nonparametric Factorial Analyses Using Only ANOVA
Procedures. _Proceedings of the ACM Conference on Human Factors in
Computing Systems (CHI 2011)_. Vancouver, British Columbia (May 7-12, 2011).
New York: ACM Press, pp. 143-146. <https://depts.washington.edu/acelab/proj/art/>.
DOI: [10.1145/1978942.1978963](https://dx.doi.org/10.1145/1978942.1978963).
For the *ART-C* contrast testing procedure used by `art.con()` and `artlm.con()`, cite:
Elkin, L. A., Kay, M, Higgins, J. J., and Wobbrock, J. O. (2021). An Aligned
Rank Transform Procedure for Multifactor Contrast Tests. _Proceedings of the ACM
Symposium on User Interface Software and Technology (UIST 2021)_. Virtual Event
(October 10-14, 2021). New York: ACM Press, pp. 754-768. DOI:
[10.1145/3472749.3474784](https://dx.doi.org/10.1145/3472749.3474784)