-
"Look at a stone cutter hammering away at his rock, perhaps a hundred times without as much as a crack showing in it. Yet at the hundred-and-first blow it will split in two, and I know it was not the last blow that did it, but all that had gone before." I saw this quote a couple weeks ago and started thinking about how events like this could be modeled. I think what I'm trying to demo below could be called a joint Compound Poisson Process/Time to event (TTE) model? My issue is, I can't figure out how to keep track of the cumulative number of simulated events (strikes to the rock) to use as a covariate in the TTE model (stone breaking). Any thoughts from the community? Thank you in advance. TD cptte <- ' $PARAM @Annotated // time to event $CMT @Annotated $ODE $TABLE // TTE $CAPTURE ranexp cdf ranun event MAG TVWT TVLAM TVLAM2 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi Tyler - If you just want to keep track of cumulative MAG, you can try this:
Code isn't tested but let me know if this works for you. $MAIN
if(NEWIND <= 1) double CUMAG = 0;
$TABLE
double MAG = R::rpois(TVLAM*event);
CUMAG = CUMAG + MAG;
|
Beta Was this translation helpful? Give feedback.
Hi Tyler -
If you just want to keep track of cumulative MAG, you can try this:
$MAIN
both initializes the variable and resets it to zero with each individual$TABLE
accumulatesMAG
Code isn't tested but let me know if this works for you.