NikNakk / forestmodel

42 stars 13 forks source link

Error with person-period data #38

Open sepaul1124 opened 2 years ago

sepaul1124 commented 2 years ago

forestmodel v 0.6.2

Model:

mod <- coxph(Surv(tstart, exit_init, event_init) ~ DM1 + race_recode + ethnicity_recode + par_educ_high_gmc:tstart + par_income_grouped + paralc_recode + case_ctrl + par_separ12 + par_separ13up + CENTER + birth_cohort + mdd + sad + pd + agor + si + adhd_inatt + adhd_hyper12 + adhd_hyper13_15 + adhd_hyper16up + odd + cd12 + cd13_15 + cd16up + cig13 + cig14_15 + cig16up + mj12 + mj13up + frailty(FAM_ID), data = person_period)

Using forest_model

forest_model(coxph2b)

Error: Error in[.default(data[, 1], , "time") : subscript out of bounds

When I run the model without the person-period format, the function generates a plot. However, I need to use the person_period plot to incorporate time-varying covariates.

Are there any solutions?