deviancepercentage: Calculate Percentage and Significance of Deviance Explained...

Description Usage Arguments Details Value Author(s) References Examples

Description

This function calculates the percentage of deviance explained by a GLM model and calculates the significance of the model.

Usage

1
deviancepercentage(x,data,test="F",digits=2)

Arguments

x

Result of GLM as calculated by glm or glm.nb.

data

Data set to be used for the null model (preferably the same data set used by the 'full' model).

test

Test statistic to be used for the comparison between the null model and the 'full' model as estimated by anova.glm or anova.negbin: partial match of one of "Chisq", "F" or "Cp".

digits

Number of digits in the calculation of the percentage.

Details

The function calculates the percentage of explained deviance and the significance of the 'full' model by contrasting it with the null model.

For the null model, the data is subjected to na.omit. You should check whether the same data are used for the null and 'full' models.

Value

The function calculates the percentage of explained deviance and the significance of the 'full' model by contrasting it with the null model by ANOVA. The results of the ANOVA are also provided.

Author(s)

Roeland Kindt

References

Kindt, R. & Coe, R. (2005) Tree diversity analysis: A manual and software for common statistical methods for ecological and biodiversity studies.

https://www.worldagroforestry.org/output/tree-diversity-analysis

Examples

1
2
3
4
5
6
7
8
library(vegan)
data(dune)
data(dune.env)
dune.env$Agrostol <- dune$Agrostol
Count.model1 <- glm(Agrostol ~ Management + A1, family=quasipoisson(link=log), 
    data=dune.env, na.action=na.omit)
summary(Count.model1)
deviancepercentage(Count.model1, dune.env, digits=3)

Example output

Loading required package: tcltk
Loading required package: vegan
Loading required package: permute
Loading required package: lattice
This is vegan 2.5-4
BiodiversityR 2.11-1: Use command BiodiversityRGUI() to launch the Graphical User Interface; 
to see changes use BiodiversityRGUI(changeLog=TRUE, backward.compatibility.messages=TRUE)

Warning message:
no DISPLAY variable so Tk is not available 

Call:
glm(formula = Agrostol ~ Management + A1, family = quasipoisson(link = log), 
    data = dune.env, na.action = na.omit)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-2.5977  -1.6315  -0.1577   0.5328   2.4926  

Coefficients:
              Estimate Std. Error t value Pr(>|t|)
(Intercept)   -17.8335  3059.4626  -0.006    0.995
ManagementHF   17.4949  3059.4626   0.006    0.996
ManagementNM   17.5355  3059.4626   0.006    0.996
ManagementSF   18.6167  3059.4626   0.006    0.995
A1              0.1546     0.1105   1.399    0.182

(Dispersion parameter for quasipoisson family taken to be 2.335144)

    Null deviance: 70.701  on 19  degrees of freedom
Residual deviance: 39.111  on 15  degrees of freedom
AIC: NA

Number of Fisher Scoring iterations: 15

Deviance explained:  31.59 / 70.701 ( 44.7 percent)

Analysis of Deviance Table

Model 1: Agrostol ~ 1
Model 2: Agrostol ~ Management + A1
  Resid. Df Resid. Dev Df Deviance     F  Pr(>F)  
1        19     70.701                            
2        15     39.111  4    31.59 3.382 0.03671 *
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

BiodiversityR documentation built on April 20, 2021, 5:07 p.m.