Hello,
My question is in the title.
How to model right censored data in the textual mode ?
Thanks.
Best regards.
Hello,
My question is in the title.
How to model right censored data in the textual mode ?
Thanks.
Best regards.
Sorry i forgot to specify in phoenix NLME 6.4.
Thanks
Hi genngauderat,
Phoenix textual mode enables you to use the Phoenix modeling language pml to write down your likelihood:
for example, suppose you want to tell it that if EOBS was above ULQ you want the portion of the integral above the ULQ.
and if not you want the normal likelihood:
PML has the LL statement and also the handy phi and lnorm functions :
LL(EObs
, (EObs >= ULQ
? log(1-phi( nUOQ ))
: lnorm( EObs - E, stdev)
)
)
lnorm implement the normal distribution log likelihood while phi is the cumulative distribution function of a normal distribution. Your response should be normalized to usually within the code you do something like this
ULQ=1000
stdev=cv*E
covariate(EObscovariate)
nE=(EObscovariate - E)/stdev
fixef(cv=c(,0.1,))
nUOQ=(ULQ-E)/stdev
All these models are sometimes called tobit models and the likelihood definition is well known you just need to learn how to code it in pml or other programming languages:
https://stats.idre.ucla.edu/sas/code/random-effect-tobit-model-in-nlmixed/
OK so unlike for LOQ I have to code my own LL statement. Thank you very much for your help !
Sorry to bother you again but I have some troube understanding this code.
I have never tried to code my own LL statement in NLME and there is litte explanation on the LL statement and the language in the NLME user guide.
In NONMEM it could be done like this :
LOQ=6
STD=W
IF(ALQ.EQ.0) THEN ;
F_FLAG=0
Y=IPRED+ERR(1)*W
ENDIF
IF(ALQ.EQ.1) THEN ;
DUM=(IPRED-LOQ)/STD
the difference with LOQ is there , for lefts sensored data it would have been : DUM=(LOQ-IPRED)/W.
CUM=PHI(DUM)
F_FLAG=1
Y=CUM
MDVRES=1
IRES = 0
IWRES=0
ENDIF
I would like to get the equivalent code in NLME , with the possibility to use a flag column to specify is the data is censored or not .
This is because I have in my dataset some values quantified above the ULQ ( because they have been diluted and re-assayed).
Could you provide an example for that with an additive residual error ?
Also I dont understand the “covariate(EObscovariate)” statement in your code. Could you explain what it is ?
Thanks
Regards.
Hi
your nonmem code has a fixed LOQ and it uses an ALQ flag that you included in your data and that you defined in
$INPUT
ALQ =0 no ALQ if ALQ =1 then the obs is indeed ALQ in phoenix code above we test within the code if EObs is above ALQ but if you have a flag ALQ you can use it
the same code in phoenix would be:
LOQ=6
stdev=Ceps*W
DUM=(E-LOQ)/stdev# E is your IPRED
LL(EObs
, (ALQ == 0
? lnorm( EObs - E, stdev) # this is the “normal” observation LL
: log(phi( DUM)) # note that 1 - phi (x) = phi (-x)
)
)
To be able to really help we need a full project with some dummy data and model
Hi,
Thanks again.
OK I get the meaning of “lnorm”, “?” and “:” now. Thank you.
But what if we have a more complex situation?
Here is an example of data with C1 beeing left censored, and C2 right censored.
C2 is right sensored above 100 for some measurment but not always and some times the ULQ is just higher (150).
There are three models, one with an additive RUV, one with a proportional RUV and one with a combined additive prop error.
Thank you very much !
test data.phxproj (225 KB)
to answer you quickly (without opening your project)
you can have multiple LL statements
LL(EObs1
, (ALQ2 == 0
? lnorm( EObs - E, stdev) # this is the “normal” observation LL
: log(phi( DUM)) # note that 1 - phi (x) = phi (-x)
)
)
LL(EObs2
, (ALQ2 == 0
? lnorm( EObs - E, stdev) # this is the “normal” observation LL
: log(phi( DUM)) # note that 1 - phi (x) = phi (-x)
)
)
where you can have EObs2 LL censoring on the left instead of on the right.
each LL and endpoint can have its own error model
If the LOQ and or ALQ level is not the same for all observations then you can map it as a covariate that changes with observation and then your DUM calculation will take this into account so we integrate up to or form to the correct threshold.
Samer