Non-square Matrices

This document describe an example of reconstructing a non-square matrix.

library(systemicrisk)

Set up vectors of row and column sums of length 10 and 4, respectively, ensuring that their sums matches up.

set.seed(1230)
l <- rexp(10,rate=5/4)
l
a <- rexp(4);
a <- a/sum(a)*sum(l)
a

Construct a model with fixed matrix p and lambda.

mod <- Model.Indep.p.lambda(model.p=Model.p.constant(p=matrix(0.5,nrow=10,ncol=4)),
                            model.lambda=Model.lambda.constant(lambda=matrix(5,nrow=10,ncol=4)))

Run the sampler to generate 10 samples.

res <- sample_HierarchicalModel(l=l,a=a,model=mod,nsamples=10,silent=TRUE)

Here are the first two of these samples.

res$L[[1]]
res$L[[2]]


Try the systemicrisk package in your browser

Any scripts or data that you put into this service are public.

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