gad: General ANOVA Design

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Fits a general ANOVA design with any combination of orthogonal/nested and fixed/random factors through function estimates

Usage

1
gad(object)

Arguments

object

an object of class lm, containing the specified design with random and/or fixed factors

Details

Function gad returns an analysis of variance table using the estimates function to identify the appropriate F-ratios and consequently p-values for any complex model of orthogonal or nested, fixed or random factors as described by Underwood(1997).

Value

An object of class "anova" inheriting from class "data.frame"

Author(s)

Leonardo Sandrini-Neto (leonardosandrini@gmail.com)

References

Underwood, A.J. 1997. Experiments in Ecology: Their Logical Design and Interpretation Using Analysis of Variance. Cambridge University Press, Cambridge.

See Also

estimates

Examples

 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
#Example 1
library(GAD)
data(rohlf95)
CG <- as.fixed(rohlf95$cages)
MQ <- as.random(rohlf95$mosquito) 
model <- lm(wing ~ CG + CG%in%MQ, data = rohlf95)
gad(model)
##
##
#Example 2
data(rats)
names(rats)
TR <- as.fixed(rats$treat)
RA <- as.random(rats$rat)
LI <- as.random(rats$liver)
model <- lm(glycog ~ TR + RA%in%TR + LI%in%RA%in%TR, data=rats)
gad(model)
##
##
#Example 3
data(snails)
O <- as.random(snails$origin)
S <- as.random(snails$shore)
B <- as.random(snails$boulder)
C <- as.random(snails$cage)
model <- lm(growth ~ O + S + O*S + B%in%S + O*(B%in%S) + C%in%(O*(B%in%S)), 
            data = snails)
gad(model)

Example output

Loading required package: matrixStats
Loading required package: R.methodsS3
R.methodsS3 v1.7.1 (2016-02-15) successfully loaded. See ?R.methodsS3 for help.
Analysis of Variance Table

Response: wing
         Df  Sum Sq Mean Sq  F value    Pr(>F)    
CG        2  665.68  332.84   1.7409    0.2295    
CG:MQ     9 1720.68  191.19 146.8781 6.981e-11 ***
Residual 12   15.62    1.30                       
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
[1] "glycog" "treat"  "rat"    "liver" 
Analysis of Variance Table

Response: glycog
         Df  Sum Sq Mean Sq F value  Pr(>F)  
TR        2 1557.56  778.78  2.9290 0.19710  
TR:RA     3  797.67  265.89  5.3715 0.01411 *
TR:RA:LI 12  594.00   49.50  2.3386 0.05029 .
Residual 18  381.00   21.17                  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Analysis of Variance Table

Response: growth
          Df  Sum Sq Mean Sq  F value   Pr(>F)   
O          1 118.582 118.582 109.1874 0.001871 **
S          3  36.360  12.120                     
O:S        3   3.258   1.086   6.5359 0.015201 * 
S:B        8   1.187   0.148   0.8927 0.561821   
O:S:B      8   1.329   0.166   1.4177 0.239629   
O:S:B:C   24   2.813   0.117   1.0430 0.413970   
Residual 192  21.576   0.112                     
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

GAD documentation built on May 2, 2019, 3:01 a.m.