anova.pglm: Anova and AIC tables for 'pgls' models.

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

Description

The 'anova' function creates ANOVA tables for a 'pgls' models using sequential sums of squares.

Usage

1
2
3
4
## S3 method for class 'pgls'
anova(object, ...)
## S3 method for class 'pglslist'
anova(object, ..., scale = 0, test = "F")

Arguments

object

A 'pgls' model object.

...

Additional 'pgls' models.

scale

A character string specifying the test statistic to be used. Can be one of "F", "Chisq" or "Cp", with partial matching allowed, or NULL for no test.

test

numeric. An estimate of the noise variance sigma^2. If zero this will be estimated from the largest model considered.

Details

The sequential sums of squares are calculated by refitting the model in the order of the terms of the formula and so can take a little time to calculate. Branch length transformations are held at the values of the initial object. The 'logLik.pgls' provides a simple accessor function that allows the use of AIC model comparisons. Note that the generic AIC methods do no checking to ensure that sensible models are being compared.

Value

A table of class 'anova' and 'data.frame' that employs the generic plot methods for 'anova' tables.

Note

The functions build heavily on the generic methods 'anova.lm' and 'anova.lmlist'.

Author(s)

Rob Freckleton, David Orme

See Also

pgls

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(shorebird)
shorebird <- comparative.data(shorebird.tree, shorebird.data, Species, vcv=TRUE, vcv.dim=3)

mod1 <- pgls(log(Egg.Mass) ~ log(M.Mass) * log(F.Mass), shorebird) 
anova(mod1)

mod2 <- pgls(log(Egg.Mass) ~ log(M.Mass) + log(F.Mass), shorebird)  
mod3 <- pgls(log(Egg.Mass) ~ log(M.Mass) , shorebird)
mod4 <- pgls(log(Egg.Mass) ~ 1, shorebird)

anova(mod1, mod2, mod3, mod4)
AIC(mod1, mod2, mod3, mod4)

Example output

Loading required package: ape
Loading required package: MASS
Loading required package: mvtnorm
Analysis of Variance Table
Sequential SS for pgls: lambda = 1.00, delta = 1.00, kappa = 1.00

Response: log(Egg.Mass)
                        Df  Sum Sq Mean Sq  F value Pr(>F)    
log(M.Mass)              1 0.42146 0.42146 371.8424 <2e-16 ***
log(F.Mass)              1 0.00114 0.00114   1.0014 0.3206    
log(M.Mass):log(F.Mass)  1 0.00004 0.00004   0.0339 0.8545    
Residuals               67 0.07594 0.00113                    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Analysis of Variance Table
pgls: lambda = 1.00, delta = 1.00, kappa = 1.00

Model 1: log(Egg.Mass) ~ log(M.Mass) * log(F.Mass)
Model 2: log(Egg.Mass) ~ log(M.Mass) + log(F.Mass)
Model 3: log(Egg.Mass) ~ log(M.Mass)
Model 4: log(Egg.Mass) ~ 1
  Res.Df     RSS Df Sum of Sq        F Pr(>F)    
1     67 0.07594                                 
2     68 0.07598 -1  -0.00004   0.0339 0.8545    
3     69 0.07711 -1  -0.00114   1.0014 0.3206    
4     70 0.49858 -1  -0.42146 371.8424 <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
     df       AIC
mod1  4 -64.96854
mod2  3 -66.93263
mod3  2 -67.87981
mod4  1  62.63955

caper documentation built on May 1, 2019, 9:52 p.m.