View source: R/decomposition.R
decomposition | R Documentation |
Used by the wrapper contribution()
but can be used manually. Calculates the decomposition for a given regression model.
decomposition(outcome, betas, mm, ranker, wt, correction, citype = "CI")
outcome |
Outcome variable |
betas |
Beta coefficients from regression. |
mm |
Model matrix from regression |
ranker |
Ranking variable |
wt |
Weights |
correction |
Apply sign correction? |
citype |
Character, CI type to be calculated, defaults to |
NOTE: Only models with data with ordinary indexes are supported (starting from 1, sequentially increasing by increments of 1). For the case were rows with NA
are automatically omitted by the model function, the used indices are guessed based on the row names of the model matrix and then used for accessing the ranker
variable. However, this may lead to issues if the row names do not correspond to ordinary integer indexes.
S3 object of class decomposition
fit.lm = lm(mtcars$mpg ~ mtcars$cyl)
decomp = decomposition(mtcars$mpg, coefficients(fit.lm), fit.lm$model,
mtcars$hp, wt = rep(1, nrow(mtcars)), correction = FALSE)
summary(decomp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.