[R] Isolating a single plot from plots produced simultaneously

Laura Bonnett l.j.bonnett at googlemail.com
Tue Jun 9 16:36:57 CEST 2009


Dear R-Help,

I am using the 'mfp' package.  It produces three plots (as I am using
the Cox model) simultaneously which can be viewed together using the
following code:

fit <- mfp(Surv(rem.Remtime,rem.Rcens)~fp(age)+strata(rpa),family=cox,data=nearma,select=0.05,verbose=TRUE)
par(mfrow=c(2,2))
plot(fit)

They can be viewed separately but the return key must be pressed after
each graph appears (Click or hit ENTER for next page).

I'd like to isolate the second plot produced (the estimated functional
form of the influence of age on the log relative hazard) so that I can
use the 'points' function to add the linear predictors for the
untransformed and the log-transformed models.  In the usual situation
one would produce a plot and then type:

coxfitu <- coxph(Surv(rem.Remtime,rem.Rcens)~age+strata(rpa),data=nearma)
points(coxfitu$linear.predictor,col=2)
coxfitl <- coxph(Surv(rem.Remtime,rem.Rcens)~log(age)+strata(rpa),data=nearma)
points(coxfitl$linear.predictor,col=3)

Can anyone tell me how to isolate just the second plot produced?

Thank you for your help,

Laura




More information about the R-help mailing list