Skip to content

M3 method #163

@pchelle

Description

@pchelle

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<0 as BLQ flag so that the ofv_kang function could directly understand BLQs are directly the negative values of the obs variable.

I also kept BLQ and LLOQ columns for the .cpp model

  • Then, within my .cpp model, 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_kang function to use negative obs as 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))
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions