Description Usage Arguments Details Details
View source: R/stanglogitMer-main.R
The stanglogitMer package provides an interface to fit Bayesian Generalized Logit Multilevel Models. These models are useful when the dependent data has a sigmoid-like shape, with boundaries that are not limited within the 0-1 range, as expressed by the following function:
stanglogitMer
fits the Generalized Logit Function by means of Stan.
1 2 3 4 | stanglogitMer(dependent, growth.formula, shift.formula, random.formula,
grouping.random, asymptoms.formula = NULL, covariate, data,
cores = 1, chains = 4, warmup = 2000, iter = 4000, seed = NA,
control = list(adapt_delta = 0.9))
|
growth.formula |
the formula for the fixed effects of the growth parameter. |
shift.formula |
the formula for the fixed effects of the shift parameter. |
random.formula |
the formula for the random effects (slopes). |
grouping.random |
the categorial factor to group the random effects (the intercept). |
covariate |
the x-axis covariate (distance, time, etc...) along which the dependent variable is distributed. You must not include it in the fixed or random effects. |
data |
the data frame |
cores |
Number of cores to use when executing the chains in parallel, which defaults to 1 but we recommend setting the mc.cores option to be as many processors as the hardware and RAM allow (up to the number of chains). For non-Windows OS in non-interactive R sessions, forking is used instead of PSOCK clusters. |
chains |
Number of Markov chains (defaults to 4). |
warmup |
Number of total iterations per chain (including warmup; defaults to 2000). |
iter |
A positive integer specifying number of warmup (aka burnin) iterations. This also specifies the number of iterations used for stepsize adaptation, so warmup samples should not be used for inference. The number of warmup should not be larger than iter and the default is 4000 |
seed |
The seed for random number generation to make results reproducible. If NA (the default), Stan will set the seed randomly. |
control |
A named list of parameters to control the sampler's behavior. It defaults to NULL so all the default values are used. For a comprehensive overview see stan. |
a + \frac{k-a}{1+e^{-g \times (x-s)}}
By means of these functions, you can estimate the linear regression describing the growth parameter (g
),
and the shift parameter (s
), taking into account of a multilevel structure, also known as
random effects.
The necessity to split the formula in three different pieces may be confusing.
In order to better explain how it works, let's say that we want to
fit the following formula, with the classic lmer
syntax:
y ~ Condition * Group + (Condition|Participant)
.
In order to fit with stanglogitMer
that model we will set:
growth.formula = ~ Condition * Group
shift.formula = ~ Condition * Group
random.formula = ~ Condition
grouping = ~ Participant
The main function of stanglogitMer is stanglogitMer
, which uses formula syntax to
specify your model.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.