Processes three types of information matrices: ones produced by the SparseM
package for the orm
function in rms
version 6.9-0 and earlier, by the Matrix
package for version 7.0-0 of rms
, or plain matrices. For Matrix
, the input information matrix is a list with three elements: a
containing in two columns the diagonal and superdiagonal for intercepts, b
, a square matrix for the covariates, and ab
for intercepts x covariates. If nothing else is specified, the assembled information matrix is returned for Matrix
, or the original info
otherwise. If p=TRUE
, the number of parameters in the model (number of rows and columns in the whole information matrix) is returned. If i
is given, the i
elements of the inverse of info
are returned, using efficient calculation to avoid inverting the whole matrix. Otherwise if invert=TRUE
or B
is given without i
, the efficiently (if Matrix
or SparseM
) inverted matrix is returned, or the matrix multiplication of the inverse and B
. If both i
and B
are given, what is returned is the i
portion of the inverse of the information matrix, matrix multiplied by B
. This is done inside solve()
.
infoMxop(
info,
i,
invert = !missing(i) || !missing(B),
B,
np = FALSE,
tol = .Machine$double.eps,
abort = TRUE
)
a single integer or a matrix
an information matrix object
integer vector specifying elements returned from the inverse. You an also specify i='x'
to return non-intercepts or i='i'
to return intercepts.
set to TRUE
to invert info
(implied when i
or B
is given)
multiplier matrix
set to TRUE
to just fetch the total number of parameters (intercepts + betas)
tolerance for matrix inversion singularity
set to FALSE
to run the solve
calculation through try()
without aborting; the user will detect that the operation did not success by examinine inherits(result, 'try-error')
for being TRUE
.
Frank Harrell
When only variance-covariance matrix elements corresponding to the non-intercepts are desired, specify
i='x'
or i=(k + 1) : nv
where nv
is the number of intercepts and slopes combined. infoMxop
computes the needed covariance matrix very quickly in this case.
When inverting info
, if info
has a 'scale'
attribute with elements mean
and sd
, the scaling is reversed after inverting info
.
if (FALSE) {
f <- orm(y ~ x)
infoMxop(f$info.matrix) # assembles 3 pieces
infoMxop(v, i=c(2,4)) # returns a submatrix of v inverse
infoMxop(f$info.matrix, i='x') # sub-covariance matrix for just the betas
}
Run the code above in your browser using DataLab