# VPC for repeated time to events

**URL:** <https://discourse.pumas.ai/t/vpc-for-repeated-time-to-events/1163>\
**Category:** Simulation\
**Created:** [April 1, 2025, 2:38pm UTC](https://discourse.pumas.ai/t/vpc-for-repeated-time-to-events/1163 "2025-04-01T14:38:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![medhat](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/medhat/32/548_2.png) [@medhat](https://discourse.pumas.ai/u/medhat)\
**Post date:** [April 1, 2025, 2:38pm UTC](https://discourse.pumas.ai/t/vpc-for-repeated-time-to-events/1163/1 "2025-04-01T14:38:15Z")

</div>

Hello everyone,

i am trying to learn Pumas and I was walking through the tutorial for TimeToEvent models ( [Time To Event](https://tutorials.pumas.ai/html/discrete/05-TimeToEvent.html)).

I came across some issues when it comes to simulating a RTTE model.

Can anyone kindly share how to go from estimating your model to making a VPC for time to first/second/third event?  
The error i get when using the normal vpc function is:  
_subject cannot contain reset events when simulating tte data_

Any help is kindly appreciated - thank you!

Medhat

---

<div class="post-metadata">

**Author:** ![andreasnoack](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/andreasnoack/32/22_2.png) [@andreasnoack](https://discourse.pumas.ai/u/andreasnoack)\
**Post date:** [April 2, 2025, 2:35pm UTC](https://discourse.pumas.ai/t/vpc-for-repeated-time-to-events/1163/2 "2025-04-02T14:35:33Z")

</div>

Thanks for reporting this. Indeed, it looks like there is a bug in `vpc` for _repeated_ time-to-event analyses. I have filed this in our issue tracker.

---

<div class="post-metadata">

**Author:** ![medhat](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/medhat/32/548_2.png) [@medhat](https://discourse.pumas.ai/u/medhat)\
**Post date:** [April 25, 2025, 2:56pm UTC](https://discourse.pumas.ai/t/vpc-for-repeated-time-to-events/1163/3 "2025-04-25T14:56:47Z")

</div>

Hi Andreas, is there a work around in getting VPCs for time to n number of events? Or to atleast simulate multiple times using a fitted model?

---

<div class="post-metadata">

**Author:** ![andreasnoack](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/andreasnoack/32/22_2.png) [@andreasnoack](https://discourse.pumas.ai/u/andreasnoack)\
**Post date:** [May 9, 2025, 12:18pm UTC](https://discourse.pumas.ai/t/vpc-for-repeated-time-to-events/1163/4 "2025-05-09T12:18:17Z")

</div>

I’m sorry for the delay here. The issue fell off the radar. Currently when simulating time-to-event models, we have a separate function for this since in this case, you are drawing `time` which is different from how `simobs` usually works. This might be subject to change in the future. Another restriction, is that the subject should not contain any events since the events are being populated as part of the simulation. Hence, you might be able to simulation with something like

```julia
julia> newpop = simobstte(ft.model, [Subject(sub, events=nothing) for sub in ft.data], coef(ft); maxT = maximum(sub -> maximum(sub.time), ft.data), repeated = true)
Population
  Subjects: 120
  Observations: DV

```
