Jakob,
Yes, in the pooled dataset from different studies, one dataset didn’t have BMI values. Initially, I used “missing_values_token” option in the PsN command line and by default it is -99. However, power model still gave errors. Now I just checked the dataset in model run directory and it shows that despite using that option, PsN never replaced missing values with -99. Maybe, I should manually enter it and run it again. Also, because its negative value, I thought it doesnt make sense, and instead I provided median BMI in place of missing values. Didn’t work that way either.
Regards,
Sumeet Singla
On Nov 19, 2019, at 11:10 PM, Jakob Ribbing <jakob.ribbing
Hi Sumeet,
It is great that you have considered already that covarite values do not include zero or negative values, as that would not work with the power model.
Did you have any missing values, and how were they coded?
I would recommend to code these (in your data file) using the default -99 in your datafile.
You can check the PsN file “covariate_statistics.txt” for your scm run: For BMI in particular, were there missing values detected by PsN and is the minimum value >0 or is it -99?
Best regards
Jakob
On 20 Nov 2019, at 05:42, Singla, Sumeet K <sumeet-singla
Hello Everyone,
I am using PsN enabled SCM option in Pirana to analyze selection of covariates in the PK 2- Comp model. As long as I am using just linear and exponential covariate model, everything runs fine. However, as soon as I add power-model in the mix, “some” power models involving continuous covariates on parameters fail to run and it gives me the following error:
“HESSIAN OF POSTERIOR DENSITY IS NON-POSITIVE-DEFINITE DURING SEARCH”
I understand that individual PK parameter search might be moving into 0 or negative territory. I am trying to fix it but didn’t have much success. I have set lower bounds, removed lower bounds, changed order of model in valid states option in scm configuration file, dataset doesn’t contain any 0 or negative value, but nothing is working. FYI: I don’t need to test hockey-stick relation as literature and data doesn’t support it, power model can only be used on continuous covariates and I have turned on parallel states option.
This is how part of my scm results, followed by scm configuration file, followed by base model for PK 2-Comp looks like:
MODEL TEST BASE OFV NEW OFV TEST OFV (DROP) GOAL dDF SIGNIFICANT PVAL
CLAGE-2 PVAL 2618.02603 2616.67228 1.35375 > 3.84150 1 0.244620
CLAGE-5 PVAL 2618.02603 2616.36273 1.66330 > 3.84150 1 0.197160
CLAGE-4 PVAL 2618.02603 2616.65232 1.37371 > 3.84150 1 0.241180
CLBMI-2 PVAL 2618.02603 2612.96657 5.05946 > 3.84150 1 YES! 0.024492
CLBMI-5 PVAL 2618.02603 FAILED FAILED > 3.84150 1 999
SCM FILE:
“
search_direction=both
p_forward=0.05
p_backward=0.01
continuous_covariates=BMI,AGE
categorical_covariates=USER,SEX
parallel_states=1
retries=2
threads=6
tweak_inits=1
;;1-NotIncluded, 2-LINEAR, 3-Hockey Stick Relation, 4-Exponential, 5-Power
[test_relations]
CL=AGE,SEX,BMI,USER
V1=AGE,SEX,BMI,USER
V2=AGE,SEX,BMI,USER
Q=AGE,SEX,BMI,USER
[valid_states]
continuous = 1,2,5,4
categorical = 1,2
“
NONMEM Control Stream:
$SUBROUTINE ADVAN3 TRANS4
$PK
TVV1 = THETA(1) ;Central Volume of distribution in L
V1 = TVV1*EXP(ETA(1))
TVCL = THETA(2)
CL = TVCL*EXP(ETA(2)) ; Clearance L/h
TVQ = THETA(3)
Q = TVQ*EXP(ETA(3)) ;Intercompartment Clearance
TVV2 = THETA(4)
V2 = TVV2*EXP(ETA(4)) ;Peripheral volume in L
S1=V1
$ERROR
IPRED=F
Y= F + F*ERR(1); Proportional Error
$THETA
(0, 16); [V1] based on PK 2 Comp
(0, 255); [CL] based on PK 2 Comp
(0, 33.5); [Q] based on PK 2 Comp
(0, 29.7); [V2] based on PK 2 Comp
$OMEGA
(0, 0.08); [P] omega(1,1)
(0, 0.159); [P] omega(2,2)
(0, 0.140); [P] omega(3,3)
(0, 0.19); [P] omega(4,4)
$SIGMA
(0, 0.06) ;sigma1
$EST METHOD=1 PRINT=5 MAXEVAL=9999 SIG=3 NOABORT
Regards,
Sumeet K. Singla
Ph.D. Candidate
Division of Pharmaceutics and Translational Therapeutics
College of Pharmacy | University of Iowa
Iowa City, Iowa
sumeet-singla
518.577.5881
Error in Power-model for covariate selection
4 messages
2 people
Latest: Nov 21, 2019
Hi Sumeet,
PsN does not change in the dataset so that -99 becomes the median value, it is handled in the code (the nonmem control stream).
This is why you need to check the file “covariate_statistics.txt to see that PsN understood these were missing values.
For example, reading in a datafile in R, the option na.strings=“-99” would not understand -99.0 or scientific notation as NA.
However, you can also leave scm aside for a while and just manually run the problematic model with BMI on CL*.
Add the below lines to your base model (or locate the problematic run created by scm, and work with that).
Not related to this, but very important, I think you need to add INTER on the $EST line, as you have a proportional error model:
F*ERR(1) means you have an eta-eps interaction in your model), it would not have been needed for additive error on the log-transformed scale.
However, apparently with modern nonmem it is fine to always use FOCE INTER, even if not needed (i.e. even if there is no eta-eps interaction)- it should not be slower or less stable.
Start with some code that will make nonmem exit if there are negative BMI values - without this line nonmem would run the power model for BMI as intended,
But the purpose is to find out why it is not working in scm.
For example, it may be that you have some BMI values that are “., instead of numeric values. Nonmem will interpret these as zero. Not sure what PsN would do...
Best wishes
Jakob
Add these lines:
IF(BMI.LE.0) EXIT 11
TVCL = THETA(2)
IF(BMI.GT.0) TVCL = (BMI/25)**THETA(5)
CL = TVCL*EXP(ETA(2)) ; Clearance L/h
; Initial estimates
THETA 0.001; BMI.on.CL; 5.
*As a side note, one would not normally test all covariates on all parameters (using multiple equations). But let’s focus at the technical question in this thread.
Quoted reply history
> On 20 Nov 2019, at 06:23, Singla, Sumeet K <sumeet-singla
wrote:
>
> Jakob,
>
> Yes, in the pooled dataset from different studies, one dataset
didn’t have BMI values. Initially, I used “missing_values_token” option in the PsN command line and by default it is -99. However, power model still gave errors. Now I just checked the dataset in model run directory and it shows that despite using that option, PsN never replaced missing values with -99. Maybe, I should manually enter it and run it again. Also, because its negative value, I thought it doesnt make sense, and instead I provided median BMI in place of missing values. Didn’t work that way either.
>
> Regards,
> Sumeet Singla
>
>
>
>> On Nov 19, 2019, at 11:10 PM, Jakob Ribbing
<jakob.ribbing
>>
>> Hi Sumeet,
>>
>> It is great that you have considered already that covarite values do
not include zero or negative values, as that would not work with the power model.
>> Did you have any missing values, and how were they coded?
>>
>> I would recommend to code these (in your data file) using the default
-99 in your datafile.
>> You can check the PsN file “covariate_statistics.txt”
for your scm run: For BMI in particular, were there missing values detected by PsN and is the minimum value >0 or is it -99?
>>
>> Best regards
>>
>> Jakob
>>
>>> On 20 Nov 2019, at 05:42, Singla, Sumeet K <sumeet-singla
<mailto:sumeet-singla
>>>
>>> Hello Everyone,
>>>
>>> I am using PsN enabled SCM option in Pirana to analyze selection of
covariates in the PK 2- Comp model. As long as I am using just linear and exponential covariate model, everything runs fine. However, as soon as I add power-model in the mix, “some” power models involving continuous covariates on parameters fail to run and it gives me the following error:
>>> “HESSIAN OF POSTERIOR DENSITY IS NON-POSITIVE-DEFINITE
DURING SEARCH”
>>> I understand that individual PK parameter search might be moving
into 0 or negative territory. I am trying to fix it but didn’t have much success. I have set lower bounds, removed lower bounds, changed order of model in valid states option in scm configuration file, dataset doesn’t contain any 0 or negative value, but nothing is working. FYI: I don’t need to test hockey-stick relation as literature and data doesn’t support it, power model can only be used on continuous covariates and I have turned on parallel states option.
>>> This is how part of my scm results, followed by scm configuration
file, followed by base model for PK 2-Comp looks like:
>>>
>>> MODEL TEST BASE OFV NEW OFV TEST OFV
(DROP) GOAL dDF SIGNIFICANT PVAL
>>> CLAGE-2 PVAL 2618.02603 2616.67228 1.35375
> 3.84150 1 0.244620
>>> CLAGE-5 PVAL 2618.02603 2616.36273 1.66330
> 3.84150 1 0.197160
>>> CLAGE-4 PVAL 2618.02603 2616.65232 1.37371
> 3.84150 1 0.241180
>>> CLBMI-2 PVAL 2618.02603 2612.96657 5.05946
> 3.84150 1 YES! 0.024492
>>> CLBMI-5 PVAL 2618.02603 FAILED FAILED
> 3.84150 1 999
>>>
>>> SCM FILE:
>>> “
>>> search_direction=both
>>> p_forward=0.05
>>> p_backward=0.01
>>> continuous_covariates=BMI,AGE
>>> categorical_covariates=USER,SEX
>>> parallel_states=1
>>> retries=2
>>> threads=6
>>> tweak_inits=1
>>> ;;1-NotIncluded, 2-LINEAR, 3-Hockey Stick Relation, 4-Exponential,
5-Power
>>> [test_relations]
>>> CL=AGE,SEX,BMI,USER
>>> V1=AGE,SEX,BMI,USER
>>> V2=AGE,SEX,BMI,USER
>>> Q=AGE,SEX,BMI,USER
>>> [valid_states]
>>> continuous = 1,2,5,4
>>> categorical = 1,2
>>> “
>>> NONMEM Control Stream:
>>>
>>> $SUBROUTINE ADVAN3 TRANS4
>>>
>>> $PK
>>>
>>> TVV1 = THETA(1) ;Central Volume of
distribution in L
>>> V1 = TVV1*EXP(ETA(1))
>>> TVCL = THETA(2)
>>> CL = TVCL*EXP(ETA(2)) ; Clearance L/h
>>> TVQ = THETA(3)
>>> Q = TVQ*EXP(ETA(3)) ;Intercompartment Clearance
>>> TVV2 = THETA(4)
>>> V2 = TVV2*EXP(ETA(4)) ;Peripheral volume in L
>>> S1=V1
>>>
>>> $ERROR
>>> IPRED=F
>>> Y= F + F*ERR(1); Proportional Error
>>>
>>> $THETA
>>> (0, 16); [V1] based on PK 2 Comp
>>> (0, 255); [CL] based on PK 2 Comp
>>> (0, 33.5); [Q] based on PK 2 Comp
>>> (0, 29.7); [V2] based on PK 2 Comp
>>>
>>> $OMEGA
>>> (0, 0.08); [P] omega(1,1)
>>> (0, 0.159); [P] omega(2,2)
>>> (0, 0.140); [P] omega(3,3)
>>> (0, 0.19); [P] omega(4,4)
>>>
>>> $SIGMA
>>> (0, 0.06) ;sigma1
>>>
>>> $EST METHOD=1 PRINT=5 MAXEVAL99 SIG=3 NOABORT
>>>
>>>
>>> Regards,
>>>
>>> Sumeet K. Singla
>>> Ph.D. Candidate
>>> Division of Pharmaceutics and Translational Therapeutics
>>> College of Pharmacy | University of Iowa
>>> Iowa City, Iowa
>>> sumeet-singla
>>> 518.577.5881
>>
I figured out the problem. Apparently, SCM in PsN, by default sets a very large lower and upper limits for thetas of covariate-parameter relationship, if you don’t provide those bounds. NONMEM runs into numerical difficulty when raising a very small or very big quantity to a power of say 10000.There is a way around it. Set this in your configuration file as shown below:
[lower_bounds]
V2:USER-5 = -5
[inits]
V2:USER-5= 0.1
[upper_bounds]
V2:USER-5 = 5
You can define as many “parameter:covariate-model” as you want, in the above format. Note that, order should be: lower_bound, inits, upper bound, and if you are defining more than one parameter-covariate relation, they should be in same order in lower_bound, inits and upper_bounds section.
Regards,
Sumeet
Quoted reply history
From: Ayyappa Chaturvedula <ayyappach
Sent: Wednesday, November 20, 2019 8:27 AM
To: Singla, Sumeet K <sumeet-singla umeet-singla
Cc: nmusers to:nmusers
Subject: [External] Re: [NMusers] Error in Power-model for covariate selection
Hi Sumeet:
Couple of points, may not be solutions for the modeling problem you are having but in general:
1. Use INTERACTION in your $EST because you are using proportional error
2. Make sure you have enough range of covariates in the data to describe the relationships quantitatively
3. Are there any correlated covariates that you are trying to include same time?
4. Try fitting the model out of SCM for power function and try to find the issue.
Regards,
Ayyappa
On Nov 19, 2019, at 10:48 PM, Singla, Sumeet K <sumeet-singla
Hello Everyone,
I am using PsN enabled SCM option in Pirana to analyze selection of covariates in the PK 2- Comp model. As long as I am using just linear and exponential covariate model, everything runs fine. However, as soon as I add power-model in the mix, “some” power models involving continuous covariates on parameters fail to run and it gives me the following error:
“HESSIAN OF POSTERIOR DENSITY IS NON-POSITIVE-DEFINITE DURING SEARCH”
I understand that individual PK parameter search might be moving into 0 or negative territory. I am trying to fix it but didn’t have much success. I have set lower bounds, removed lower bounds, changed order of model in valid states option in scm configuration file, dataset doesn’t contain any 0 or negative value, but nothing is working. FYI: I don’t need to test hockey-stick relation as literature and data doesn’t support it, power model can only be used on continuous covariates and I have turned on parallel states option.
This is how part of my scm results, followed by scm configuration file, followed by base model for PK 2-Comp looks like:
MODEL TEST BASE OFV NEW OFV TEST OFV (DROP) GOAL dDF SIGNIFICANT PVAL
CLAGE-2 PVAL 2618.02603 2616.67228 1.35375 > 3.84150 1 0.244620
CLAGE-5 PVAL 2618.02603 2616.36273 1.66330 > 3.84150 1 0.197160
CLAGE-4 PVAL 2618.02603 2616.65232 1.37371 > 3.84150 1 0.241180
CLBMI-2 PVAL 2618.02603 2612.96657 5.05946 > 3.84150 1 YES! 0.024492
CLBMI-5 PVAL 2618.02603 FAILED FAILED > 3.84150 1 999
SCM FILE:
“
search_direction=both
p_forward=0.05
p_backward=0.01
continuous_covariates=BMI,AGE
categorical_covariates=USER,SEX
parallel_states=1
retries=2
threads=6
tweak_inits=1
;;1-NotIncluded, 2-LINEAR, 3-Hockey Stick Relation, 4-Exponential, 5-Power
[test_relations]
CL=AGE,SEX,BMI,USER
V1=AGE,SEX,BMI,USER
V2=AGE,SEX,BMI,USER
Q=AGE,SEX,BMI,USER
[valid_states]
continuous = 1,2,5,4
categorical = 1,2
“
NONMEM Control Stream:
$SUBROUTINE ADVAN3 TRANS4
$PK
TVV1 = THETA(1) ;Central Volume of distribution in L
V1 = TVV1*EXP(ETA(1))
TVCL = THETA(2)
CL = TVCL*EXP(ETA(2)) ; Clearance L/h
TVQ = THETA(3)
Q = TVQ*EXP(ETA(3)) ;Intercompartment Clearance
TVV2 = THETA(4)
V2 = TVV2*EXP(ETA(4)) ;Peripheral volume in L
S1=V1
$ERROR
IPRED=F
Y= F + F*ERR(1); Proportional Error
$THETA
(0, 16); [V1] based on PK 2 Comp
(0, 255); [CL] based on PK 2 Comp
(0, 33.5); [Q] based on PK 2 Comp
(0, 29.7); [V2] based on PK 2 Comp
$OMEGA
(0, 0.08); [P] omega(1,1)
(0, 0.159); [P] omega(2,2)
(0, 0.140); [P] omega(3,3)
(0, 0.19); [P] omega(4,4)
$SIGMA
(0, 0.06) ;sigma1
$EST METHOD=1 PRINT=5 MAXEVAL=9999 SIG=3 NOABORT
Regards,
Sumeet K. Singla
Ph.D. Candidate
Division of Pharmaceutics and Translational Therapeutics
College of Pharmacy | University of Iowa
Iowa City, Iowa
sumeet-singla owa.edu<mailto:sumeet-singla
518.577.5881
Great to hear it is now working.
If you want to set the same limits for all power models, you can even write this in a more generic form:
*:*-5 = -5
And if you want to apply only for one parameter or one covariate that is possible as well, e.g.:
V2:*-5 = -5
Best regards
Jakob
Quoted reply history
> On 21 Nov 2019, at 18:46, Singla, Sumeet K <sumeet-singla
wrote:
>
> I figured out the problem. Apparently, SCM in PsN, by default sets a
very large lower and upper limits for thetas of covariate-parameter relationship, if you don’t provide those bounds. NONMEM runs into numerical difficulty when raising a very small or very big quantity to a power of say 10000.There is a way around it. Set this in your configuration file as shown below:
>
> [lower_bounds]
> V2:USER-5 = -5
>
> [inits]
> V2:USER-5= 0.1
>
> [upper_bounds]
>
> V2:USER-5 = 5
>
> You can define as many “parameter:covariate-model” as
you want, in the above format. Note that, order should be: lower_bound, inits, upper bound, and if you are defining more than one parameter-covariate relation, they should be in same order in lower_bound, inits and upper_bounds section.
>
> Regards,
> Sumeet
>
> From: Ayyappa Chaturvedula <ayyappach
<mailto:ayyappach
> Sent: Wednesday, November 20, 2019 8:27 AM
> To: Singla, Sumeet K <sumeet-singla
<mailto:sumeet-singla
> Cc: nmusers
> Subject: [External] Re: [NMusers] Error in Power-model for covariate
selection
>
> Hi Sumeet:
> Couple of points, may not be solutions for the modeling problem you
are having but in general:
> 1. Use INTERACTION in your $EST because you are using proportional
error
> 2. Make sure you have enough range of covariates in the data to
describe the relationships quantitatively
> 3. Are there any correlated covariates that you are trying to include
same time?
> 4. Try fitting the model out of SCM for power function and try to find
the issue.
>
> Regards,
> Ayyappa
>
>
> On Nov 19, 2019, at 10:48 PM, Singla, Sumeet K
<sumeet-singla
>
>
> Hello Everyone,
>
> I am using PsN enabled SCM option in Pirana to analyze selection of
covariates in the PK 2- Comp model. As long as I am using just linear and exponential covariate model, everything runs fine. However, as soon as I add power-model in the mix, “some” power models involving continuous covariates on parameters fail to run and it gives me the following error:
> “HESSIAN OF POSTERIOR DENSITY IS NON-POSITIVE-DEFINITE DURING
SEARCH”
> I understand that individual PK parameter search might be moving into
0 or negative territory. I am trying to fix it but didn’t have much success. I have set lower bounds, removed lower bounds, changed order of model in valid states option in scm configuration file, dataset doesn’t contain any 0 or negative value, but nothing is working. FYI: I don’t need to test hockey-stick relation as literature and data doesn’t support it, power model can only be used on continuous covariates and I have turned on parallel states option.
> This is how part of my scm results, followed by scm configuration
file, followed by base model for PK 2-Comp looks like:
>
> MODEL TEST BASE OFV NEW OFV TEST OFV (DROP)
GOAL dDF SIGNIFICANT PVAL
> CLAGE-2 PVAL 2618.02603 2616.67228 1.35375
> 3.84150 1 0.244620
> CLAGE-5 PVAL 2618.02603 2616.36273 1.66330
> 3.84150 1 0.197160
> CLAGE-4 PVAL 2618.02603 2616.65232 1.37371
> 3.84150 1 0.241180
> CLBMI-2 PVAL 2618.02603 2612.96657 5.05946
> 3.84150 1 YES! 0.024492
> CLBMI-5 PVAL 2618.02603 FAILED FAILED
> 3.84150 1 999
>
> SCM FILE:
> “
> search_direction=both
> p_forward=0.05
> p_backward=0.01
> continuous_covariates=BMI,AGE
> categorical_covariates=USER,SEX
> parallel_states=1
> retries=2
> threads=6
> tweak_inits=1
> ;;1-NotIncluded, 2-LINEAR, 3-Hockey Stick Relation, 4-Exponential,
5-Power
> [test_relations]
> CL=AGE,SEX,BMI,USER
> V1=AGE,SEX,BMI,USER
> V2=AGE,SEX,BMI,USER
> Q=AGE,SEX,BMI,USER
> [valid_states]
> continuous = 1,2,5,4
> categorical = 1,2
> “
> NONMEM Control Stream:
>
> $SUBROUTINE ADVAN3 TRANS4
>
> $PK
>
> TVV1 = THETA(1) ;Central Volume of
distribution in L
> V1 = TVV1*EXP(ETA(1))
> TVCL = THETA(2)
> CL = TVCL*EXP(ETA(2)) ; Clearance L/h
> TVQ = THETA(3)
> Q = TVQ*EXP(ETA(3)) ;Intercompartment Clearance
> TVV2 = THETA(4)
> V2 = TVV2*EXP(ETA(4)) ;Peripheral volume in L
> S1=V1
>
> $ERROR
> IPRED=F
> Y= F + F*ERR(1); Proportional Error
>
> $THETA
> (0, 16); [V1] based on PK 2 Comp
> (0, 255); [CL] based on PK 2 Comp
> (0, 33.5); [Q] based on PK 2 Comp
> (0, 29.7); [V2] based on PK 2 Comp
>
> $OMEGA
> (0, 0.08); [P] omega(1,1)
> (0, 0.159); [P] omega(2,2)
> (0, 0.140); [P] omega(3,3)
> (0, 0.19); [P] omega(4,4)
>
> $SIGMA
> (0, 0.06) ;sigma1
>
> $EST METHOD=1 PRINT=5 MAXEVAL99 SIG=3 NOABORT
>
>
> Regards,
>
> Sumeet K. Singla
> Ph.D. Candidate
> Division of Pharmaceutics and Translational Therapeutics
> College of Pharmacy | University of Iowa
> Iowa City, Iowa
> sumeet-singla
> 518.577.5881