multiprobit_utils: Internal multiprobit utilities

Description Usage Arguments Details Value Note Examples

Description

Compute inverse of a Cholesky matrix, storing the result in reverse order, see Details.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
tri_solve(A, b, lower_tri = FALSE)

inverse_chol_reverse(Sigma_chol, lower_chol = FALSE)

qchisq_pnorm(x, df)

qnorm_pchisq(x, df)

qbeta_pchisq(x, df, shape1, shape2, ncp)

qchisq_pbeta(x, shape1, shape2, df, ncp)

sparse_identity(d)

Arguments

Sigma_chol

Cholesky factor of a covariance matrix

lower_chol

TRUE if lower triangular Cholesky factors are used Default: FALSE

x

Probability or quantile

df

Degrees of freedom parameter

shape1

Shape parameter for a Beta distribution

shape2

Shape parameter for a Beta distribution

ncp

Non-centrality parameter for Beta and χ^2 distributions

d

Matrix dimension

Details

tri_solve() solves triangular systems with back/forwardsolve

inverse_chol_reverse() notes:

For lower_chol == FALSE, the input Sigma_chol is the matrix R in the Cholesky factorisation Σ=R^T R with inverse Q=R^{-1}R^{-T}. Since R^{-1} has the opposite upper/lower triangular property to R^T, this Q factorisation isn't a regular Cholesky factorisation. Let P be the permutation matrix that reverses element order. Then PQP=PR^{-1}PPR^{-T}P, and PR^{-T}P is the Cholesky factor of PQP with the same upper/lower triangular property as R.

For lower_chol == TRUE, the input is L in Σ=LL^T and the output is PL^{-T}P, with PQP=PL^{-T}PPL^{-1}P.

qchisq_pnorm() evaluates qchisq(pnorm(...)) with attempt at numerical stability.

Value

inverse_chol_reverse() returns a Cholesky matrix of the same triangle orientation as the input, with rows and columns in reverse order.

Note

These are internal non-exported function

Examples

1
2
3
if(interactive()){
  inverse_chol_reverse(matrix(c(1, 0, 2, 3), 2, 2))
}

finnlindgren/multiprobit documentation built on June 20, 2020, 6:12 a.m.