Learn R Programming

BiodiversityR (version 2.16-1)

deviancepercentage: Calculate Percentage and Significance of Deviance Explained by a GLM

Description

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

Usage

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

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.

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.

Author

Roeland Kindt

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.

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

Run this code
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)

Run the code above in your browser using DataLab