Closed ellessenne closed 2 years ago
Hi Alessandro
Great to hear from you! Doing well thanks. Hope all is going well at your end!
Hmm, yeah I don't think that will work, since I think from distant memory that it will try and integrate each row as starting from time 0.
I think you'd require the numeric integration, which would only happen in two situations I think:
tde
/ tdefunction
Usually 1. is for a time-dependent effect, since it interacts your coefficient with a function of t. I wondered if there is a way for you to potentially trick that tdefunction
interaction into getting the value you need for your time-varying covariate (rather than time varying coefficient), since the interaction term is just of the form tde_beta * x * tde_function
. But unfortunately I don't think it's flexible for your use case. I think tdefunction
is constrained to one function at the most, and it only takes one argument t
, so probably not flexible enough for you to generate a time-varying covariate using it (i.e. interacted with an x or set of x's).
So, yeah, I think you'd have to go the user-defined (cumulative) hazard function route. Which is a bit more work, but should do what you need if defined in the right way.
HTH.
Cheers, Sam.
Hi Sam, All is well here too!
First of all, thanks for your detailed answer! I did suspect it was not going to be straightforward...
I found a paper that derives closed-form solutions for specific patterns of time-varying covariates, one of which fits with the scenario I am trying to simulate, so I think that'll be straightforward!
The next step is to include all of that in a joint modelling setting, but for that, I think combining numerical integration and root finding with the analytical results above should do. Fitting that joint model with a time-varying endogenous covariate + the biomarker will be a different story 😅
Anyway, massive thanks again for the feedback! Cheers,
Alessandro
Hi Sam,
I hope all is well!
I was wondering, can {simsurv} can simulate survival data with a covariate that is exogenous and time-varying (such a deterministic treatment), something that could be analysed with a Cox model that uses start-stop notation (as in here)?
I tried the following and it did not work:
Created on 2022-02-11 by the reprex package (v2.0.1)
Do you think it would work if I define the hazard function by hand, passing then data frames for
betas
andx
?Many thanks in advance,
Alessandro