get.prior.Rd
Identical to get.prior()
in MBNMAtime
package.
This function takes JAGS model presented as a string and identifies what
prior values have been used for calculation.
get.prior(model)
A character object of JAGS MBNMA model code
A character vector, each element of which is a line of JAGS code corresponding to a prior in the JAGS code.
Even if an MBNMA model that has not initialised successfully and
results have not been calculated, the JAGS model for it is saved in
mbnma$model.arg$jagscode
and therefore priors can still be obtained.
This allows for priors to be changed even in failing models, which may help
solve issues with compiling or updating.
# \donttest{
# Using the triptans data
network <- mbnma.network(triptans)
#> Values for `agent` with dose = 0 have been recoded to `Placebo`
#> agent is being recoded to enforce sequential numbering
# Run an Emax dose-response MBNMA
result <- mbnma.run(network, fun=demax(), method="random")
#> `likelihood` not given by user - set to `binomial` based on data provided
#> `link` not given by user - set to `logit` based on assigned value for `likelihood`
#> Compiling model graph
#> Resolving undeclared variables
#> Allocating nodes
#> Graph information:
#> Observed stochastic nodes: 182
#> Unobserved stochastic nodes: 197
#> Total graph size: 4115
#>
#> Initializing model
#>
# Obtain model prior values
print(result$model.arg$priors)
#> $mu
#> [1] "dnorm(0,0.0001)"
#>
#> $ed50
#> [1] "dnorm(0,0.0001) T(0,)"
#>
#> $emax
#> [1] "dnorm(0,0.0001)"
#>
#> $sd
#> [1] "dunif(0, 6.021)"
#>
# Priors when using mbnma.run with an exponential function
result <- mbnma.run(network, fun=dexp(), method="random")
#> `likelihood` not given by user - set to `binomial` based on data provided
#> `link` not given by user - set to `logit` based on assigned value for `likelihood`
#> Compiling model graph
#> Resolving undeclared variables
#> Allocating nodes
#> Graph information:
#> Observed stochastic nodes: 182
#> Unobserved stochastic nodes: 190
#> Total graph size: 4087
#>
#> Initializing model
#>
print(result$model.arg$priors)
#> $mu
#> [1] "dnorm(0,0.0001)"
#>
#> $emax
#> [1] "dnorm(0,0.0001)"
#>
#> $sd
#> [1] "dunif(0, 6.021)"
#>
# }