brm_formula_sigma {brms.mmrm} | R Documentation |
Formula for standard deviation parameters
Description
Parameterize standard deviations using
a formula for the sigma
argument of brm_formula()
.
Usage
brm_formula_sigma(
data,
check_rank = TRUE,
intercept = FALSE,
baseline = FALSE,
baseline_subgroup = FALSE,
baseline_subgroup_time = FALSE,
baseline_time = FALSE,
covariates = FALSE,
group = FALSE,
group_subgroup = FALSE,
group_subgroup_time = FALSE,
group_time = FALSE,
subgroup = FALSE,
subgroup_time = FALSE,
time = TRUE
)
Arguments
data |
A classed data frame from |
check_rank |
|
intercept |
Logical of length 1.
|
baseline |
Logical of length 1.
|
baseline_subgroup |
Logical of length 1. |
baseline_subgroup_time |
Logical of length 1.
|
baseline_time |
Logical of length 1.
|
covariates |
Logical of length 1.
|
group |
Logical of length 1.
|
group_subgroup |
Logical of length 1.
|
group_subgroup_time |
Logical of length 1.
|
group_time |
Logical of length 1. |
subgroup |
Logical of length 1.
|
subgroup_time |
Logical of length 1.
|
time |
Logical of length 1. |
Details
In brms
, the standard deviations of the residuals are
modeled through a parameter vector called sigma
. brms.mmrm
always treats sigma
as a distributional parameter
(https://paul-buerkner.github.io/brms/articles/brms_distreg.html).
brm_formula_sigma()
lets you control the parameterization of sigma
.
The output of brm_formula_sigma()
serves as input to the sigma
argument of brm_formula()
.
The default sigma
formula is sigma ~ 0 + time
, where time
is the discrete time variable in the data. This is the usual
heterogeneous variance structure which declares
one standard deviation parameter for each time point in the data.
Alternatively, you could write
brm_formula_sigma(data, intercept = TRUE, time = FALSE)
.
This will produce sigma ~ 1
, which yields a single scalar variance
(a structure termed "homogeneous variance").
With arguments like baseline
and covariates
, you can
specify extremely complicated variance structures. However,
if baseline or covariates are used, then the output of
brm_marginal_draws()
omit effect size due to the statistical
challenges of calculating marginal means of draws of sigma
for this uncommon scenario.
Value
A base R formula with S3 class "brms_mmrm_formula_sigma"
.
This formula controls the parameterization of sigma
, the linear-scale
brms
distributional parameters which represent standard deviations.
See Also
Other models:
brm_formula()
,
brm_model()
Examples
set.seed(0)
data <- brm_data(
data = brm_simulate_simple()$data,
outcome = "response",
group = "group",
time = "time",
patient = "patient",
reference_group = "group_1",
reference_time = "time_1"
)
homogeneous <- brm_formula_sigma(data, time = FALSE, intercept = TRUE)
by_group <- brm_formula_sigma(data, group = TRUE, intercept = TRUE)
homogeneous
by_group
brm_formula(data, sigma = homogeneous)
brm_formula(data, sigma = by_group)