Obtains the components needed downstream for the computation of Kenward-Roger degrees of freedom.
Used in mmrm() fitting if method is "Kenward-Roger".
Arguments
- tmb_data
(
mmrm_tmb_data)
produced byh_mmrm_tmb_data().- theta
(
numeric)
theta estimate.- linear
(
flag)
whether to omit second derivatives and the R component.- w
(
matrixorNULL)
covariance of the covariance parameters. Supply withlinear = TRUEto contract Q without constructing its blocks.
Value
Named list with elements:
P:matrixof \(P\) component.Q:matrixof \(Q\) component.R:matrixof \(R\) component, orNULLwhenlinear = TRUE.S_Q: contracted Q sum whenwis supplied;QandRare thenNULL.
Details
the function returns a named list, \(P\), \(Q\) and \(R\), which corresponds to the paper in 1997. The matrices are stacked in columns so that \(P\), \(Q\) and \(R\) has the same column number(number of beta parameters). The number of rows, is dependent on the total number of theta and number of groups, if the fit is a grouped mmrm. For \(P\) matrix, it is stacked sequentially. For \(Q\) and \(R\) matrix, it is stacked so that the \(Q_{ij}\) and \(R_{ij}\) is stacked from \(j\) then to \(i\), i.e. \(R_{i1}\), \(R_{i2}\), etc. \(Q\) and \(R\) only contains intra-group results and inter-group results should be all zero matrices so they are not stacked in the result.
Supplying w for linear KR instead retains P and contracts Q into the single
matrix S_Q, without storing Q blocks, see the section "Contracted linear covariance
adjustment" in vignette("kenward", package = "mmrm"). The symmetric part of w is
used, and non-finite entries in w give a non-finite S_Q.
mmrm() always supplies w for linear KR. Calling with linear = TRUE but without w
gives the pairwise P and Q blocks, which tests use as an independent reference.