Description Usage Arguments Details Examples
not used by user, typically
1 2 3 |
x |
intervenable exposures (character vector) |
z |
covariates (character vector) |
y |
outcome |
binvars |
= non-outcome variables that are binary (character vector) |
matx |
optional, name of matrix with intervenable exposures |
standardizex |
logical, should x be standardized? |
binary |
logical, is outcome binary? |
xintv |
matrix with ncol = number of intervenable exposures, nrow = number of interventions. Each value is on [0,1] and represents the proportional decrease in the value of x upon hypothetical intervention |
lorem ipsum
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 | # library(rjags)
dgm <- function(N=100, trueRD=0.2){
x1 = rbinom(N, 1, 0.5)
py00 = runif(N)*0.1 + 0.4
l2 = rbinom(N, 1, 1/(1+exp(-1 + x1 + py00)))
x2 = rbinom(N, 1, 1/(1+exp(-1 + x1 + l2)))
py = py00 + trueRD*((x1 + x2)/2) #true risk difference per unit exposure;
y = rbinom(N, 1, py)
data.frame(x1, l2, x2, y)
}
dat = as.list(dgm(100))
dat$N = 100
dat$p = 5
source("~/Epiprojects/wellwater/sims/code/make_stan_terms.R")
mod = jags_basic(x=c('x1', 'x2'), z = 'l2', y='y',
binvars=c('x1', 'x2', 'l2'), xintv = rbind(c(1,0), c(0,1),c(1,1)),
binary=TRUE, matx = NULL)
cat(mod)
# usage in jags (or edit by hand)
# not run
# tf = tempfile()
# cat(mod, file=tf)
# jags.model(file = tf, data = dat, n.chains=1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.