Learn R Programming

BiodiversityR (version 1.5)

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)

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 m
digits
Number of digits in the calculation of the percentage.

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.

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. http://www.worldagroforestry.org/resources/databases/tree-diversity-analysis

Examples

Run this code
library(vegan)
data(dune)
data(dune.env)
dune.env$Agrsto<- dune$Agrsto
Count.model1 <- glm(Agrsto ~ Management + A1, family=quasipoisson(link=log), 
    data=dune.env, na.action=na.omit)
summary(Count.model1)
deviancepercentage(Count.model1,dune.env)

Run the code above in your browser using DataLab