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.
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,
precBits = 10
)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.
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 :
parms : a named vector of parameter.
time : vector a timepoint.
See dynFUN_demo, model.clairon, model.pasin or model.pk for examples.
initial condition of the mechanism model, conform to what is asked in dynFUN. If regressor used in Monolix provided a named list of vector of individual initial conditions. Each vector need to be of length 1 (same for all), or exactly the numbre of individuals (range in the same order as their id).
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).
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).
list of model parameters containing (see details)
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).
named vector of regulatization parameters \((\alpha_{1k})_{k\leq K}\), with identifier of observation model as names, (optional, see description).
matrix of individual covariates (size N x n). Individuals must be sorted in the same order than in mu and Omega, (optional, see description).
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).
Named list of inverse transformation functions for the individual parameter model (names must be consistent with phi_pop and psi_pop ; optional, see description).
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.
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.
named vector of the estimated error mocel constants \((\varsigma_p)_{p\leq P}\) with observation model identifiers as names.
named vector of the estimated error mocel constants \((\sigma_k)_{k\leq K}\) with observation model identifiers as names.
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.
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.
number of points per dimension to use for the Gauss-Hermite quadrature rule.
integer between 0 and 1, percentage of pruning for the Gauss-Hermite quadrature rule (default NULL).
logical, if computation should be done in parallel.
number of cores to use for parallelization, default will detect the number of cores available.
logical, if only the log-likelihood should be computed (and not \(\partial_{\alpha_1} LL\) or \(\partial_{\alpha_1}^2 LL\)).
logical, if progress bar should be printed through the computation.
precision if needed
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.
if (FALSE) {
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)
}
Run the code above in your browser using DataLab