diff options
author | Justin Cally <jcally@student.unimelb.edu.au> | 2022-04-12 11:34:36 +1000 |
---|---|---|
committer | Justin Cally <jcally@student.unimelb.edu.au> | 2022-04-12 11:34:36 +1000 |
commit | be881d0803e462a4b42a2648afb3683ce9c3803f (patch) | |
tree | 35a89189be41591ca637b7517f28b76b7e6699ec | |
parent | 4efe8cddbac8164419cc4f8688dada111730b0df (diff) |
add laplace test (similar to normal distribution test)
-rw-r--r-- | tests/testthat/test_priors.R | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/testthat/test_priors.R b/tests/testthat/test_priors.R index be7f622..2453140 100644 --- a/tests/testthat/test_priors.R +++ b/tests/testthat/test_priors.R @@ -67,6 +67,18 @@ test_that("gamma prior can be specified",{ expect_error(gamma(1,-1)) }) +test_that("laplace prior can be specified",{ + lp <- laplace() + expect_equal(lp, list(dist=6, par1=0, par2=2.5, par3=0, autoscale=TRUE)) + lp <- laplace(2, 0.5, autoscale=FALSE) + expect_equal(lp, list(dist=6, par1=2, par2=0.5, par3=0, autoscale=FALSE)) + lp <- laplace(c(0.5,1), c(0.1,0.2)) + expect_equal(lp, list(dist=6, par1=c(0.5,1), par2=c(0.1,0.2), par3=0, autoscale=TRUE)) + lp <- laplace(c(0.5,1), 0.1) # no error + expect_error(laplace(c(0.5,1), c(0.1,0.2,0.3))) + expect_error(laplace(0.5, -0.2)) +}) + test_that("null prior can be specified",{ expect_equal(null_prior(), list(dist=0, par1=0, par2=0, par3=0, autoscale=FALSE)) }) |