# How Monolix generates the VPC for Time-To-Event data

The construction of a VPC plot for time-to-event data by Monolix requires several steps in the background:

**Simulation of datasets.**First, Monolix simulates datasets using the population model, which contains the structural and statistical models and the estimated population parameters.**Survival function estimators.**Then, for the original dataset and each simulated dataset, it estimates the survival function with either the Kaplan-Meier estimator for exactly observed events or the Turnbull estimator for interval censored events.**Prediction interval.**Finally, Monolix calculates lower and upper percentiles of the simulated survival function estimates, which give a prediction interval.

### Simulation of TTE data sets using a population model

Simulations of time-to-event datasets give, for each individual, times when an event occurs. The simulations are based on the same design as in the original data set, the same number of individuals as in the original data set and individual parameters are sampled using the covariates from this original data set and the population parameters estimated in Monolix.

To simulate a time when an event occurs, (u) is defined as a probability that an event (X) occurs before a certain time (T). This probability is computed using the cumulative hazard function (H(t))

where is a solution to the ODE system . A value of the probability is sampled from the uniform [0,1] distribution, thus in the above equation the time T becomes the unknown variable. A root finding method from an ODE solver finds its value.

The time T is not a given independent variable, but it is a simulated observation. Moreover, simulations are only until the time *Tmax*, which corresponds to the last time found in the data set. This value is the final integration time of the ODEs for each individual and it also defines a unique right censoring time for all individuals in the simulated data sets. It is independent of the individual times of events or right censoring in the original data set.

If the simulation fails because of a numerical error (e. g. because of a too high hazard), the simulated individuals with NaNs in their simulations are not used in the prediction interval, and the proportion of simulated individuals involved is then displayed in the interface.

The appearance of NaNs in the VPC simulations stops the generation of the VPC in Monolix versions prior to 2021R1. In Monolix versions starting at 2021R1, NaNs are ignored and the percentage of simulations giving NaNs is indicated in a warning message.

#### Example

In this example, the individual 3 in the original data set (table on the left) experienced an event at time 4. In the simulations (tables on the right), an event for this individual can occur before or after that time, or may occur after *Tmax*=5 (last table). Similarly, while the individual 5 left the study at time 3 without experiencing an event in the original data set, in the simulations for this individual an event can occur before or after time 3. If an event has not occurred at *Tmax*=5, then it is right censored.

#### Possible sources of bias in the simulations

##### Censoring (dropout)

In the original dataset (input Monolix dataset), censoring can be at any time: because the patient drops out or because the study is stopped for instance. In contrast, simulated datasets have no dropout until the global Tmax over all individuals, which means that there are on average more events in the simulated datasets than in the original dataset. However, if censoring in the original dataset is truly random, simulating until the global Tmax over all individuals should not produce a bias because the “additional” simulated events are evenly distributed over time. But if censoring in the dataset is not truly random, the empirical Kaplan-Meier curve is biased while the VPC predictions are not, so it may appear as a misfit. If we would instead censor the simulated datasets at the same censoring times as in the original dataset (Tmax=5 for id 4 and Tmax=3 for ID 5 on the above example), this could introduce other bias.

##### Regressor

If the TTE model depends on a regressor, the regressor is interpolated using last value carried forward.

##### Doses

If the TTE model depends on a PK model with doses present in the dataset, it is important to also include the planned (but not given because of event or dropout) doses in the dataset such that the doses span the same time range for all individuals. Otherwise this will create a bias in the VPC.

## Survival function estimators

Given some survival data that includes censoring (right-censoring or interval-censoring), a survival function can be estimated as a non-parametric maximum likelihood estimator (NPMLE).

Thus Monolix estimates an NPMLE for each simulated dataset, depending on the event type:

**Kaplan-Meier estimator****exactly observed events**.for**Turnbull estimator****interval censored data**.

The calculation of these estimators is detailed in the next sections.

**Note:** for interval censored data, the Turnbull estimator is used only in the VPC:

**In the plot of Observed data**, Monolix assumes that all events are exactly observed and displays the data using the**Kaplan-Meier estimator**explained in the previous section. This is because that plot is generated right after accepting the dataset, before a model has been selected. However, just looking at the dataset, the case of exact and interval censored events are indistinguishable. For example: assume that an observation period started at*t*=0 and at*t*=1 an event is marked by 1 in the column for the observation. Without any other information, the event could have occurred at*t*=1 or before.**In the VPC**, Monolix uses the eventType information specified in the structural model. If “eventType = intervalCensored” is specified in the structural model, Monolix uses the**Turnbull estimator**for empirical and simulated survival curves in the VPC, in order to avoid bias in the survival function estimate. If eventType is not specified in the structural model, Monolix considers all interval-censored events as exactly observed at the end of a censored interval, and uses**the Kaplan-Meier estimator.**

```
DEFINITION:
Event = {type = event, eventType = intervalCensored, intervalLength = L,
maxEventNumber = 1, hazard = h}
```

#### Exact events: Kaplan-Meier estimator

The Kaplan-Meier estimator, or product limit estimator, is a type of non-parametric maximum likelihood estimator and a standard method to approximate the survival function *S*(*t*)

in the case of exact events. It describes the probability that an individual survives until time t, knowing that it survived at any earlier time. For single events, it is given by the following formula:

where

– times before t, when at least one event occurred,

– number of events at the time ,

– number of individuals at risk, that is who did not experience an event until .

The probability () of an event is the ratio between the number of occurred events () and the number of individuals at risk (). The complement of it, , gives an estimation of the survival. For each time t, the total number of individuals at risk, who survived, may change. Thus, the current survival probability is the product of all probabilities at previous times , when at least one event occurred.

This formula can be better understood by calculating for example the probability that a patient survives 2 days: it is a product of two probabilities: the probability that the patient survives the first day and a conditional probability that they survive the second day, knowing that they survived the first one.

##### Example

On the left of the figure below, a typical example of a time-to-event data set contains information about exact times when individuals experienced an event (T=1) or when they left the study (drop-out: T=0). Five individuals have two observations each: the time at which the observation starts (T=0 for everyone) and the time of an event. If a patient leaves the study, then the dataset contains a drop-out time with T=0, instead of T=1, in the column for the observations. This means that the patient experienced no event but survived until the drop-out time. The Kaplan-Meier estimator takes into account such situations, because these individuals are not counted as individuals at risk (they are not counted in the denominator ) at later times.

The study starts at time *t*_{1}. There are no events, so *d*_{1}=0 and the value of the Kaplan-Meier estimator is 1. Until the next event time at *t*_{2}=1, the estimator remains constant. At that time, one individual experienced an event, hence *d*_{2}=1, and all individuals survived until that time so *n*_{2}=5. As a result, the probability to survive decreases by 0.2. It is the height of the jump at *t*=1 in the plot. The Kaplan-Meier estimator remains constant until the next event. At time *t*=3 there are two events. The number *n*_{3} counts now only 4 individuals – it has decreased by 1 due to the previous event. The final probability at time 3 is a product of all earlier probabilities. At *t*=4 there is a drop-out: patient 5 left the study without experiencing an event. The survival curve remains constant and a red dot marks the drop-out. The Kaplan-Meier estimator takes into account this situations, because at the next event time *t*=5, this individual is not counted as an individual at risk – thus the denominator n will be smaller. Finally, at time *t*=5, there is only one individual left, and one event, so the survival becomes 0.

##### Remarks

The Kaplan-Meier estimator handles correctly the information about individuals who left the study (right-censoring), but there is a bias when the exact times of events are unknown (interval-censoring).

In the TTE VPC, Monolix estimates a linear approximation of the Kaplan-Meier estimate.

#### Interval censored events: Turnbull estimator

The Turnbull estimator is a generalization of the Kaplan-Meier estimator that allows for interval censoring. In the TTE VPC, Monolix uses this estimator to plot both the empirical and simulated survival curves.

Interval censored events do not occur at exact times , , but within some time intervals between times and , . In case of right censored data (dropout), is the time when the individual leaves the study, and : an event will occur within the interval .

In the TTE VPC, the intervals are:

**For the empirical survival curve**, they correspond to the censoring intervals of the original data set.**For simulated survival curves**, the definition of these intervals depends on whether the structural model contains the option “intervalLength” or not:If “intervalLength=L” is given, then the intervals are

If “intervalLength” is missing, then the whole period of observation defined with the minimal and maximal times in the data is split in 10 regular intervals.

Simulations of interval censored datasets give, as in the case of exactly observed events, exact times of events for each individual. In order to compare the simulated survival to the empirical survival without bias, simulated events are counted in regular intervals to be transformed into interval censored events, and they are then represented in the VPC with the Turnbull estimator just like for the empirical survival.

##### Turnbull intervals

The Turnbull estimator is computed on time intervals that are called Turnbull intervals:

This grid of times is constructed from all points for in increasing order.

##### Turnbull algorithm

###### Notations

The probability that an event occurs in a j-th Turnbull interval is

For each individual

*i*: denotes a weight such that

The Weight

*αij*is an event indicator – it indicates whether an event from the interval occurred at .is the number of events until and is the number of individuals at risk at

The likelihood function for is:

##### Main idea of the Turnbull algorithm

Finding the NPMLE of , denoted by , means maximizing under the constraint that are positive and . The original Turnbull algorithm (1976) is the first and the simplest method to maximize with respect to *p*. It is an application of the Expectation-Maximization (EM) algorithm.

**Remark:** depends only on values of S at points , and the behaviour of S within the Turnbull intervals is unknown. The convention applied here is: when .

###### Procedure

The algorithm is the following:

**Step 0:**Initialization – choose an initial guess for . This initial guess for S is the estimate obtained from the Kaplan-Meier estimator under the assumption that events occur at , interpolated on the –grid.**Step 1:**Compute the probability of an event at time as

**Step 2:**Estimate the number of events at as

**Step 3:**Compute the estimated number of individuals at risk at time

**Step 4:**Compute using the Kaplan-Meier estimator using and to update the survival function**Stopping criterion:**If the updated solution is close to the old solution (in Monolix, ), stop, otherwise set and repeat steps 1 – 4

###### Linear approximation

In the TTE VPC, just like for the the Kaplan-Meier estimate, Monolix calculates a linear approximation of the Turnbull estimate.

##### Example

Below we show a small dataset with interval censored events. The individuals are in increasing order of the times at which censored intervals end. The figure on the rights shows two curves:

The upper bound curve is the Kaplan-Meier estimate assuming that events occur exactly at the upper interval limit .

The lower bound curve is the Kaplan-Meier estimate assuming that events occur exactly at the lower interval limit .

For comparison, we show now a similar dataset corresponding to exactly observed events at the upper interval limit. The figure on the right shows again the Kaplan-Meier estimator, and in addition its linear approximation.

##### Procedure

The time points of the lower and upper interval limits for all individuals are ordered in increasing sequence. In this example, the assumption is

The Turnbull intervals are the intervals , where , with and .

The weights are elements of the following matrix:

**First iteration of the algorithm**

**Step 0**: The initial guess is the upper bound curve, that is the Kaplan-Meier estimator under the assumption that events occur at , interpolated on the –grid.

**Step 1**: The probabilities that events occur in the Turnbull intervals are

**Step 2**: Modified number of events

**Step 3**: Modified number of individuals at risk

**Step 4**: Kaplan-Meier estimator for the modified values of *d* and *n*:

The figure below compares the linear approximations of Turnbull estimate at the start of the first iteration () and at the end (), as well as the linear approximation of the Kaplan-Meier estimate in case of exact events.

The difference between the blue curve and comes from the fact that is interpolated on a grid including the time points while they are not included in the grid considered in the case of exact events.

The first iteration of the Turnbull agorithm has the effect of lowering compared to after , which is due to the fact that the event in may have already occured after that point.

### Prediction interval

To generate the prediction interval in the VPC plot, Monolix performs by default 500 simulations with N individuals as in the original data set. As a result, it produces 500 time series that form 500 survival curves (based on Kaplan-Meier or Turnbull estimators). Since simulated event times are random numbers, all estimated survival functions have different time grids. *This is shown on Fig.(a) with two different simulated datasets.*

The interpolation of these curves on a fixed time grid allows to calculate the prediction interval. In Monolix the default time grid consists of a uniform grid with 100 points. For exactly observed events, the grid includes in addition all time points from the original data set to provide all possible information. Exact event times are unknown for interval censored events, so dataset time points have no additional information. *This is shown on Fig.(b) with the Kaplan-Meier plot from the simulated dataset 1 from Fig.(a), interpolated on a different time grid than its events, combining regularly spaced points at times 0, 10, 20, …, 100, and additional time points indicated in green that come from the original dataset.). *

The interpolation on the new grid gives at each time point of the grid a set of probabilities corresponding to different simulated survival curves. It allows to calculate lower and upper percentiles (the 5th and 95 percentiles are the default choice) and draw the prediction interval. *This is shown on Fig.(c) with the survival estimators from multiple simulations on the same time grid as on Fig. (b).*

##### Example: exactly observed events

The dataset contains times of exactly observed single events of 30 individuals. The survival model has a constant hazard function and the Kaplan-Meier estimator approximates the survival function. The VPC plot uses a linear approximation of the Kaplan-Meier curve (Fig. on the left). By default, the fixed grid has 100 uniformly distributed points together with all time points from the date set. The figure on the left presents the VPC plot with the default settings. The approximation of the empirical and simulated Kaplan-Meier curves is sufficient on the default grid. In contrast, the VPC on the Figure on the right uses a grid with only time points from the original dataset. The accuracy of the prediction interval is decreased.

##### Example: interval censored events

In this dataset, the times of events from the previous example are the ends of time intervals within which events occurred. The length of the censored intervals in the dataset is non constant among individuals, and oscillates around 5. The structural model includes this information in eventTime and intervalLength options.