Ok, so just for anyone's interest, I managed to create the calibration plot for 
the glmnet object using the val.prob() function from the rms package.

Now, my question moves slightly, how can I superimpose calibration curves from 
two models, so that they can be graphically compared?

This is what I have tried. I start with two models, based on same predictors: 
rms_fit and enet_fit

>validate(rms_fit,B=100)
>cal<-calibrate(rms_fit,B=100)

> mypred<-predict(enet_fit,type="response",s=lambda.min,newx=myDesignMatrix[1:703,])
>  #get probabilities for training set
> val.prob(mypred, as.numeric(out.v), m=20, cex=.5) #out.v is a vector of 
> outcomes for each sample

>par(new=TRUE)

>plot(cal)

would superimpose both graphs completely, including labels and axis.

Also tried doing:

> val.prob(mypred, as.numeric(out.v), m=20, cex=.5) #out.v is a vector of 
> outcomes for each sample

>lines(plot(cal))

but this creates a new graph window for cal object.


Also, how can I colour them differently..

Thanks in advance,

Dave


                                          
        [[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.

Reply via email to