# NOT RUN {
# }
# NOT RUN {
## Load pied flycatcher data
data(pied_flycatchers_1)
## Create variables bounding the true load
pfdata$lower=ifelse(pfdata$load==0,log(.001),log(pfdata$load-.049))
pfdata$upper=log(pfdata$load+.05)
## Mean model
mymean=list(fixed=list(name="alpha",
formula=~ log(IVI) + broodsize + sex,
priors=list(c("dnorm",0,.001))))
## Variance model
myvar=list(fixed=list(name="psi",
link="log",
formula=~broodsize + sex,
priors=list(c("dnorm",0,.001))))
## Set working directory
## By default uses a system temp directory. You probably want to change this.
workingDir <- tempdir()
## Define list of arguments for jags.model()
jm.args <- list(file=file.path(workingDir,"pied_flycatcher_1_jags.R"),n.adapt=1000)
## Define list of arguments for coda.samples()
cs.args <- list(n.iter=5000)
## Run the model using dalmatian
pfresults <- dalmatian(df=pfdata,
mean.model=mymean,
variance.model=myvar,
jags.model.args=jm.args,
coda.samples.args=cs.args,
rounding=TRUE,
lower="lower",
upper="upper",
debug=FALSE)
# }
Run the code above in your browser using DataLab