goranbrostrom / eha

eha
6 stars 1 forks source link

Nonparametric Estimation #7

Closed w1806291 closed 3 years ago

w1806291 commented 3 years ago

Can anyone help me with this code? I have loaded the survival and eha packages.

par(mfrow = c(1, 2)) with(mort, plot(Surv(enter, exit, event), fn = "cum")) with(mort, plot(Surv(enter, exit, event), fn = "surv"))

I get an error:

"fn" is not a graphical parameter "fn" is not a graphical parameter "fn" is not a graphical parameter "fn" is not a graphical parameter "fn" is not a graphical parameter "fn" is not a graphical parameter

Thanks,

goranbrostrom commented 3 years ago

plot.Surv is a function in the survival package. It is a wrapper for plot.survfit, see its help page. You could try

with(mort, plot(Surv(enter, exit, event), fun = "cumhaz"))

etc. Göran

w1806291 commented 3 years ago

Thanks that works!