decompose.model {rioplot}R Documentation

Decompose the Results of a Regression Model by Cases

Description

This function takes a regression model object and a vector of case assignments to groups (note, cases can be in their own group) and computes each cases' contribution to the overall regression coefficients.

Usage

decompose.model(m1,group.by=group.by,include.int="yes",model.type="OLS")

Arguments

m1

A regression model object. OLS, logistic, Poisson and negative binomial regression are supported.

group.by

A numeric vector denoting group membership. Should be the same length as the number of cases.

include.int

Whether the regression model included an intercept. Default is "yes."

model.type

Type of model to be decomposed. OLS via lm, logistic via glm ("logit"), Poisson via glm ("poisson"), and negative binomial via MASS ("nb") are supported.

Value

decomp.coef

Each case's or subset of cases' contribution to the estimated slope or regression coefficient.

decomp.var

Each case's or subset of cases' contribution to the variance of the estimated slope or regression coefficient.

Author(s)

David Melamed, Ronald L. Breiger, and Eric Schoon

References

Schoon, Eric, David Melamed, and Ronald L. Breiger. 2024. Regression Inside Out. NY: Cambridge University Press.

Examples

data(Kenworthy99)
m1 <- lm(scale(dv) ~ scale(gdp) + scale(pov) + scale(tran) -1,data=Kenworthy99)
decompose.model(m1,group.by=c("Liberal","Corp","Liberal",
"SocDem","SocDem","Corp","Corp","Corp","Corp","Corp","SocDem",
"SocDem","Liberal","Liberal","Liberal"),include.int="no")

[Package rioplot version 1.1.1 Index]