Dear R-users, I have used the nomogram function from the rms package for a logistic regresison model made with lrm(). Everything works perfectly (r version 2.15.1 on a mac). My question is this: if my final model is not the one created by lrm, but I internally validated the model and 'shrunk' the regression coefficients and computed a new intercept, how can I build a nomogram using that object? Please see the simplified code for details:
library(rms) x1<-rnorm(100,1,1) x2<-rnorm(100,1,1) y<-rbinom(100,1,0.5) d<-data.frame(x1,x2,y) attach(d) ddist<-datadist(d) options(datadist='ddist') model<-lrm(y~x1+x2, x=TRUE, y=TRUE, data=d) plot(nomogram(model)) ##Nomogram is printed, as expected ##Now the model is internally validated, and regression coefficients are penalized bootstrap<-validate(model, bw=FALSE, B=100) shrinkage<-round(bootstrap[4,5],2) final<-round(model$coef*shrinkage, 3) final.lp<-cbind(model$x)%*%final[-1] final["Intercept"]<-round(lrm.fit(y=d$y, offset=final.lp)$coef,3) final.lp<-final[1]+model$x%*%final[-1] ##The object 'final' now contains all model parameters, yet in a different fashion than the lrm-created model. Does anyone have an idea how to make this compatible again with nomogram()? Thanks in advance for any thoughts on it. Best wishes, Sander [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.