Skip to contents

Samples from a prior distribution with parameters defined in prior. The result can be plotted using the plot function.

Usage

sample_prior(
  method = c("hs", "lasso"),
  prior = switch(method, lasso = c(df = 1, scale = 1), hs = c(df = 1, df_global = 1,
    df_slab = 4, scale_global = 1, scale_slab = 2, par_ratio = NULL)),
  iter = 1000
)

Arguments

method

Character string, indicating which prior to sample from. Default: first element of c("hs", "lasso").

prior

Numeric vector, specifying the prior to use. See brma for more details.

iter

A positive integer specifying the number of iterations to sample. Default: 1000

Value

NULL, function is called for its side-effect of plotting to the graphics device.

Examples

sample_prior("lasso", iter = 10)
#> $method
#> [1] "lasso"
#> 
#> $iter
#> [1] 10
#> 
#> $samples
#> Inference for Stan model: lasso_prior.
#> 1 chains, each with iter=10; warmup=0; thin=1; 
#> post-warmup draws per chain=10, total post-warmup draws=10.
#> 
#>                   mean se_mean   sd  2.5%   25%   50%   75% 97.5% n_eff Rhat
#> b                 2.54    0.88 1.90 -0.56  1.01  3.16  4.18  4.28     5 1.26
#> lasso_inv_lambda  2.38    0.56 1.35  0.50  1.54  2.13  3.06  4.57     6 1.42
#> lp__             -4.61    0.45 0.92 -5.65 -5.10 -4.97 -4.02 -3.06     4 1.59
#> 
#> Samples were drawn using NUTS(diag_e) at Fri Aug  8 10:02:01 2025.
#> For each parameter, n_eff is a crude measure of effective sample size,
#> and Rhat is the potential scale reduction factor on split chains (at 
#> convergence, Rhat=1).
#> 
#> attr(,"class")
#> [1] "brma_prior" "list"