[R] grouping scat1d/rug and plotting to 2 axes

Mike mbabyak at nc.rr.com
Mon Aug 27 22:20:45 CEST 2007


I'm wondering if anybody can offer a bit of  guidance on how to add a 
couple of features to a plot. 

I'm using Frank Harrell's Design library to model some survival data in 
R (2.3.1, windows platform).  I'm fairly comfortable with the survival 
modeling in Design, but am still at a frustratingly low level of 
competence when it comes to creating anything beyond simple plots in R.

A simplified version of the model is:

fit <- cph(Surv(survtime,deceased) ~ rcs(smw,4), 
data=survdata,x=T,y=T,surv=T )

And the basic plot is:

plot(fit,smw=NA, fun=function(x) 1/(1+exp(-x)))

I know that if I add


I get a nice jittered rug plot of all values of the predictor smw on the 
top axis.

What I'd like to do, however, is to plot on bottom axis the values of 
smw for only those participants who are alive, and then on the top axis, 
plot the values of smw for those who are deceased.  I'd appreciate any 
tips as to how I might approach this.


Mike Babyak

More information about the R-help mailing list