assign_prior: Assign Prior Distributions to Parameters

Description Usage Arguments Value Examples

View source: R/set_prior.R

Description

Assign Prior Distributions to Parameters

Usage

1
assign_prior(param, prior, dpar, level = NULL)

Arguments

param

character string. Which parameter (e.g., "(Intercept)")? This must match the column names of the model matrix.

prior

character string. The desired prior distribution, following the JAGS formulation with the precision and not variance for the scale. See Details.

dpar

character string. Which distributional parameter? The options include location (effect-size) and scale (variance component).

level

character string. The level when dpar = "scale". For example, in a three-level model, set level = "two" for the level two scale model.

Value

A list that is used internally.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
library(psymetadata)

prior <- c(assign_prior(param = "(Intercept)", 
           prior = "dnorm(0, 1)", dpar = "location"),
           assign_prior(param = "(Intercept)", 
           prior = "dnorm(-2, 1)", 
           dpar = "scale", level = "two")
           )
priors <- make_prior(yi = yi, 
                     vi = vi, 
                     prior = prior,
                     es_id = es_id,
                     study_id = study_id,
                     data = gnambs2020)
                     
priors

donaldRwilliams/blsmeta documentation built on Dec. 20, 2021, 12:12 a.m.