-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathll_lookup.R
52 lines (51 loc) · 1021 Bytes
/
ll_lookup.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#' Title
#'
#' @param family
#'
#' @return
#' @export
#'
#' @examples
prior_lookup <- function(family) {
switch(family,
"frechet" = c(
brms::set_prior("", class = "Intercept"),
brms::set_prior("", class = "nu", lb = 1.00001)
),
c(
brms::set_prior("", class = "Intercept"),
lapply(
bayesfam::aux_family_parameters_lookup(family),
function(x) brms::set_prior("", class = x)
)
)
)
}
#' Generate lookup keys for fit configurations to retrieve prefit objects
#' matching said config.
#'
#' @param fit_conf
#'
#' @return A hash generated from the fit configuration
#' @export
#'
#' @examples
#' fit_conf_key(
#' list(
#' fit_family = "gaussian",
#' fit_link = "identity",
#' prior = list(c(brms::set_prior("", class = "Intercept")))
#' )
#' )
fit_conf_key <- function(fit_conf) {
return(
rlang::hash(
list(
fit_conf$fit_family,
fit_conf$fit_link,
fit_conf$formula,
fit_conf$prior
)
)
)
}