Calculates the Fisher Information Matrix (FIM) from the given model, that is, calculates minus the expectation of the second order derivative matrix of the log-likelihood at the given times with respect to the model parameters. These parameters are listed in vartheta, varomega and varsigma.

calcFimFromModel(
  model,
  p,
  init,
  output,
  times,
  theta,
  omega,
  sigma,
  vartheta = names(theta),
  varomega = NULL,
  varsigma = NULL,
  symbolic = TRUE,
  chkModel = TRUE,
  ...
)

Arguments

model

Function(t, y, p) of time, state variables and parameters, specifying the differential equations. This function should return the numeric vector dy/dt.

p

Function(theta, eta) of population and individual parameters specifying the model parameters. This function should return a named numeric vector.

init

Function(p) of parameters specifying the initial state of the model.

output

Function(y, p, eps) of state variables, parameters and residual errors specifying the model outputs. This function should return a numeric vector.

times

Numeric vector of times where variations are to be evaluated.

theta

Population parameter values, as named numeric vector. May be NULL if none are needed.

omega

Variance-covariance matrix of individual parameters, as numeric matrix. Should be symmetric and positive definite. Columns and/or rows should be named. If both, the names should be the same.

sigma

Variance-covariance matrix of residual parameters, as numeric matrix. Should be symmetric and positive definite. Columns and/or rows should be named. If both, the names should be the same.

vartheta

Vector of names of population parameters for which variations are to be calculated. Should be a subset of names(theta), or NULL for none. By default equal to names(theta).

varomega

Matrix (not necessarily named) of booleans of the same dimension as omega. The value TRUE means the derivative of the corresponding element should be included in the FIM, FALSE means not. The matrix should be symmetric. Instead of a matrix, may also provide a single boolean or NULL, where TRUE stands for a matrix of all TRUE (also the off-diagonal elements), FALSE for a matrix of all FALSE, and NULL (default) is to set all nonzero elements of omega to TRUE, and the others to FALSE.

varsigma

Matrix (not necessarily named) of booleans of the same dimension as sigma. The value TRUE means the derivative of the corresponding element should be included in the FIM, FALSE means not. The matrix should be symmetric. Instead of a matrix, may also provide a single boolean or NULL, where TRUE stands for a matrix of all TRUE (also the off-diagonal elements), FALSE for a matrix of all FALSE, and NULL (default) is to set all nonzero elements of sigma to TRUE, and the others to FALSE.

symbolic

TRUE (default) if derivatives are to be computed symbolically, FALSE if numerically. See calcVariations for notes on using symbolic derivation.

chkModel

TRUE (default) if it has to be checked whether model components (model, p, init, output) are formatted correctly for symbolic manipulation, FALSE if not.

...

Named arguments to be passed to lsoda. Can be used for example to pass events or error tolerances.

Value

The FIM, as a square matrix with element (i,j) equal to -E(d^2 L/d<vi><vj>), where L is the log likelihood and <vi> is the i-th parameter. The row and column names of the matrix are those of the variable thetas, omegas and sigmas, as specified by vartheta, varomega and varsigma. The FIM is not normalized and the 'thetaNormalized', 'omegaNormalized' and 'sigmaNormalized' attributes of this matrix are set to named vectors of FALSE, where the names are the names of the thetas, and the column names of omegas and sigmas as specified by df, omega and sigma, respectively. The attributes 'theta', 'omega' and 'sigma' store the values of all parameters as named vectors. They form a superset of the variable parameters. The 'type' attribute is set to 'FIM', and the 'symbolic' one to the value of symbolic. The function displays an error and returns NULL if the input is incorrectly formatted or the variance matrix cannot be inverted.

Note

It is recommended to use symbolic derivation (symbolic==TRUE) rather than numerical derivation, as it is more accurate, especially for derivatives that are formally zero. See calcVariations for details.

Author

Martijn van Noort