Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Predicting survival with newdata in model without PH #50

Open
danjamstat opened this issue Mar 6, 2025 · 0 comments
Open

Predicting survival with newdata in model without PH #50

danjamstat opened this issue Mar 6, 2025 · 0 comments

Comments

@danjamstat
Copy link

Hi @dmphillippo,

Thanks very much for all your work on this package. I'm having an issue with trying to predict survival using new data with a model where we don't assume proportional hazards.

I think the problem is that I need to specify a study and a treatment in the aux argument, but I think the function only expects a study name as a string. I'm not sure if it's possible / how to specify a treatment. If I only specify a study then I get the following error:

Error in aux_array[, , (s - 1) * n_aux + (1:n_aux)] <- aux_temp[, , grep(paste0("\\[",  : 
  number of items to replace is not a multiple of replacement length

I've tried specifying a study as e.g., Jackson2019:Len but that gives the error:

Error in `predict()`:
! All elements of `aux` must match the name of an IPD or AgD (arm-based) study in the network, or be a list of distr() distributions.

As an example with the vignette data:

ndmm_fit_nph  <- nma(
    ndmm_net,
    regression = ~(age + iss_stage3 + response_cr_vgpr + male)*.trt,
    likelihood = "mspline",
    prior_intercept = normal(0, 100),
    prior_trt = normal(0, 100),
    prior_reg = normal(0, 100),
    prior_aux = half_normal(1),
    aux_by = c(.study, .trt),
    QR = TRUE
)

predict(
   ndmm_fit_nph,
   newdata = ndmm_agd_covs[1,] %>% mutate(age = age_mean, .trt = trt),
   baseline = "Jackson2019", 
   aux = "Jackson2019",
   times = 1:3
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant