Calculates the Fisher Information Matrix (FIM) from the given variational matrix, 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. The times are given in the variational matrix, which contains first and second order derivatives of the output with respect to certain parameters, at certain times, for a particular individual.

calcFimFromMatrix(df, omega, sigma, vartheta, varomega = NULL, varsigma = NULL)

Arguments

df

Data frame of first and second order variations as generated by calcVariations or calcVariationsFim, that is, with columns 't', 'i', 'y', 'dy_d<v1>' and 'd2y_d<v1>_<v2>', where variables v1 and v2 are replaced by names.

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 derivatives are to be calculated. Should be a subset of the names appearing in the variational matrix, or NULL for none.

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.

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' The function displays an error and returns NULL if the input is incorrectly formatted or the variance matrix cannot be inverted.

Author

Martijn van Noort