13. Modern estimation methods

Shrinkage calculations: RStudio site

A nice example of the R code plus results with the a GUSTO-I sample is presented here.

Shrinkage calculations: essential R code

The R code to calculate shrunk regression coefficients for the GUSTO example is as follows:

# fit a model with 8 predictors
full8     <- lrm(DAY30~SHO+A65+HIG+DIA+HYP+HRT+TTR+SEX, data=gustos,x=T,y=T,linear.predictors=T)

# validate with 200 bootstraps
val.full8 <- validate(full8, B=200)

# copy original model fit to shrunk model
full8.shrunk <- full8

# use result from bootstrapping to shrink coefficients
full8.shrunk$coef <- val.full8[4,5] * full8.shrunk$coef  

# Estimate new intercept, with shrunk lp as offset variable, i.e. coef fixed at unity
full8.shrunk$coef[1] <- lrm.fit(y=full8$y, offset= full8$x %*% full8.shrunk$coef[2:9])$coef[1]
rcode_and_data/chapter13.txt · Last modified: 2014/04/01 18:10 by ewsteyerberg
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0