# Covariates with potential interaction

**URL:** <https://forum.certara.com/t/covariates-with-potential-interaction/3691>\
**Category:** Modelling and Simulation\
**Created:** [July 11, 2023, 3:24am UTC](https://forum.certara.com/t/covariates-with-potential-interaction/3691 "2023-07-11T03:24:16Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![joybaker](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@joybaker](https://forum.certara.com/u/joybaker)\
**Post date:** [July 11, 2023, 3:24am UTC](https://forum.certara.com/t/covariates-with-potential-interaction/3691/1 "2023-07-11T03:24:16Z")

</div>

Hi,

I see no one ask similar questions. Do you have any suggestions for the PML if I believe there are some interactions for covariates.

See the graph below that I think dose is correlated with f, while in fasted (1,left) and fed (2, right), the correlation (or slope extent) is different.

I have tried to regard them as separate covariates:

stparm(f = ilogit(tvf + DOSE\*dfdDOSE+ (FOOD==2)\*dfdFOOD2 + nf))

however the prediction is leveraged in lower and upper end of the dose.

Do you have advise for PML to describe this, I use the following but might be good to have more suggestion?

stparm(f = ilogit(tvf + DOSE_dfdDOSE1 + DOSE_dfdDOSE2 \* (FOOD==2)\*dfdFOOD2 + nf))

---

<div class="post-metadata">

**Author:** ![joybaker](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@joybaker](https://forum.certara.com/u/joybaker)\
**Post date:** [July 11, 2023, 3:28am UTC](https://forum.certara.com/t/covariates-with-potential-interaction/3691/2 "2023-07-11T03:28:46Z")

</div>

I also tried DOSE/100 and log(DOSE) to sort of standardise it. But I haven’t got any results that can give decent prediction for all doses (100 mg underestimate for example)

---

<div class="post-metadata">

**Author:** ![Samer\_Mouksassi](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Samer\_Mouksassi](https://forum.certara.com/u/Samer_Mouksassi)\
**Post date:** [July 11, 2023, 6:11am UTC](https://forum.certara.com/t/covariates-with-potential-interaction/3691/3 "2023-07-11T06:11:34Z")

</div>

Hi,

this model has no interaction between dose and food effects on f

stparm(f = ilogit(tvf + DOSE\*dfdDOSE+ (FOOD==2)\*dfdFOOD2 + nf))

the second model should be written in standard statistics way examples

stparm(f = ilogit(tvf +

DOSE\*dfdDOSE +

(FOOD==2)\*dfdFOOD2 +

DOSE\*(FOOD==2)\* dfdDOSEFOOD2

nf))

you can still standardize your continuous covariates or make transfromation of:

stparm(f = ilogit(tvf +

log(DOSE/100)\*dfdDOSE +

(FOOD==2)\*dfdFOOD2 +

log(DOSE/100)_(FOOD==2)_ dfdDOSEFOOD2

nf))

the above is trying to estimate a different food effect depending on dose

not sure what ranges of doses you have and what nonlinearities you are facing

---

<div class="post-metadata">

**Author:** ![joybaker](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@joybaker](https://forum.certara.com/u/joybaker)\
**Post date:** [July 11, 2023, 2:42pm UTC](https://forum.certara.com/t/covariates-with-potential-interaction/3691/4 "2023-07-11T14:42:54Z")

</div>

Thanks Smoukassi, your suggestion is very helpful.

Sorry to attach the figure in the question.

The first term you suggested didn’t give good prediction for the two ends (100 and 2000 mg), but the log scale gave decent prediction across all doses.

I wonder this is the because the f-Dose correlation is slight tilted-up (rather than straight linear). What kind of terms I can use if it is even more curved?

> [@smouksassi1](#):
>
> Hi,
> 
> this model has no interaction between dose and food effects on f
> 
> stparm(f = ilogit(tvf + DOSE\*dfdDOSE+ (FOOD==2)\*dfdFOOD2 + nf))
> 
> the second model should be written in standard statistics way examples
> 
> stparm(f = ilogit(tvf +
> 
> DOSE\*dfdDOSE +
> 
> (FOOD==2)\*dfdFOOD2 +
> 
> DOSE\*(FOOD==2)\* dfdDOSEFOOD2
> 
> nf))
> 
> you can still standardize your continuous covariates or make transfromation of:
> 
> stparm(f = ilogit(tvf +
> 
> log(DOSE/100)\*dfdDOSE +
> 
> (FOOD==2)\*dfdFOOD2 +
> 
> log(DOSE/100)_(FOOD==2)_ dfdDOSEFOOD2
> 
> nf))
> 
> the above is trying to estimate a different food effect depending on dose
> 
> not sure what ranges of doses you have and what nonlinearities you are facing

 ![111.png](https://us1.discourse-cdn.com/certara/original/2X/3/3bea6a0c0b163e8be4e9262bf5d57603cf5ecc8d.png)

---

<div class="post-metadata">

**Author:** ![Samer\_Mouksassi](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Samer\_Mouksassi](https://forum.certara.com/u/Samer_Mouksassi)\
**Post date:** [July 13, 2023, 11:37am UTC](https://forum.certara.com/t/covariates-with-potential-interaction/3691/5 "2023-07-13T11:37:30Z")

</div>

I see a power model shape can accomodate this curvature

---

<div class="post-metadata">

**Author:** ![joybaker](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@joybaker](https://forum.certara.com/u/joybaker)\
**Post date:** [July 17, 2023, 2:08am UTC](https://forum.certara.com/t/covariates-with-potential-interaction/3691/6 "2023-07-17T02:08:43Z")

</div>

Thank you for the reply.

Another question to ask, if I want to check how that model fit with my observed data in VPC and stratified by DOSE, should I define another DOSE column as categorical parameter so that I can check it in VPC (as it was done as continious factor previously to predict other doses)?

> [@smouksassi1](#):
>
> I see a power model shape can accomodate this curvature

---

<div class="post-metadata">

**Author:** ![joybaker](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@joybaker](https://forum.certara.com/u/joybaker)\
**Post date:** [July 17, 2023, 6:14am UTC](https://forum.certara.com/t/covariates-with-potential-interaction/3691/7 "2023-07-17T06:14:52Z")

</div>

Apologies this post has been modified as I can’t delete it

Just realize log() means ln()

---

<div class="post-metadata">

**Author:** ![Samer\_Mouksassi](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Samer\_Mouksassi](https://forum.certara.com/u/Samer_Mouksassi)\
**Post date:** [July 17, 2023, 11:00am UTC](https://forum.certara.com/t/covariates-with-potential-interaction/3691/8 "2023-07-17T11:00:56Z")

</div>

no worries for vpc you can yes have a copy of dose where you use one as continious and the other as categorical

fcovariate(dosecat() great that you calculation are now working yes log is natural log ln bests

---

<div class="post-metadata">

**Author:** ![Samer\_Mouksassi](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Samer\_Mouksassi](https://forum.certara.com/u/Samer_Mouksassi)\
**Post date:** [July 17, 2023, 1:57pm UTC](https://forum.certara.com/t/covariates-with-potential-interaction/3691/9 "2023-07-17T13:57:56Z")

</div>

if you have R you can try the attached code

tvf = 0.7653  
dfdFOOD2 = 3.1847  
dfdDOSE = -0.7636  
dfdDOSEFOOD2 = - 0.1564  
ilogit ← function(x) {exp(x)/(1+exp(x))}

nf ← 0  
DOSE ← seq(100,500,100)

FOOD=1  
frel\_DOSE\_food1 = ilogit(tvf + log(DOSE/100) \* dfdDOSE + (FOOD==2)_dfdFOOD2 +  
log(DOSE/100)_(FOOD==2)\*dfdDOSEFOOD2 + nf)

FOOD=2  
frel\_DOSE\_food2 = ilogit(tvf + log(DOSE/100) \* dfdDOSE + (FOOD==2)_dfdFOOD2 +  
log(DOSE/100)_(FOOD==2)\*dfdDOSEFOOD2 + nf)

data.frame(DOSE= c(DOSE,DOSE),  
frel=c(frel\_DOSE\_food1,frel\_DOSE\_food2 ),  
FOOD =c(rep(1,5),rep(2,5))  
) %\>%  
ggplot(data=.,aes(DOSE,frel,color=factor(FOOD)))+  
geom\_line(aes(group=FOOD))+  
geom\_point(shape=21,fill=“white”,size=10)+  
geom\_text(aes(DOSE,frel,label=round(100\*frel,1)),fontface =“bold”)  
FOOD=2  
DOSE ← seq(100,500,100)  
frel\_DOSE\_food2 = ilogit(tvf + log(DOSE/100) \* dfdDOSE + (FOOD==2)_dfdFOOD2 +  
log(DOSE/100)_(FOOD==2)\*dfdDOSEFOOD2 + nf)

 ![frelvalues.png](https://us1.discourse-cdn.com/certara/original/2X/7/7c9ff8c72ccc957923dc0d57dad3a1a9c3c6a5af.png)
