Applies parameter- and/or output-normalization to a given first and (optionally) second order variational matrix. For the first order matrix, parameter-normalization is performed by right multiplication with a matrix P = diag(p), where p is a vector of parameter values (if the parameter is to be normalized) or 1 (if not), and the output-normalization involves left multiplication with a matrix Y^(-1) where Y = diag(y) and y is the vector of output values. For the second order matrix (actually tensor), parameter-normalization involves two suitable multiplications with P, and the output-normalization is done in the same way as for the first order matrix. If the matrix was already normalized one way or the other, then the normalization is adapted to the new settings. Parameter-normalization is selected per parameter, while output-normalization is a single choice.

normalizeVariations(df, parNorm = TRUE, outNorm = TRUE)

Arguments

df

A data frame containing a variational matrix, optionally with second order derivatives, as produced by calcVariations, calcFirstVariations or calcVariationsFim, that is, with columns 't', 'i', 'y', 'dy_d<v1>' and (if second order) 'd2y_d<v1>_<v2>', where variables v1 and v2 are replaced by names. Optionally this matrix may be parameter- or output-normalized.

parNorm

Vector (not necessarily named) of booleans of length equal to the number of parameters used to construct df, i.e., those listed in its attributes 'theta', 'eta' and 'eps'. The value TRUE means the corresponding individual parameter should be normalized in the FIM, FALSE means not. Instead of a vector, may also provide a single boolean, where TRUE (default) stands for a vector of all TRUE, and FALSE for a vector of all FALSE. May also provide a character vector with the names of the parameters to be normalized. Invalid names are ignored, with a warning.

outNorm

TRUE (default) if variations should be output-normalized, FALSE if not.

Value

A data frame in same format, where the columns 'dy_d<v1>' contain the values, normalized as specified. The function displays an error and returns NULL if the input is not in the specified format, parNorm does not contain information on all parameters, or outNorm = TRUE and the 'y' column of df contains zeroes. The attributes are as those of df, with 'parameterNormalized' and 'outputNormalized' adapted according to the new normalization.

See also

Other result modifiers: normalizeFim(), simplifyFimIdent(), simplifySensitivities()

Author

Martijn van Noort