juggler: Juggler Package

Description See Also Examples

Description

Check, manipulate and format JAGS model code.

When presented with new code the first job is to use jg_check to see if the code has any problems which may be fixable using jg_fix or may require manually editing. Once checked code can be combined with code fragments using jg_juggle to produce multiple models. If marked up using the #' MPAmpa syntax models can then be extended using jg_extend to produce fast, flexible code for passing to jaggernaut and/or for formatting using jg_format for your reports. Alternatively jaggernaut does all this behind the scenes so just pass it your MPAmpa marked up JAGS model code and fragments and the data of interest and it let efficiently and flexibly manipulate your code and perform the analyses for you. The other functions are primarily exported for jaggernaut which imports the juggler package but you may find uses for them.

See Also

jg_check, jg_fix, jg_juggle, jg_extend and jg_format.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
x <- "data {
  Y2 <- Y * 2
}  
model {
  bIntercept ~ dnorm(0, 5^-2)
  bX ~ dnorm(0, 5^-2)
  sY ~ dunif(0, 5)
  for(i in 1:length(Y)) {
    mu[i] <- bIntercept + bX * X[i]
    Y2[i] ~ dnorm (mu[i], sY^-2)
  }
} "

jg_dists(x)
jg_funcs(x)
jg_vnodes(x)
jg_vnodes(x, indices = TRUE)
jg_vnodes(x, "stochastic", indices = TRUE)
jg_vnodes(x, "deterministic")
jg_block_names(x)
print(jg_check(x))
 
## Not run:  

x <- "model2 {
Y2 <- Y * 2
}  
data {
  bIntercept ~ dnorm(0, 5^-2)
  bX <- dnorm(0, 5^-2)
  dnorm ~ mean(0, 5)
  
  fore(i in 1:length(Y)) {
    mu[i] <- bIntercept + bX * X[i]
    Y2[i] ~ dorm (mu[i], sY^-2)
  }
} "

jg_dists(x)
jg_funcs(x)
jg_nnodes(x)
print(jg_check(x))

## End(Not run)

poissonconsulting/juggler documentation built on Feb. 18, 2021, 11:12 p.m.