gam.hp {gam.hp}R Documentation

Hierarchical Partitioning of Adjusted R2 and Explained Deviance for Generalized Additive Models

Description

Hierarchical Partitioning of Adjusted R2 and Explained Deviance for Generalized Additive Models

Usage

gam.hp(mod, iv = NULL, type = "dev", commonality = FALSE)

Arguments

mod

Fitted "gam" model objects.

iv

optional The relative importance of predictor groups will be assessed. The input for iv should be a list, where each element contains the names of variables belonging to a specific group. These variable names must correspond to the predictor variables defined in the model (mod).

type

The type of R-square of gam, either "dev" or "adjR2", in which "dev" is explained deviance and "adjR2" is adjusted R-square, the default is "dev".

commonality

Logical; If TRUE, the result of commonality analysis (2^N-1 fractions for N predictors) is shown, the default is FALSE.

Details

This function conducts hierarchical partitioning to calculate the individual contributions of each predictor towards total adjusted R2 and explained deviance for Generalized Additive Models. The adjusted R2 and explained deviance are is the output of summary.gam()in mgcv package.

Value

dev

The R2 for the full model.

hierarchical.partitioning

A matrix containing individual effects and percentage of individual effects towards total adjusted R2 and explained deviance for each predictor.

Author(s)

Jiangshan Lai lai@njfu.edu.cn

References

Examples

library(mgcv)
mod1 <- gam(Sepal.Length ~ s(Petal.Length) + s(Petal.Width) + Sepal.Width,data = iris)
summary(mod1)
gam.hp(mod1)
gam.hp(mod1,type="adjR2")
gam.hp(mod1,commonality=TRUE)
iv <- list(env1=c("s(Petal.Length)","s(Petal.Width)"),env2="Sepal.Width")
gam.hp(mod1,iv,type="adjR2")
gam.hp(mod1,iv,commonality=TRUE)

[Package gam.hp version 0.0-3 Index]