Skip to content

How to keep track of cumulative number of simulated events? #1108

Answered by kylebaron
TDmetric asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Tyler -

If you just want to keep track of cumulative MAG, you can try this:

  • The code in $MAIN both initializes the variable and resets it to zero with each individual
  • The code in $TABLE accumulates MAG

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;

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@TDmetric
Comment options

Answer selected by kylebaron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants