-
Notifications
You must be signed in to change notification settings - Fork 3
M3 method #163
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
I wanted to perform some Bayesian estimation that included BLQ data and tried to implement the M3 method for this.
The following tweak seems to work, but it may be better if it can be implemented in a cleaner way within the package (through fixing issue #107 maybe).
- Within my dataset, I have set
DV<0as BLQ flag so that theofv_kangfunction could directly understand BLQs are directly the negative values of theobsvariable.
I also kept BLQ and LLOQ columns for the
.cppmodel
- Then, within my
.cppmodel, I have used the following code chunks to implement the method
$PLUGIN Rcpp
$PARAM @annotated
SIGMA_PROP : xx
SIGMA_ADD : yy
LLOQ: zz
BLQ: 0
$SIGMA
xx yy
$TABLE
// Usual calculation for observed values
double CP = (CENTRAL / V1) ;
double DV = CP * (1 + EPS(1)) + EPS(2);
// M3 Method for BLQs leveraging Rcpp plugin
double CP_SD = sqrt(SIGMA_ADD + CP*CP*SIGMA_PROP);
double DV_BLQ = R::pnorm(LLOQ, CP, CP_SD, 1, 0);
if(BLQ>0){DV = DV_BLQ;}- Then, I have updated the
ofv_kangfunction to use negativeobsas directly likelihood values
ofv_kang <- function(obs, pred, eta, var, omega_inv){
eta <- unlist(eta)
sum(log(var[obs>=0]) + (obs[obs>=0] - pred[obs>=0])^2/var[obs>=0]) -
sum(2*log(pred[obs<0])) +
diag(matrix(eta, nrow = 1) %*% omega_inv %*% matrix(eta, ncol = 1))
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request