[R] Forcing a variableinto a model using stepAIC

Laura Bonnett l.j.bonnett at googlemail.com
Fri May 22 15:58:31 CEST 2009


Dear All,

I am attempting to use forward and/or backward selection to determine
the best model for the variables I have.  Unfortunately, because I am
dealing with patients and every patient is receiving treatment I need
to force the variable for treatment into the model.  Is there a way to
do this using R?  (Additionally, the model is stratified by
randomisation period).  I know that SAS can be used to do this but my
SAS coding is poor and consequently it would be easier for me to use
R, especially given the fractional polynomial transformations!

Currently the model is as follows (without treatment).

coxfita=coxph(Surv(rem.Remtime,rem.Rcens)~sind(nearma)+fsh(nearma)+fdr(nearma)+th1(nearma)+th2(nearma)+fp(cage)+fp(fint)+fp(tsb)+strata(rpa),data=nearma)


Thank you for your help,

Laura




More information about the R-help mailing list