Gibbs_truncated_multivariate_normal: Gibbs sampler for a truncated multivariate normal...

Description Usage Arguments Value Examples

View source: R/Gibbs_truncated_multivariate_normal.R

Description

Simulate S in R^M and Z in R^d given S in (alpha,beta]$, where S = X + gamma^T Z with X ~ Normal(0,I_N) and Z ~ Normal(0,Gamma^T Gamma).

Usage

1
2
3
4
5
6
7
8
9
Gibbs_truncated_multivariate_normal(
  n = 1,
  alpha,
  beta,
  gamma,
  Gamma,
  which = "Z",
  steps = 20
)

Arguments

n

Number of samples. Default: n=1.

alpha

Vector of lower bounds for S component.

beta

Vector of upper bounds for S component.

gamma

Matrix of linear transformations on Z component.

Gamma

Cholesky factor for variance on Z component.

which

Text string ("S"/"Z"/"SZ") deciding which componts are return. Default: which="Z".

steps

Number of steps in Gibbs sampler. Default: steps=20.

Value

Simulations either as a matrix (if which="S" or "Z"), or as a list of matrices (if which="SZ").

Examples

1
Gibbs_truncated_multivariate_normal(n=10,alpha=rep(-1,5),beta=rep(1,5),gamma=matrix(rnorm(10),2,5),Gamma=matrix(c(1,1,0,1),2,2))

bomarkussen/probit documentation built on April 3, 2021, 7:38 p.m.