Skip to content

makemyprior

Intuitive Construction of Joint Priors for Variance Parameters

v1.2.2 · Aug 23, 2024 · GPL (>= 2)

Description

Tool for easy prior construction and visualization. It helps to formulates joint prior distributions for variance parameters in latent Gaussian models. The resulting prior is robust and can be created in an intuitive way. A graphical user interface (GUI) can be used to choose the joint prior, where the user can click through the model and select priors. An extensive guide is available in the GUI. The package allows for direct inference with the specified model and prior. Using a hierarchical variance decomposition, we formulate a joint variance prior that takes the whole model structure into account. In this way, existing knowledge can intuitively be incorporated at the level it applies to. Alternatively, one can use independent variance priors for each model components in the latent Gaussian model. Details can be found in the accompanying scientific paper: Hem, Fuglstad, Riebler (2024, Journal of Statistical Software, <doi:10.18637/jss.v110.i03>).

Downloads

219

Last 30 days

14985th

219

Last 90 days

219

Last year

CRAN Check Status

1 ERROR
2 NOTE
11 OK
Show all 14 flavors
Flavor Status
r-devel-linux-x86_64-debian-clang OK
r-devel-linux-x86_64-debian-gcc OK
r-devel-linux-x86_64-fedora-clang OK
r-devel-linux-x86_64-fedora-gcc OK
r-devel-macos-arm64 ERROR
r-devel-windows-x86_64 OK
r-oldrel-macos-arm64 NOTE
r-oldrel-macos-x86_64 NOTE
r-oldrel-windows-x86_64 OK
r-patched-linux-x86_64 OK
r-release-linux-x86_64 OK
r-release-macos-arm64 OK
r-release-macos-x86_64 OK
r-release-windows-x86_64 OK
Check details (16 non-OK)
OK r-devel-linux-x86_64-debian-clang

*


            
OK r-devel-linux-x86_64-debian-gcc

*


            
OK r-devel-linux-x86_64-fedora-clang

*


            
OK r-devel-linux-x86_64-fedora-gcc

*


            
ERROR r-devel-macos-arm64

re-building of vignette outputs

Error(s) in re-building vignettes:
--- re-building ‘latin_square.Rmd’ using rmarkdown
--- finished re-building ‘latin_square.Rmd’

--- re-building ‘make_prior.Rmd’ using rmarkdown
makemyprior_models         package:makemyprior         R Documentation

_L_i_s_t _a_v_a_i_l_a_b_l_e _p_r_i_o_r_s, _l_a_t_e_n_t _m_o_d_e_l_s _a_n_d _l_i_k_e_l_i_h_o_o_d_s

_D_e_s_c_r_i_p_t_i_o_n:

     Prints available priors, latent models and likelihoods to use with
     make_prior.

_U_s_a_g_e:

     makemyprior_models(type = c("prior", "latent", "likelihood"), select = NULL)
     
_A_r_g_u_m_e_n_t_s:

    type: Which of priors, latent models and likelihoods to list.
          Options are 'prior', 'latent' and 'likelihood'

  select: Which in each group to show details about. 'NULL' gives only
          list what exists (default), 'all' gives detailed information
          about everything in that category. Can also ask for one or
          more specific priors/latent models/likelihoods

_V_a_l_u_e:

     None.

_E_x_a_m_p_l_e_s:

     makemyprior_models("prior", c("pc0", "pc1"))
     makemyprior_models("latent")
     makemyprior_models("likelihood", "all")
     

--- finished re-building ‘make_prior.Rmd’

sh: line 1: 49675 Segmentation fault: 11  '/Library/Frameworks/R.framework/Resources/bin/R' --vanilla --no-echo > '/Volumes/Temp/tmp/RtmpE3mOm8/fileb74f4a75aac0' 2>&1 < '/Volumes/Temp/tmp/RtmpE3mOm8/fileb74f731d4970'
--- re-building ‘neonatal_mortality.Rmd’ using rmarkdown

 *** caught segfault ***
address 0x2e, cause 'invalid permissions'

Traceback:
 1: base::eigen(mat)
 2: compute_rank(mat1_red)
 3: reduce_matrices(list(base_mat, alt_mat))
 4: calculate_pc_prior(args$node_data, args$prior_data$weights, covmats,     gui = FALSE)
 5: make_valid_prior_object(data = list(fixed = lapply(prior$fixed_effects,     function(x) x$data), random = lapply(prior$random_effects,     function(x) x$data)), args = list(node_data = node_data,     prior_data = prior_data, covmats = covmats, response_name = prior$response_name,     use_intercept = prior$use_intercept, family = family, latent = model_data))
 6: make_prior(formula, neonatal_data, family = "binomial", prior = list(tree = "s1 = (u, v); s2 = (s1, nu)",     w = list(s1 = list(prior = "pc0", param = 0.25), s2 = list(prior = "pc1",         param = 0.75)), V = list(s2 = list(prior = "pc", param = c(3.35,         0.05)))))
 7: eval(expr, envir)
 8: eval(expr, envir)
 9: withVisible(eval(expr, envir))
10: withCallingHandlers(code, error = function (e) rlang::entrace(e), message = function (cnd) {    watcher$capture_plot_and_output()    if (on_message$capture) {        watcher$push(cnd)    }    if (on_message$silence) {        invokeRestart("muffleMessage")    }}, warning = function (cnd) {    if (getOption("warn") >= 2 || getOption("warn") < 0) {        return()    }    watcher$capture_plot_and_output()    if (on_warning$capture) {        cnd <- sanitize_call(cnd)        watcher$push(cnd)    }    if (on_warning$silence) {        invokeRestart("muffleWarning")    }}, error = function (cnd) {    watcher$capture_plot_and_output()    cnd <- sanitize_call(cnd)    watcher$push(cnd)    switch(on_error, continue = invokeRestart("eval_continue"),         stop = invokeRestart("eval_stop"), error = NULL)})
11: eval(call)
12: eval(call)
13: with_handlers({    for (expr in tle$exprs) {        ev <- withVisible(eval(expr, envir))        watcher$capture_plot_and_output()        watcher$print_value(ev$value, ev$visible, envir)    }    TRUE}, handlers)
14: doWithOneRestart(return(expr), restart)
15: withOneRestart(expr, restarts[[1L]])
16: withRestartList(expr, restarts[-nr])
17: doWithOneRestart(return(expr), restart)
18: withOneRestart(withRestartList(expr, restarts[-nr]), restarts[[nr]])
19: withRestartList(expr, restarts)
20: withRestarts(with_handlers({    for (expr in tle$exprs) {        ev <- withVisible(eval(expr, envir))        watcher$capture_plot_and_output()        watcher$print_value(ev$value, ev$visible, envir)    }    TRUE}, handlers), eval_continue = function() TRUE, eval_stop = function() FALSE)
21: evaluate::evaluate(...)
22: evaluate(code, envir = env, new_device = FALSE, keep_warning = if (is.numeric(options$warning)) TRUE else options$warning,     keep_message = if (is.numeric(options$message)) TRUE else options$message,     stop_on_error = if (is.numeric(options$error)) options$error else {        if (options$error && options$include)             0L        else 2L    }, output_handler = knit_handlers(options$render, options))
23: in_dir(input_dir(), expr)
24: in_input_dir(evaluate(code, envir = env, new_device = FALSE,     keep_warning = if (is.numeric(options$warning)) TRUE else options$warning,     keep_message = if (is.numeric(options$message)) TRUE else options$message,     stop_on_error = if (is.numeric(options$error)) options$error else {        if (options$error && options$include)             0L        else 2L    }, output_handler = knit_handlers(options$render, options)))
25: eng_r(options)
26: block_exec(params)
27: call_block(x)
28: process_group(group)
29: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),     error = function(e) {        if (progress && is.function(pb$interrupt))             pb$interrupt()        if (is_R_CMD_build() || is_R_CMD_check())             error <<- format(e)    })
30: with_options(withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),     error = function(e) {        if (progress && is.function(pb$interrupt))             pb$interrupt()        if (is_R_CMD_build() || is_R_CMD_check())             error <<- format(e)    }), list(rlang_trace_top_env = knit_global()))
31: xfun:::handle_error(with_options(withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),     error = function(e) {        if (progress && is.function(pb$interrupt))             pb$interrupt()        if (is_R_CMD_build() || is_R_CMD_check())             error <<- format(e)    }), list(rlang_trace_top_env = knit_global())), function(loc) {    setwd(wd)    write_utf8(res, output %n% stdout())    paste0("\nQuitting from ", loc, if (!is.null(error))         paste0("\n", rule(), error, "\n", rule()))}, if (labels[i] != "") sprintf(" [%s]", labels[i]), get_loc)
32: process_file(text, output)
33: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
34: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(),     output_dir = getwd(), ...)
35: vweave_rmarkdown(...)
36: engine$weave(file, quiet = quiet, encoding = enc)
37: doTryCatch(return(expr), name, parentenv, handler)
38: tryCatchOne(expr, names, parentenv, handlers[[1L]])
39: tryCatchList(expr, classes, parentenv, handlers)
40: tryCatch({    engine$weave(file, quiet = quiet, encoding = enc)    setwd(startdir)    output <- find_vignette_product(name, by = "weave", engine = engine)    if (!have.makefile && vignette_is_tex(output)) {        texi2pdf(file = output, clean = FALSE, quiet = quiet)        output <- find_vignette_product(name, by = "texi2pdf",             engine = engine)    }}, error = function(e) {    OK <<- FALSE    message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s",         file, conditionMessage(e)))})
41: tools:::.buildOneVignette("neonatal_mortality.Rmd", "/Volumes/Builds/packages/sonoma-arm64/results/4.6/makemyprior.Rcheck/vign_test/makemyprior",     TRUE, FALSE, "neonatal_mortality", "UTF-8", "/Volumes/Temp/tmp/RtmpE3mOm8/fileb74f5b30758d.rds")
An irrecoverable exception occurred. R is aborting now ...
--- re-building ‘wheat_breeding.Rmd’ using rmarkdown
--- finished re-building ‘wheat_breeding.Rmd’

SUMMARY: processing the following file failed:
  ‘neonatal_mortality.Rmd’

Error: Vignette re-building failed.
Execution halted
OK r-devel-windows-x86_64

*


            
NOTE r-oldrel-macos-arm64

Rd cross-references

Package unavailable to check Rd xrefs: ‘INLA’
NOTE r-oldrel-macos-arm64

package dependencies

Package suggested but not available for checking: ‘INLA’
NOTE r-oldrel-macos-x86_64

Rd cross-references

Package unavailable to check Rd xrefs: ‘INLA’
NOTE r-oldrel-macos-x86_64

package dependencies

Package suggested but not available for checking: ‘INLA’
OK r-oldrel-windows-x86_64

*


            
OK r-patched-linux-x86_64

*


            
OK r-release-linux-x86_64

*


            
OK r-release-macos-arm64

*


            
OK r-release-macos-x86_64

*


            
OK r-release-windows-x86_64

*


            

Check History

ERROR 11 OK · 2 NOTE · 0 WARNING · 1 ERROR · 0 FAILURE Mar 9, 2026

Dependency Network

Dependencies Reverse dependencies ggplot2 Matrix shiny shinyjs shinyBS visNetwork rlang MASS makemyprior

Version History

new 1.2.2 Mar 9, 2026