osofr / simcausal

Simulating Longitudinal and Network Data with Causal Inference Applications
64 stars 11 forks source link

Default values for non-existing time-points #3

Open osofr opened 8 years ago

osofr commented 8 years ago

Allow non-existing time-point references to default to some value, for example, instead of doing this

node("TI", t=0:7, distr="rbern", prob=plogis(-5 - 0.3*CVD + 0.5*A1C[t] + 1.5*{if (t==0) {0} else {TI[t-1]}}))

write just this, with TI[t-1] at t=0 defaulting to 0:

node("TI", t=0:7, distr="rbern", prob=plogis(-5 - 0.3*CVD + 0.5*A1C[t] + 1.5*TI[t-1]))