tutorial

package preparation

library(rms) library(base.rms) library(survival)

1. transform between linear regressions

base to rms

fit <- lm(mpg~cyl+vs,data=mtcars) lm2ols(fit)

rms to base

fit <- ols(mpg~cyl+vs,data=mtcars) ols2lm(fit)

2. transform between logistic regressions

base to rms

fit <- glm(vs~mpg,data=mtcars,family = binomial(link='logit')) logit2lrm(fit)

rms to base

fit <- lrm(vs~mpg,data=mtcars) lrm2logit(fit)

3. transform between cox regressions

base to rms

fit <- coxph(Surv(mpg,vs)~am+gear,data=mtcars) coxph2cph(fit)

rms to base

fit <- cph(Surv(mpg,vs)~am+gear,data=mtcars) cph2coxph(fit)