sample_HierarchicalModel: Sample from Hierarchical Model with given Row and Column Sums

Description Usage Arguments Examples

Description

Sample from Hierarchical Model with given Row and Column Sums

Usage

1
2
3
4
5
sample_HierarchicalModel(l, a, L_fixed = NA, model, nsamples = 10000,
  thin = choosethin(l = l, a = a, L_fixed = L_fixed, model = model,
  matrpertheta = matrpertheta, silent = silent), burnin = NA,
  matrpertheta = length(l)^2, silent = FALSE,
  tol = .Machine$double.eps^0.25)

Arguments

l

observed row sum

a

observerd column sum

L_fixed

Matrix containing known values of L, where NA signifies that an element is not known. If L_fixed equates to NA (the default) then no values are assumed to be known.

model

Underlying model for p and lambda.

nsamples

number of samples to return.

thin

how many updates of theta to perform before outputting a sample.

burnin

number of iterations for the burnin. Defaults to 5 of the steps in the sampling part.

matrpertheta

number of matrix updates per update of theta.

silent

(default FALSE) suppress all output (including progress bars).

tol

tolerance used in checks for equality. Defaults to .Machine$double.eps^0.25.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
n <- 10
m <- Model.Indep.p.lambda(Model.p.BetaPrior(n),
                          Model.lambda.GammaPrior(n,scale=1e-1))
x <- genL(m)
l <- rowSums(x$L)
a <- colSums(x$L)
## Not run: 
res <- sample_HierarchicalModel(l,a,model=m)

## End(Not run)
# fixing one values
L_fixed <- matrix(NA,ncol=n,nrow=n)
L_fixed[1,2:5] <- x$L[1,2:5]
## Not run: 
res <- sample_HierarchicalModel(l,a,model=m,L_fixed=L_fixed,
                                nsamples=1e2)
sapply(res$L,function(x)x[1,2:5])

## End(Not run)

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