jg_vnodes: Get variable nodes in JAGS model code

Description Usage Arguments Value Examples

Description

Gets names of variable (as opposed to constant) named nodes in JAGS model code

Usage

1
jg_vnodes(x, type = "both", indices = FALSE, comment = "[$][^\n]+[$]")

Arguments

x

string of JAGS model code

type

string of node type. Must be 'stochastic', 'deterministic' or 'both' (the default). A variable node is any word possibly

indices

flag of whether to retain indices

comment

A string defining the regular expression to use to filter text from the comment for the node.

Value

Character vector of unique sorted variable node names

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
model_code <- "data{
   Y ~ dpois(2) 
}

model {

 bLambda ~ dlnorm(0,10^-2) #$\\lamda_{beta}$
 for (i in 1:length(x)) { x[i]~dpois(bLambda) 
   b[i] ~dpois(1)
   bc[i] <- b[i]
 }
 bd <- dpois(1, 1)
}"
jg_vnodes(model_code)

poissonconsulting/jaggernaut documentation built on Feb. 18, 2021, 11:10 p.m.