```
fit1 <- coxph(Surv(time, status) ~ age + factor(ph.ecog), data=lung)
xfit <- model.matrix(fit1)
fit2 <- coxph(Surv(time, status) ~ age + factor(ph.ecog), data=lung,
x=TRUE)
all.equal(model.matrix(fit1), fit2$x)
```

Run the code above in your browser using DataLab