Learn R Programming

shrink (version 1.2.3)

shrink-package: Global, Parameterwise and Joint Shrinkage Factor Estimation

Description

The predictive value of a statistical model can often be improved by applying shrinkage methods. This can be achieved, e.g., by regularized regression or empirical Bayes approaches. Various types of shrinkage factors can also be estimated after a maximum likelihood. While global shrinkage modifies all regression coefficients by the same factor, parameterwise shrinkage factors differ between regression coefficients. With variables which are either highly correlated or associated with regard to contents, such as several columns of a design matrix describing a nonlinear effect or two main effects and their pairwise interaction term, parameterwise shrinkage factors are not interpretable and a compromise between global and parameterwise shrinkage, termed 'joint shrinkage', is a useful extension. A computational shortcut to resampling-based shrinkage factor estimation based on DFBETA residuals can be applied. Global, parameterwise and joint shrinkage for models fitted by lm, glm, coxph, and mfp is available.

Arguments

Notes

Sauerbrei (1999) suggested that before estimating parameterwise shrinkage factors, the data should be standardized to have a mean of 0 and unit variance.

Details

Functions included in the shrink-package:

shrink a function to compute global, parameterwise and joint post-estimation
shrinkage factors of fit objects of class lm, glm, coxph, or mfp.
coef.shrink returns shrunken regression coefficients from objects of class shrink.
predict.shrink obtains predictions from shrunken regression coefficients from objects
of class shrink.
vcov.shrink returns the variance-covariance matrix of shrinkage factors.
print.shrink prints objects of class shrink.
summary.shrink summary of objects of class shrink.

Data set included in the shrink-package:

deepvein deep vein thrombosis study
GBSG German breast cancer study

References

Dunkler D, Sauerbrei W, Heinze G (2016). Global, Parameterwise and Joint Shrinkage Factor Estimation. Journal of Statistical Software. 69(8), 1-19. tools:::Rd_expr_doi("10.18637/jss.v069.i08")
Sauerbrei W (1999) The use of resampling methods to simplify regression models in medial statistics. Applied Statistics 48(3): 313-329.
Verweij P, van Houwelingen J (1993) Cross-validation in survival analysis. Statistics in Medicine 12(24): 2305-2314.

See Also

shrink, coef.shrink, predict.shrink, print.shrink, summary.shrink, vcov.shrink, deepvein

Examples

Run this code
# with glm, family = binomial
set.seed(888)
intercept <- 1
beta <- c(0.5, 1.2)
n <- 200
x1 <- rnorm(n, mean = 1, sd = 1)
x2 <- rbinom(n, size = 1, prob = 0.3)
linpred <- intercept + x1 * beta[1] + x2 * beta[2]
prob <- exp(linpred) / (1 + exp(linpred))
runis <- runif(n, min = 0, max = 1)
ytest <- ifelse(test = runis < prob, yes = 1, no = 0)
simdat <- data.frame(cbind(y = ifelse(runis < prob, 1, 0), x1, x2))

fit <- glm(y ~ x1 + x2, family = binomial, data = simdat, x = TRUE)
summary(fit)

global <- shrink(fit, type = "global", method = "dfbeta")
print(global)
coef(global)

shrink(fit, type = "parameterwise", method = "dfbeta")

shrink(fit, type = "parameterwise", method = "dfbeta", join = list(c("x1", "x2")))

#shrink(fit, type = "global", method = "jackknife")
#shrink(fit, type = "parameterwise", method = "jackknife")
#shrink(fit, type = "parameterwise", method = "jackknife",
#       join = list(c("x1", "x2")))

# For more examples see shrink

Run the code above in your browser using DataLab