Monolix
Auto Light Dark
Auto Light Dark

Covariate model

Objectives: learn how to implement a model for continuous and/or categorical covariates.

Projects: warfarin_covariate1_project, warfarin_covariate2_project, warfarin_covariate3_project, phenobarbital_project

Model with continuous covariates

  • warfarin_covariate1_project (data = ‘warfarin_data.txt’, model = ‘lib:oral1_1cpt_TlagkaVCl.txt’)

The warfarin data contains 2 individual covariates: weight which is a continuous covariate and sex which is a categorical covariate with 2 categories (1=Male, 0=Female). We can ignore these columns if are sure not to use them, or declare them using respectively the reserved keywords CONTINUOUS COVARIATE  and CATEGORICAL COVARIATE to define continuous and categorical covariate.

Even if these 2 covariates are now available, we can choose to define a model without any covariate by not clicking on any check box in the covariate model.


Monolix Individual model panel for the warfarin model without covariates. Tlag, ka, V and Cl are LOGNORMAL with random effects checked, and the covariate columns sex, highlighted green, and wt, highlighted blue, have all boxes unchecked, so no covariate relationship is included.


Here, an unchecked box in the line of the parameter V and the column of the covariate wt means that there is no relationship between weight and volume in the model. A diagnosis plot Individual parameters vs covariates is generated which displays possible relationships between covariates and individual parameters (even if these covariates are not used in the model):


Monolix Individual parameters versus covariates plot. Left column shows scatterplots of log Tlag, log ka, log V and log Cl versus weight wt with regression lines and correlations of 0.0306, 0.15, 0.716 and 0.369. Right column shows boxplots versus sex 0 and 1, where log V is clearly higher for sex 1. Strong links appear between V and both wt and sex, and between Cl and wt.


On the figure, we can see a strong correlation between the volume V and both the weight wt and the sex. One can also see a correlation between the clearance and the weight wt. Therefore, the next step is to add some covariate to our model.

  • warfarin_covariate2_project (data = ‘warfarin_data.txt’, model = ‘lib:oral1_1cpt_TlagkaVCl.txt’)

We decide to use the weight in this project in order to explain part of the variability of and . We will implement the following model for these two parameters:

which means that population parameters of the PK parameters are defined for a typical individual of the population with weight = 70kg.

More details about the model
The model for and can be equivalently written as follows:

The individual predicted values for and are therefore

and the statistical model describes how and are distributed around these predicted values:

Here, and are linear functions of : we then need to transform first the original covariate into by clicking on the button CONTINUOUS next to ADD COVARIATE (blue button). Then, the following pop up arises


Monolix dialog Define a new continuous covariate. A tooltip over the available covariate wt, framed in purple, shows min 40, mean 70.0031, median 71.65, max 102, weighted mean 67.9436. Name is lw70, framed in blue, and Formula is log of wt divided by 70, framed in green, with CANCEL and ACCEPT buttons.


You have to

  • define the name of the covariate you want to add (the blue frame),

  • define the associated equation (the green frame),

  • click on the ACCEPT button.

Remarks

  • You can define any formula for your covariate as long as you use mathematical functions available in the Mlxtran language.

  • You can use any covariate available in the list of covariates proposed in the window. Thus, if you have a Height and Weight as covariates, you can directly compute the Body Mass Index.

  • If you go over a covariate with your mouse, all the information (min, mean, median, max and weighted mean) are displayed as a tooltip. The weighted mean is defined as

where is the number of observation for the i-th individual and is the total number of observations.

  • If you click on the covariate name, it will be written in the formula.

  • You can use this formula box to replace missing continuous covariate values by an imputed value. This is explained in the Feature of the Week #141 below.For example, if your continuous covariate takes only positive values, you can use a negative value for the missing values in your dataset, for example -99, and enter the following formula: max(COV,0) + min(COV,0)/COV*ImputedValue with the desired ImputedValue (COV is the name of your covariate).

We then define a new covariate model, where and are linear functions of the transformed weight as shown on the following figure:


Monolix Individual model panel with the FORMULA display. Equations framed in green show log V equals log V_pop plus beta_V_lw70 times lw70 plus eta_V, and the same for Cl. In the covariate table the lw70 column, framed in green, is checked for V and Cl only, while sex and wt stay unchecked. All four parameters are lognormal.


Notice that by clicking on the button FORMULA, you have the display of all the individual model equations. Coefficients and are now estimated with their s.e. and the p-values of the Wald tests are derived to test if these coefficients are different from 0.
Again, a diagnosis plot Individual parameters vs covariates is generated which displays possible relationships between covariates and individual parameters (even if these covariates are not used in the model) as one can see on the figure below on the left. However, as there are covariates on the model, what is interesting is to see if there still are correlation between the random effects and the covariates as one can see on the figure below on the right.


Monolix Individual parameters vs covariates plot. Rows are log Tlag, log ka, log V and log Cl, columns are lw70, wt and sex. Scatter plots show regression lines and correlation values. log V has strong correlations of about 0.79 with lw70 and wt and higher values for sex 1, and log Cl about 0.39 and 0.38. Tlag and ka show weak correlations below about 0.14.



Monolix plot of random effects versus covariates for the model with lw70 on V and Cl. Rows are eta Tlag, eta ka, eta V and eta Cl, columns are lw70, wt and sex. Regression lines for eta V and eta Cl are flat with correlations near zero, about minus 0.002 to minus 0.017, showing the weight effect is now captured. Tlag and ka keep weak correlations up to about 0.14.


Note: To make it automatic, starting from the 2019 version, there is an arrow next (in purple in the next figure) to the continuous covariate from the data set and propose to add a log transformed covariate centered by the weighted mean.


Monolix Individual model panel with parameters Tlag, ka, V and Cl, all lognormal, and covariate columns sex and wt, all unchecked. The dropdown arrow next to the wt column header is framed in purple. It offers to add a log transformed covariate centered by the weighted mean.


Model with categorical covariates

  • warfarin_covariate3_project (data = ‘warfarin_data.txt’, model = ‘lib:oral1_1cpt_TlagkaVCl.txt’)

We use sex instead of weight in this project, assuming different population values of volume and clearance for males and females. More precisely, we consider the following model for and :

where if individual i is a female and 0 otherwise. Then, and are the population volume and clearance for males while and are the population volume and clearance for females. By clicking on the purple button DISCRETE, the following window pops up


Monolix dialog Define a new categorical covariate, function of SEX. The Name field, framed in blue, contains tSex. The original categories 0 and 1, framed in green, wait to be grouped, with RESET and ALLOCATE links. CANCEL and ACCEPT buttons are at the bottom.


You have to

  • define the name of the covariate you want to add (the blue frame),

  • define the associated categories (the green frame),

  • click on the ALLOCATE button to define all the categories.

Then, you can

  • define the name of the categories (the blue frame),

  • define the reference category (the green frame),

  • click on ACCEPT.

Then, define the covariate model in the main GUI:


Monolix Individual model panel with covariate columns lw70, sex, tsex and wt. The tsex column, framed in green, is checked for V and Cl and unchecked for Tlag and ka. All other covariate boxes are unchecked and all four parameters are lognormal with random effects.


Estimated population parameters, including the coefficients and are displayed with the results:


Monolix table of population parameter estimates by stochastic approximation with values, s.e., r.s.e. and p-values. Fixed effects include V_pop 8.53, beta_V_tSex_F minus 0.375 with p-value 7.34e-06, Cl_pop 0.134 and beta_Cl_tSex_F minus 0.096 with p-value 0.501 and r.s.e. 149 percent. Also shown are omega values for Tlag, ka, V and Cl and error parameters a 0.261 and b 0.0574.


We can display the probability distribution functions of the 4 PK parameters using the Individual parameter graphic:


Monolix individual parameter distribution plot with four panels for Tlag, ka, V and Cl. Each shows a histogram of the empirical distribution of individual parameters with a dashed theoretical density curve. V centers around 8 and Cl around 0.12. Because of the sex covariate, the theoretical curves for V and Cl are not lognormal densities.


Notice that for the volume and the clearance, the theoretical curve is not the PDF of a lognormal distribution, due to the impact of the covariate sex. 

Calculating the typical value for each category

Cl_pop represents the typical value for the reference category (in the example above SEX=0). The typical value for the other categories can be calculated based on the estimated beta parameters:

  • normal distribution:

  • lognormal distribution:

  • logit distribution:

In version 2024R1 on, typical values for each category of each categorical covariate in the individual model can be displayed in the table of population parameters with the toggle “Display fixed effects by category”.


Transforming categorical covariates

  • phenobarbital_project (data = ‘phenobarbital_data.txt’, model = ‘lib:bolus_1cpt_Vk.txt’)

The phenobarbital data contains 2 covariates: the weight and the APGAR score which is considered as a categorical covariate. Instead of using the 10 original levels of the APGAR score, we will transform this categorical covariate and create 3 categories: Low = {1,2,3}, Medium = {4, 5, 6, 7} and High={8,9,10}.


Monolix dialog Edit tAPGAR grouping the APGAR score levels into three categories. High contains 8, 9 and 10, Low contains 1, 2 and 3, and Med contains 4, 5, 6 and 7. The Ref. radio button is selected for Med, making it the reference category. CANCEL and ACCEPT buttons are at the bottom.


If we assume, for instance that the volume is related to the APGAR score, then and are estimated (assuming that Medium is the reference level).


Monolix table of population parameter estimates by stochastic approximation for the phenobarbital model. V_pop is 1.26, beta_V_tAPGAR_High is 0.253 with p-value 0.028, beta_V_tAPGAR_Low is 0.113 with r.s.e. 151 percent and p-value 0.508, and k_pop is 0.0047. Also shown are omega_V 0.4, omega_k 0.165 and error parameter b 0.114.


In that case, one can see that both p-values concerning the transformed APGAR covariate are over .05.

The same covariate effect for several parameters

Adding a covariate effect on a parameter in the Individual Model section of the Statistical Model and Tasks tab, creates automatically a corresponding beta parameter (population parameter) that describes the strength of the effect. For example, adding weight WT on a parameter volume V1 creates beta_V1_WT. If you add the same covariate effect on two different parameters, eg. V1 and V2, then Monolix will create two corresponding parameters: beta_V1_WT and beta_V2_WT.

If you need to add the same covariate effect for several parameters, eg. have only one parameter betaWT for both V1 and V2 in the example above, then this covariate effect has to be implemented in the structural model directly. It requires:

  • Reading weight WT from the dataset, so the columnt WT in the dataset has to be tagged as a regressor (not covariate)

  • Defining in the model new volumes with the covariate effect (sample code below, based on a two-compartment model from the PK library)

    [LONGITUDINAL]
    input = {WT, betaWT, ka, Cl, V1, Q2, V2}
    WT = {use=regressor}
    
    PK:
    ; Effect of WT on V1, V2
    V1_withWT = V1*exp(betaWT*WT)
    V2_withWT = V2*exp(betaWT*WT)
    
    ; Parameter transformations
    V = V1_withWT
    k12 = Q2/V1_withWT
    k21 = Q2/V2_withWT
    
    ; PK model definition
    Cc = pkmodel(ka, V, Cl, k12, k21)
    
    OUTPUT:
    output = {Cc}
    
  • In the Individual model in the GUI, set normal distribution for “betaWT” – to allow positive and negative values, and remove random effects from it – they are already included in the parameters V1, V2.

This method gives more flexibility for more complex paramter-covariate relationships,  also to include time-varying covariates in the model. However, remember that when you add covariate effects in the structural model – the statistical tests are not available for these relationships. Also, Monolix is more efficient when covariate effects are added in the GUI, as the algorithm “see” that V and beta_V_WT are related, and it improves the stability.

Last updated: