GibbsSteps_kcycle: Gibbs sampling step of a matrix in the ERE model

Description Usage Arguments Value Examples

View source: R/RcppExports.R

Description

The sampling is conditional on row and column sums and uses k-cycle steps. Then dimensions of L, lambda and p must match.

Usage

1
GibbsSteps_kcycle(L, lambda, p, it = 1000L, eps = 1e-10, debug = 0L)

Arguments

L

Starting matrix - will be modified to contain the results.

lambda

Matrix of intensities

p

Matrix of probabilities (must be in [0,1])

it

Number of iterations (default=1000)

eps

Threshold for values to be interpreted as equal to 0 (default = 1e-10)

debug

Should addtional debug information be printed? (0 no output, 1 output debug information)

Value

no return value

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
L <- matrix(c(1,2,3,4,5,6,7,8,9),nrow=3)
diag(L) <- 0
lambda <- matrix(0.5,nrow=3,ncol=3)
p <- matrix(0.7, nrow=3,ncol=3)
diag(p) <- 0
GibbsSteps_kcycle(L=L,lambda=lambda,p=p)
L
L <- matrix(1:16,nrow=4)
diag(L) <- 0
lambda <- matrix(0.5,nrow=4,ncol=4)
p <- matrix(0.25, nrow=4,ncol=4)
diag(p) <- 0
GibbsSteps_kcycle(L=L,lambda=lambda,p=p)
L

Example output

         [,1]     [,2]     [,3]
[1,] 0.000000 3.217099 7.782901
[2,] 2.782901 0.000000 7.217099
[3,] 2.217099 6.782901 0.000000
     [,1]      [,2]      [,3] [,4]
[1,]    0 17.146595  9.853405    0
[2,]    9  0.000000  0.000000   17
[3,]    0  0.000000  0.000000   25
[4,]    0  2.853405 21.146595    0

systemicrisk documentation built on May 2, 2019, 9:26 a.m.