mpp: Multivariate Probit Event Probabilities

Description Usage Arguments Details Value Examples

View source: R/probabilities.R

Description

Evaluate one or more probabilities for outcomes of a multivariate probit model, with given location and covariance scale parameteters.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
mpp(
  y,
  mu,
  Sigma_chol = NULL,
  Q_chol = NULL,
  log = FALSE,
  lower_chol = FALSE,
  gaussint_options = NULL,
  ...
)

Arguments

y

A matrix with n-by-d elements, where each row is a multivariate observation, see Details. A vector is interpreted as a single row matrix.

mu

A matrix with n-by-d elements, where each row is an expectation vector parameter, see Details. A vector is interpreted as a single row matrix.

Sigma_chol

The Cholesky factor of the covariance matrix parameter, Default: NULL

Q_chol

The Cholesky factor of the precision matrix matrix parameter, Default: NULL

log

logical indicating if the log-probability should be returned, Default: FALSE

lower_chol

TRUE if lower triangular Cholesky factors are used Default: FALSE

gaussint_options

list of options for excursions::gaussint

...

Further parameters, currently ignored

Details

Computes the probability

P(y_1 > 0, ..., y_d > 0|μ,Σ)

when y is a d-dimensional indicator vector with elements y_i=I(z_i > 0), and z is a d-dimensional Gaussian vector with distribution N(μ,Σ). Only the inequality for y_i is used, so alternative data representations such as -1/+1 will also work as expected.

The Σ paramter can either be specified though its Cholesky factor Sigma_chol or through the Cholesky factor of the precision (inverse of Σ) Q_chol. The logical parameter lower_chol determines if a lower or upper triangular Cholesky factor was supplied.

The internal seed parameter for excursions::gaussint can be provided as an element of gaussint_options, which provides consistent approximation error when calculating numerical derivatives.

Value

A list with components

P

A vector of probabilities

E

A vector with the estimated approximation error for each probability

Examples

1
2
3
4
5
6
7
if (interactive()) {
  mpp(
    y = c(1, 0),
    mu = c(1, 2),
    Sigma_chol = chol(matrix(c(1, 0.5, 0.5, 1), 2, 2))
  )
}

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