You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Any progress on implementing ways to update age in a continuous time model? In my case I am modeling criminal justice trajectories, and the transition hazards vary over age bands (12-17 yo, 18-24 yo, etc.). Thus in my simulation I should have people transitioning between age bins, and therefore experiencing different hazards, as the time progresses. Can this be done now in hesim? I am thinking of something like this, but wanted to check if there have been any new functions that you've experimented with:
Update age and age category
for (i in seq_len(nrow(patients))) {
sojourn_time <- data[i, "Tstop"] - data[i, "Tstart"] # Calculate sojourn time
patients[i, "age"] <- patients[i, "age"] + sojourn_time
patients[i, "age_category"] <- cut(patients[i, "age"], breaks = age_categories, labels = FALSE, right = FALSE)
#Check if age has reached max_age
if (patients[i, "age"] >= max_age) {
break # Stop the simulation for this patient
}
}
The text was updated successfully, but these errors were encountered:
Any progress on implementing ways to update age in a continuous time model? In my case I am modeling criminal justice trajectories, and the transition hazards vary over age bands (12-17 yo, 18-24 yo, etc.). Thus in my simulation I should have people transitioning between age bins, and therefore experiencing different hazards, as the time progresses. Can this be done now in hesim? I am thinking of something like this, but wanted to check if there have been any new functions that you've experimented with:
Update age and age category
for (i in seq_len(nrow(patients))) {
sojourn_time <- data[i, "Tstop"] - data[i, "Tstart"] # Calculate sojourn time
patients[i, "age"] <- patients[i, "age"] + sojourn_time
patients[i, "age_category"] <- cut(patients[i, "age"], breaks = age_categories, labels = FALSE, right = FALSE)
#Check if age has reached max_age
if (patients[i, "age"] >= max_age) {
break # Stop the simulation for this patient
}
}
The text was updated successfully, but these errors were encountered: