Description Usage Arguments Value Usage notes See Also Examples
Fit a model to binomial data
1 2 |
n |
the vector holding the number of observations |
r |
the vector holding the number of responders |
inits |
a list containing the initial values of the hyperparameters. See Usage Notes below. |
modelString |
The JAGS model string that defines the model to be fitted |
autoRun |
Logical. If |
raw |
logical if |
... |
passed to JAGS |
Either the mcmc
(or mcmc.list
) object returned by
JAGS or a tibble containing the MCMC samples from the posterior
distribution
If modelString == NULL
, the model string is obtained by calling
getModelString("binomial")
.
If raw == FALSE
, the chain from which each observation is drawn is
indicated by Chain
and the dataset is transformed into tidy format,
with the model parameter indicated by Parameter
.
The inits
parameter can be used to define the number of chains created
my JAGS. If a list of lists, the number of elements in the
outer list defines the number of chains and the elements of each sub-list
define the initial value for each hyperparameter. For example, the default
value of inits
requests two chains. The initial values of a
and b
in the first chain are 2 and 4, respectively. In the second
chain, the corresponding values are 9 and 1. If the MCMC model has converged
and is stationary, the initial values of the hyperparameters will be
irrelevant. To check for convergence, it is necessary - but not sufficient
- to obtain more than one chain and to use different initial values for each
chain.
fitPoissonModel
, fitBinaryModel
,
fitTteModel
1 2 3 4 5 6 7 8 9 10 | #Simple use
b <- createBerryData()
m <- fitBinomialModel(b$Subjects, b$Events) %>% dplyr::filter(Index == 10)
#Passing parameters to run.jags()
inits1 <- list(a=4, b=2)
inits2 <- list(a=1, b=1)
inits3 <- list(a=2, b=10)
m <- fitBinomialModel(b$Subjects, b$Events,
inits=list(inits1, inits2, inits3),
thin=2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.