Description Usage Arguments Value Usage notes See Also Examples
Fit a Normal model to subject-level data
1 2 |
x |
a vector of observed data |
g |
a vector indicating the group membership for each datum. Either a factor defining group membership, or a vector of integers between 1 and the number of groups. |
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("tte")
.
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 shape
and scale
in the first chain are both 0.0001. In the second
chain, they are both 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.
Note that some parameters to run.jags
are incompatible with
autorun.jags
and will therefor cause an error when passed in
...
unless autoRun
is set to FALSE
. These parameters
include samples
and burnin
and will result in an error similar
to "Error in extend.jags(runjags.object, add.monitor = add.monitor,
drop.monitor = drop.monitor,
: formal argument "burnin" matched by multiple
actual arguments".
fitBinomialModel
, fitPoissonModel
,
fitBinaryModel
, fitTteModel
1 2 3 4 5 6 7 8 | #Fit a Normal QTL model to artifical data
nCentres <- 6
centreSizes <- ceiling(runif(nCentres, min=8, max=25))
group <- rep(1:nCentres, times=centreSizes)
centreMeans <- rnorm(nCentres, mean=5, sd=1.5)
means <- rep(centreMeans, times=centreSizes)
x <- rnorm(length(group), means, 3)
fitNormalModel(x, group)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.