run_model | R Documentation |
This function, as with all Bayesian models, will probably take a long time to run.
run_model( db, model.opt = c("2sex.2age", "1sex.1age", "2sex.1age", "1sex.2age", "compare1v2age", "compare1v2ageNEXT"), filename = "bayesmodel.txt", iters, thin, is.parallel = FALSE, DIC = FALSE, n.chains = 10, return.raw.samples = FALSE, n.adapt = 3000, n.burnin = 100, fix.biggest = FALSE, pseudopriors = NULL )
db |
the data frame with observed MRB values (these must contained in a column named 'mrb') |
model.opt |
select which version of the model to run |
filename |
the name of the file that the JAGS model specifications will be saved to |
iters |
the number of iterations of the MCMC sampler |
thin |
thinning rate in the MCMC sampler. Must be a positive integer. |
is.parallel |
if parallel=TRUE, specify the number of CPU cores used. Defaults to total available cores or the number of chains, whichever is smaller. |
DIC |
option to report the deviance information criterion and the estimated number of parameters (pD). (perhaps useful for model selection) |
n.chains |
the number of chains in the MCMC sampler |
return.raw.samples |
whether the raw MCMC posterior samples be returned or a tidy database of samples linked to the actual input data |
n.adapt |
number of iterations to run in the JAGS adaptive phase. The default is NULL, which will result in the function running groups of 100 adaptation iterations (to a max of 10,000) until JAGS reports adaptation is sufficient. If you set n.adapt manually, 1000 is the recommended minimum value |
n.burnin |
number of iterations at the beginning of the chain to discard (i.e., the burn-in). Does not include the adaptive phase iterations. |
fix.biggest |
if TRUE, the data point with the largest MRB will be fixed as male. This can help if there are issues of model identifiability. |
pseudopriors |
(optional) this is for passing pseudopriors into the model when running a "super model" |
depending on the return.raw.samples
parameter, either a MCMC list object or a data frame with the posterior distribution joined with the original data set. If the latter is chosen, the 'rowid.' column refers to the original row in the data frame that the estimates were made for.
Andrew Burchill, andrew.burchill@asu.edu
## Not run: db = data.frame(mrb=c(rgamma(50,64,160), rgamma(50,2500,5000)), location=sample(c("palace", "domestic"), 100, replace=TRUE) ) output = run_model(db, "2sex.2age", 15000, 5, F, F, 3, F) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.