tests/testthat/test_HierarchicalModels.R

context("Test of Hierarchical Models")

test_that("sample_HierachicalModel test presence of nondefault enforced 0",{
    skip_on_cran()

    set.seed(12930)
    n <- 4
    replicate(10,{
        p <- matrix(nrow=n,ncol=n,sample(seq(0,1,length.out=n*n)))
        mp <- Model.p.constant(n=n,p=p)
        m <- Model.Indep.p.lambda(model.p=mp,
                                  model.lambda=Model.lambda.constant(n=n,lambda=1/2))
        L <- genL(m)$L
        res <- sample_HierarchicalModel(l=rowSums(L),a=colSums(L),model=m,nsamples=1,thin=100,burnin=2,silent=TRUE)
        expect_true(all(ifelse(p==0,res$L[[1]]==0,TRUE)))
    })
})

Try the systemicrisk package in your browser

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

systemicrisk documentation built on May 30, 2017, 1:47 a.m.