set_prior: Set prior(s) for a network model

View source: R/ui_model-building.R

set_priorR Documentation

Set prior(s) for a network model

Description

Set prior(s) for a network model

Usage

set_prior(x, prior, param = "", use_regexp = TRUE, quiet = FALSE)

set_priors(x, prior, param = "", use_regexp = TRUE, quiet = FALSE)

Arguments

x

A networkModel object.

prior

A prior built with e.g. uniform_p() or hcauchy_p(). Call available_priors() to see a table of implemented priors. Alternatively, if prior is a tibble, the function will try to use it to set parameter priors. The format of such an argument is the same as the format of the output of the getter function priors() (see examples). Note that if 'prior' is given as a tibble, all other arguments (except 'x') are disregarded.

param

String, target parameter or regexp to target several parameters. Default is the empty string "", which will match all parameters.

use_regexp

Boolean, if TRUE (the default) then param is used as a regular expression to match one or several parameter names.

quiet

Boolean, if FALSE print a message indicating which parameters had their prior modified.

Value

A networkModel object.

Examples

# Copy `aquarium_mod`
m <- aquarium_mod
priors(m)

# Modify the priors of `m`
m <- set_priors(m, exponential_p(0.5), "lambda")
priors(m)

# Re-apply priors from the original `aquarium_mod`
prev_priors <- priors(aquarium_mod)
prev_priors
m <- set_priors(m, prev_priors)
priors(m)


isotracer documentation built on Sept. 22, 2023, 1:07 a.m.