aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Cally <jcally@student.unimelb.edu.au>2022-04-12 10:34:31 +1000
committerJustin Cally <jcally@student.unimelb.edu.au>2022-04-12 10:34:31 +1000
commit54ee1f7f8f436df1d93474208e20c326776c0343 (patch)
tree13689537a0978dfe1d0a327052819a7f05c9ab9c
parent074be5504491afa296557215afc77f5ad9c98688 (diff)
add laplace function
-rw-r--r--R/priors.R10
1 files changed, 10 insertions, 0 deletions
diff --git a/R/priors.R b/R/priors.R
index 81e5560..9313d0d 100644
--- a/R/priors.R
+++ b/R/priors.R
@@ -88,6 +88,16 @@ gamma <- function(shape=1, rate=1){
list(dist=5, par1=shape, par2=rate, par3=0, autoscale=FALSE)
}
+#' @rdname priors
+#' @export
+laplace <- function(location=0, scale=2.5, autoscale=TRUE){
+ stopifnot(all(scale > 0))
+ if((length(location) > 1) & (length(scale) > 1)){
+ stopifnot(length(location) == length(scale))
+ }
+ list(dist=6, par1=location, par2=scale, par3=0, autoscale=autoscale)
+}
+
null_prior <- function(){
list(dist=0, par1=0, par2=0, par3=0, autoscale=FALSE)
}