You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Several arguments to survival::coxph() capture variables or variable names which are to be found in the data: id, cluster, istate. Those don't work with censored/parsnip yet:
library(censored)
#> Loading required package: parsnip#> Loading required package: survival# `id` argmod<- coxph(Surv(tstart, tstop, status) ~age+steroids+ strata(sex),
data=cgd, id=id)
spec<- proportional_hazards() %>%
set_engine("survival", id=id)
f_fit<-spec %>%
fit(Surv(tstart, tstop, status) ~age+steroids+ strata(sex),
data=cgd)
#> Error in model.frame.default(formula = Surv(tstart, tstop, status) ~ age + : invalid type (language) for variable '(id)'# `cluster` argbladder1<-bladder[bladder$enum<5, ]
mod<- coxph(Surv(stop, event) ~ (rx+size+number) * strata(enum),
cluster=id, bladder1)
# but also possible to provide `cluster` as a vectormod<- coxph(Surv(stop, event) ~ (rx+size+number) * strata(enum),
cluster=bladder1$id, bladder1)
spec<- proportional_hazards() %>%
set_engine("survival", cluster=id)
f_fit<-spec %>%
fit(Surv(stop, event) ~ (rx+size+number) * strata(enum),
data=bladder1)
#> Error in model.frame.default(formula = Surv(stop, event) ~ (rx + size + : invalid type (language) for variable '(cluster)'
Several arguments to
survival::coxph()
capture variables or variable names which are to be found in thedata
:id
,cluster
,istate
. Those don't work with censored/parsnip yet:Created on 2022-02-02 by the reprex package (v2.0.1)
The text was updated successfully, but these errors were encountered: