gh.LL {REMixed}R Documentation

Adaptive Gauss-Hermite approximation of log-likelihood derivatives

Description

Computes Adaptive Gauss-Hermite approximation of the log-likelihood and its derivatives in NLMEM with latent observation processes, see REMixed-package for details on the model.

Usage

gh.LL(
  dynFUN,
  y,
  mu = NULL,
  Omega = NULL,
  theta = NULL,
  alpha1 = NULL,
  covariates = NULL,
  ParModel.transfo = NULL,
  ParModel.transfo.inv = NULL,
  Sobs = NULL,
  Robs = NULL,
  Serr = NULL,
  Rerr = NULL,
  ObsModel.transfo = NULL,
  data = NULL,
  n = NULL,
  prune = NULL,
  parallel = TRUE,
  ncores = NULL,
  onlyLL = FALSE,
  verbose = TRUE
)

Arguments

dynFUN

function computing the dynamics of interest for a set of parameters. This function need to contain every sub-function that it may needs (as it is called in a foreach loop). The output of this function need to return a data.frame with time : as first columns and named dynamics in other columns. It must take in input :

  • y : a named vector with the initial condition. The names are the dynamics names.

  • parms : a named vector of parameter.

  • time : vector a timepoint.

See dynFUN_demo, model.clairon, model.pasin or model.pk for examples.

y

initial condition of the mechanism model, conform to what is asked in dynFUN.

mu

list of individuals random effects estimation (vector of r.e. need to be named by the parameter names), use to locate the density mass; (optional, see description).

Omega

list of individuals estimated standard deviation diagonal matrix (matrix need to have rows and columns named by the parameter names), use to locate the density mass; (optional, see description).

theta

list of model parameters containing (see details)

  • phi_pop : named vector with the population parameters with no r.e. (\phi_{l\ pop})_{l\leq L} (NULL if none) ;

  • psi_pop : named vector with the population parameters with r.e. (\psi_{l\ pop})_{l\leq m} ;

  • gamma : named list (for each parameters) of named vector (for each covariates) of covariate effects from parameters with no r.e. ;

  • beta : named list (for each parameters) of named vector (for each covariates) of covariate effects from parameters with r.e..

  • alpha0 : named vector of (\alpha_{0k})_{k\leq K} parameters (names are identifier of the observation model, such as in a Monolix project);

  • omega : named vector of estimated r.e. standard deviation;

(optional, see description).

alpha1

named vector of regulatization parameters (\alpha_{1k})_{k\leq K}, with identifier of observation model as names, (optional, see description).

covariates

matrix of individual covariates (size N x n). Individuals must be sorted in the same order than in mu and Omega, (optional, see description).

ParModel.transfo

named list of transformation functions (h_l)_{l\leq m} and (s_k)_{k\leq K} for the individual parameter model (names must be consistent with phi_pop and psi_pop, missing entries are set by default to the identity function ; optional, see description).

ParModel.transfo.inv

Named list of inverse transformation functions for the individual parameter model (names must be consistent with phi_pop and psi_pop ; optional, see description).

Sobs

list of individuals trajectories for the direct observation models (Y_{pi})_{p \leq P,i\leq N}. Each element i\leq N of the list, is a list of p\leq P data.frame with time (t_{pij})_{j\leq n_{ip}} and observations (Y_{pij})_{j\leq n_{ip}}. Each data.frame is named with the observation model identifiers.

Robs

list of individuals trajectories for the latent observation models (Z_{ki})_{k \leq K,i\leq N}. Each element i\leq N of the list, is a list of k\leq K data.frame with time (t_{kij})_{j\leq n_{ik}} and observations (Z_{kij})_{j\leq n_{ik}}. Each data.frame is named with the observation model identifiers.

Serr

named vector of the estimated error mocel constants (\varsigma_p)_{p\leq P} with observation model identifiers as names.

Rerr

named vector of the estimated error mocel constants (\sigma_k)_{k\leq K} with observation model identifiers as names.

ObsModel.transfo

list containing two lists of transformations and two vectors linking each transformations to their observation model name in the Monolix project. The list should include identity transformations and be named S and R. The two vectors should be named linkS and linkR.

Both S (for the direct observation models) and linkS, as well as R (for latent process models) and linkR, must have the same length.

  • S: a list of transformations for the direct observation models. Each transformation corresponds to a variable Y_p=h_p(S_p), where the name indicates which dynamic is observed (from dynFUN);

  • linkS : a vector specifying the observation model names (that is used in the monolix project, alpha1, etc.) for each transformation, in the same order as in S;

  • R: similarly, a list of transformations for the latent process models. Although currently there is only one latent dynamic, each s_k, k\leq K transformation corresponds to the same dynamic but may vary for each Y_k observed. The names should match the output from dynFUN;

  • linkR : a vector specifying the observation model names for each transformation, in the same order as in R.

data

output from readMLX containing parameters "mu", "Omega", "theta", "alpha1", "covariates", "ParModel.transfo", "ParModel.transfo.inv", "Sobs", "Robs", "Serr", "Rerr", "ObsModel.transfo" extract from a monolix project.

n

number of points per dimension to use for the Gauss-Hermite quadrature rule.

prune

integer between 0 and 1, percentage of pruning for the Gauss-Hermite quadrature rule (default NULL).

parallel

logical, if computation should be done in parallel.

ncores

number of cores to use for parallelization, default will detect the number of cores available.

onlyLL

logical, if only the log-likelihood should be computed (and not \partial_{\alpha_1} LL or \partial_{\alpha_1}^2 LL).

verbose

logical, if progress bar should be printed through the computation.

Details

Based on notation introduced REMixed-package. The log-likelihood of the model LL(\theta,\alpha_1) for a set of population parameters \theta and regulatization parameters \alpha_1 is estimated using Adaptative Gausse-Hermite quadrature, using conditional distribution estimation to locate the mass of the integrand. If the project has been initialized as a Monolix project, the user can use readMLX function to retrieve all the project information needed here.

Value

A list with the approximation by Gauss-Hermite quadrature of the likelihood L, the log-likelihood LL, the gradient of the log-likelihood dLL, and the Hessian of the log-likelihood ddLL at the point \theta, \alpha provided.

Examples

## Not run: 
project <- getMLXdir()


ObsModel.transfo = list(S=list(AB=log10),
                        linkS="yAB",
                        R=rep(list(S=function(x){x}),5),
                        linkR = paste0("yG",1:5))

alpha=list(alpha0=NULL,
           alpha1=setNames(paste0("alpha_1",1:5),paste0("yG",1:5)))

data <- readMLX(project,ObsModel.transfo,alpha)

LL <- gh.LL(dynFUN = dynFUN_demo,
            y = c(S=5,AB=1000),
            ObsModel.transfo=ObsModel.transfo,
            data = data)

print(LL)

## End(Not run)

[Package REMixed version 0.1.0 Index]