cglmm()
cglmm()
wrangles the data appropriately to fit the
cosinor model given the formula specified by the user. It provides
estimates of amplitude, acrophase, and MESOR (Midline Statistic Of
Rhythm).
The formula argument for cglmm()
is specified using the
{lme4}
style (for details see
vignette("lmer", package = "lme4")
). The only difference is
that it allows for use of an amp_acro()
call within the
formula that is used to identify the circadian components and relevant
variables in the data.frame
. Any other combination of
covariates can also be included in the formula as well as random effects
and zero-inflation (ziformula
) and dispersion
(dispformula
) formulae. For detailed examples of how to
specify models, see the mixed-models,
model-specification
and multiple-components
vignettes.
The following examples use data simulated by the the
simulate_cosinor
function.
Here, we fit a simple cosinor model to “testdata_simple” - simulated data from a Poisson distribution loaded in this vignette. In this example, there is no grouping variable.
testdata_simple <- simulate_cosinor(
1000,
n_period = 2,
mesor = 5,
amp = 2,
acro = 1,
beta.mesor = 4,
beta.amp = 1,
beta.acro = 0.5,
family = "poisson",
period = c(12),
n_components = 1,
beta.group = TRUE
)
object <- cglmm(
Y ~ amp_acro(times,
period = 12
),
data = filter(testdata_simple, group == 0),
family = poisson()
)
object
#>
#> Conditional Model
#>
#> Raw formula:
#> Y ~ main_rrr1 + main_sss1
#>
#> Raw Coefficients:
#> Estimate
#> (Intercept) 4.99845
#> main_rrr1 1.08228
#> main_sss1 1.68235
#>
#> Transformed Coefficients:
#> Estimate
#> (Intercept) 4.99845
#> amp 2.00041
#> acr 0.99913
The output shows the estimates for the raw coefficients in addition
to the transformed estimates for amplitude (amp) and acrophase (acr) and
MESOR ((Intercept)
). The previous section of this vignette:
An
overview of the statistical methods used for parameter estimation
outlines the difference between the raw coefficients and the transformed
coefficients.
We would interpret the output as follows:
MESOR estimate = 4.99845
Amplitude estimate = 1.08228
Acrophase estimate = 0.99913
Note that this estimate is in radians to align with conventions. To
interpret this, we can express 0.99913 radians
as a
fraction of the total 2π and
multiply by the period to get the time when the response is a maximal.
Hence, $\frac{0.99913}{2\pi} \times 12 =
1.908$ in the units of the time_col
column in the
original dataframe. This is saying that the peak response would occur
after 1.908 time-units and every 12 time-units after this. We can
confirm this by plotting:
Similarly to a normal regression model with {lme4}
or
{glmmTMB}
, we can add a term for the group in the model so
that we can estimate the difference in MESOR between
the two groups.
object <- cglmm(
Y ~ group + amp_acro(times,
period = 12,
group = "group"
),
data = testdata_simple_gaussian,
family = gaussian()
)
object
#>
#> Conditional Model
#>
#> Raw formula:
#> Y ~ group + group:main_rrr1 + group:main_sss1
#>
#> Raw Coefficients:
#> Estimate
#> (Intercept) 4.96475
#> group1 -0.98130
#> group0:main_rrr1 1.04667
#> group1:main_rrr1 0.88812
#> group0:main_sss1 1.68266
#> group1:main_sss1 0.47976
#>
#> Transformed Coefficients:
#> Estimate
#> (Intercept) 4.96475
#> [group=1] -0.98130
#> [group=0]:amp 1.98163
#> [group=1]:amp 1.00942
#> [group=0]:acr 1.01433
#> [group=1]:acr 0.49528
This is the same dataset used in the previous example, but note the following differences:
The MESOR estimate for the reference group
(group = 0
) is given by
(Intercept) = 4.96476
The estimate for the difference between the MESOR of the
reference group (group = 0
) and the treatment group
(group = 1
) is given by [group=1] = -0.98129
.
As such, the estimate for the MESOR of group = 1
is
3.98347
.
The estimates for amplitude and acrophase are slightly different to the previous example because there is no longer a shared MESOR.
Plotting this model and comparing to the previous model which used the same dataset, one can appreciate the importance of specifying the formula correctly in order to gain the most accurate model.
We may also be interested in estimating the MESOR for the two groups
separately, rather than the difference between groups. To achieve this,
we can remove the intercept term by using 0 +
.
cglmm(
Y ~ 0 + group + amp_acro(times,
period = 12,
group = "group"
),
data = testdata_simple,
family = poisson()
)
#>
#> Conditional Model
#>
#> Raw formula:
#> Y ~ group + group:main_rrr1 + group:main_sss1 - 1
#>
#> Raw Coefficients:
#> Estimate
#> group0 4.99845
#> group1 3.99631
#> group0:main_rrr1 1.08228
#> group1:main_rrr1 0.87665
#> group0:main_sss1 1.68235
#> group1:main_sss1 0.48195
#>
#> Transformed Coefficients:
#> Estimate
#> [group=0] 4.99845
#> [group=1] 3.99631
#> [group=0]:amp 2.00041
#> [group=1]:amp 1.00040
#> [group=0]:acr 0.99913
#> [group=1]:acr 0.50266
amp_acro()
functionThe amp_acro()
function controls the cosinor components
of model (specifically, this affects just the fixed-effects part). It
provides the user with the ability to specify grouping structures, the
period of the rhythm, and the number of components. There are several
arguments that the user must specify:
group
is the name of the grouping variable in the
dataset. This can be a string or an object
time_col
is the name of the time column in the
dataset. This can be a string or an object
n_components
is the number of components.
If the user wishes to fit a multicomponent cosinor model, they can
specify the number of components using the n_components
variable. The value of n_components
will need to match the
length of the group
and period
arguments as
these will be combined for each component.
For example:
testdata_two_components <- simulate_cosinor(
1000,
n_period = 10,
mesor = 7,
amp = c(0.1, 0.4),
acro = c(1, 1.5),
beta.mesor = 4.4,
beta.amp = c(2, 1),
beta.acro = c(1, -1.5),
family = "poisson",
period = c(12, 6),
n_components = 2,
beta.group = TRUE
)
cglmm(
Y ~ group + amp_acro(
time_col = times,
n_components = 2,
period = c(12, 6),
group = c("group", "group")
),
data = testdata_two_components,
family = poisson()
)
#>
#> Conditional Model
#>
#> Raw formula:
#> Y ~ group + group:main_rrr1 + group:main_sss1 + group:main_rrr2 + group:main_sss2
#>
#> Raw Coefficients:
#> Estimate
#> (Intercept) 7.00043
#> group1 -2.60739
#> group0:main_rrr1 0.05665
#> group1:main_rrr1 1.08270
#> group0:main_sss1 0.08378
#> group1:main_sss1 1.68926
#> group0:main_rrr2 0.02884
#> group1:main_rrr2 0.07367
#> group0:main_sss2 0.39671
#> group1:main_sss2 -0.99891
#>
#> Transformed Coefficients:
#> Estimate
#> (Intercept) 7.00043
#> [group=1] -2.60739
#> [group=0]:amp1 0.10113
#> [group=1]:amp1 2.00645
#> [group=0]:amp2 0.39776
#> [group=1]:amp2 1.00162
#> [group=0]:acr1 0.97624
#> [group=1]:acr1 1.00082
#> [group=0]:acr2 1.49824
#> [group=1]:acr2 -1.49718
In the output, the suffix on the estimates for amplitude and acrophase represents its component:
[group=0]:amp1 = 0.10113
represents the estimate for
amplitude of group 0
for the first component
[group=1]:amp1 = 2.00645
represents the estimate for
amplitude of group 1
for the first component
[group=0]:amp2 = 0.39776
represents the estimate for
amplitude of group 0
for the second component
[group=1]:amp2 = 1.00162
represents the estimate for
amplitude of group 1
for the second component
Similarly for acrophase estimates
If a multicomponent model has one component that is grouped with
other components that aren’t, the vector input for group
must still be the same length as n_components
but have the
non-grouped components represented as group = NA
.
For example, if we wanted only the first component to have a grouped
component, we would specify the group
argument as
group = c("group", NA))
.
For a detailed explanation of how to specify multi-component models, see multiple-components
The cglmm()
function allows users to specify formulas
for dispersion and zero-inflation models. These formulas are independent
of the main formula specification:
testdata_disp_zi <- simulate_cosinor(1000,
n_period = 6,
mesor = 7,
amp = c(0.1, 0.4, 0.5),
acro = c(1, 1.5, 0.1),
beta.mesor = 4.4,
beta.amp = c(2, 1, 0.4),
beta.acro = c(1, -1.5, -1),
family = "gaussian",
period = c(12, 6, 8),
n_components = 3
)
object_disp_zi <- cglmm(
Y ~ group + amp_acro(times,
n_components = 3,
period = c(12, 6, 8),
group = "group"
),
data = testdata_disp_zi, family = gaussian(),
dispformula = ~ group + amp_acro(times,
n_components = 2,
group = "group",
period = c(12, 6)
),
ziformula = ~ group + amp_acro(times,
n_components = 3,
group = "group",
period = c(7, 8, 2)
)
)
object_disp_zi
#>
#> Conditional Model
#>
#> Raw formula:
#> Y ~ group + group:main_rrr1 + group:main_sss1 + group:main_rrr2 + group:main_sss2 + group:main_rrr3 + group:main_sss3
#>
#> Raw Coefficients:
#> Estimate
#> (Intercept) 6.98873
#> group1 -2.66526
#> group0:main_rrr1 0.00708
#> group1:main_rrr1 1.09724
#> group0:main_sss1 0.10792
#> group1:main_sss1 1.68515
#> group0:main_rrr2 0.02298
#> group1:main_rrr2 0.13460
#> group0:main_sss2 0.38418
#> group1:main_sss2 -1.00178
#> group0:main_rrr3 0.49653
#> group1:main_rrr3 0.15071
#> group0:main_sss3 0.10490
#> group1:main_sss3 -0.26867
#>
#> Transformed Coefficients:
#> Estimate
#> (Intercept) 6.98873
#> [group=1] -2.66526
#> [group=0]:amp1 0.10815
#> [group=1]:amp1 2.01088
#> [group=0]:amp2 0.38487
#> [group=1]:amp2 1.01079
#> [group=0]:amp3 0.50749
#> [group=1]:amp3 0.30806
#> [group=0]:acr1 1.50531
#> [group=1]:acr1 0.99363
#> [group=0]:acr2 1.51106
#> [group=1]:acr2 -1.43723
#> [group=0]:acr3 0.20821
#> [group=1]:acr3 -1.05959
#>
#> ***********************
#>
#> Dispersion Model
#>
#> Raw Formula:
#> ~group + group:disp_rrr1 + group:disp_sss1 + group:disp_rrr2 + group:disp_sss2
#>
#> Raw Coefficients:
#> Estimate
#> (Intercept) -0.01424
#> group1 -0.02611
#> group0:disp_rrr1 0.04612
#> group1:disp_rrr1 0.00104
#> group0:disp_sss1 -0.00441
#> group1:disp_sss1 0.00146
#> group0:disp_rrr2 -0.02472
#> group1:disp_rrr2 -0.01895
#> group0:disp_sss2 0.00583
#> group1:disp_sss2 -0.01138
#>
#> Transformed Coefficients:
#> Estimate
#> (Intercept) -0.01424
#> [group=1] -0.02611
#> [group=0]:amp1 0.04633
#> [group=1]:amp1 0.00179
#> [group=0]:amp2 0.02540
#> [group=1]:amp2 0.02210
#> [group=0]:acr1 -0.09542
#> [group=1]:acr1 0.95412
#> [group=0]:acr2 2.90983
#> [group=1]:acr2 -2.60079
#>
#> ***********************
#>
#> Zero-Inflation Model
#>
#> Raw Formula:
#> ~group + group:zi_rrr1 + group:zi_sss1 + group:zi_rrr2 + group:zi_sss2 + group:zi_rrr3 + group:zi_sss3
#>
#> Raw Coefficients:
#> Estimate
#> (Intercept) -22.59027
#> group1 -0.61931
#> group0:zi_rrr1 -0.01591
#> group1:zi_rrr1 0.00825
#> group0:zi_sss1 -0.00873
#> group1:zi_sss1 0.00246
#> group0:zi_rrr2 0.00527
#> group1:zi_rrr2 -0.00336
#> group0:zi_sss2 -0.04091
#> group1:zi_sss2 0.01627
#> group0:zi_rrr3 0.05463
#> group1:zi_rrr3 -0.02167
#> group0:zi_sss3 -0.01887
#> group1:zi_sss3 0.00771
#>
#> Transformed Coefficients:
#> Estimate
#> (Intercept) -22.59027
#> [group=1] -0.61931
#> [group=0]:amp1 0.01815
#> [group=1]:amp1 0.00861
#> [group=0]:amp2 0.04124
#> [group=1]:amp2 0.01661
#> [group=0]:amp3 0.05780
#> [group=1]:amp3 0.02300
#> [group=0]:acr1 -2.64002
#> [group=1]:acr1 0.29031
#> [group=0]:acr2 -1.44261
#> [group=1]:acr2 1.77424
#> [group=0]:acr3 -0.33261
#> [group=1]:acr3 2.79985
The output provides estimates for conditional model (default model),
the dispersion model, and also the zero-inflation model. By default,
dispformula = ~1
, and ziformula = ~0
which
means these additional models will not be generated in the output.
Note that in the example above, the value for the periods and the number of components in the dispersion and zero-inflation formulas were chosen arbitrarily and purely for demonstration.
summary(cglmm)
The summary()
method for cglmm
objects
provides a more detailed summary of the model and its parameter
estimates and uncertainty. It outputs the estimates, standard errors,
confidence intervals, and p-values for both the raw model
parameters and the transformed parameters. The summary statistics do not
represent a comparison between any groups for the cosinor components -
that is the role of the test_cosinor()
function.
Here is an example of how to use summary()
:
object <- cglmm(
Y ~ group + amp_acro(times,
period = 12,
group = "group"
),
data = testdata_simple,
family = poisson()
)
summary(object)
#>
#> Conditional Model
#> Raw model coefficients:
#> estimate standard.error lower.CI upper.CI p.value
#> (Intercept) 4.998454142 0.003463730 4.991665356 5.00524 < 2.22e-16
#> group1 -1.002150001 0.005937109 -1.013786521 -0.99051 < 2.22e-16
#> group0:main_rrr1 1.082281784 0.003347565 1.075720677 1.08884 < 2.22e-16
#> group1:main_rrr1 0.876651963 0.006198710 0.864502714 0.88880 < 2.22e-16
#> group0:main_sss1 1.682350718 0.003919418 1.674668800 1.69003 < 2.22e-16
#> group1:main_sss1 0.481951763 0.005936670 0.470316104 0.49359 < 2.22e-16
#>
#> (Intercept) ***
#> group1 ***
#> group0:main_rrr1 ***
#> group1:main_rrr1 ***
#> group0:main_sss1 ***
#> group1:main_sss1 ***
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#>
#> Transformed coefficients:
#> estimate standard.error lower.CI upper.CI p.value
#> (Intercept) 4.998454142 0.003463730 4.991665356 5.00524 < 2.22e-16 ***
#> [group=1] -1.002150001 0.005937109 -1.013786521 -0.99051 < 2.22e-16 ***
#> [group=0]:amp1 2.000409408 0.004275553 1.992029478 2.00879 < 2.22e-16 ***
#> [group=1]:amp1 1.000398004 0.006379631 0.987894156 1.01290 < 2.22e-16 ***
#> [group=0]:acr1 0.999134804 0.001439122 0.996314177 1.00196 < 2.22e-16 ***
#> [group=1]:acr1 0.502662067 0.005739524 0.491412807 0.51391 < 2.22e-16 ***
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
The summary statistics for dispersion and zero-inflation models will
also be provided by the summary()
function, if the original
cglmm
object being analyzed contains them. The following
demonstration uses the model specified in the Dispersion and
Zero-inflation model specification section of this
vignette:
summary(object_disp_zi)
#>
#> Conditional Model
#> Raw model coefficients:
#> estimate standard.error lower.CI upper.CI p.value
#> (Intercept) 6.988731155 0.031240924 6.927500069 7.04996 < 2.22e-16
#> group1 -2.665262752 0.043616663 -2.750749841 -2.57978 < 2.22e-16
#> group0:main_rrr1 0.007076922 0.043609826 -0.078396766 0.09255 0.87108682
#> group1:main_rrr1 1.097235914 0.042634719 1.013673400 1.18080 < 2.22e-16
#> group0:main_sss1 0.107916948 0.044741300 0.020225612 0.19561 0.01586437
#> group1:main_sss1 1.685148013 0.043446966 1.599993525 1.77030 < 2.22e-16
#> group0:main_rrr2 0.022976400 0.044035802 -0.063332185 0.10928 0.60183301
#> group1:main_rrr2 0.134603779 0.042990512 0.050343924 0.21886 0.00174205
#> group0:main_sss2 0.384178884 0.044292679 0.297366829 0.47099 < 2.22e-16
#> group1:main_sss2 -1.001784765 0.043076905 -1.086213946 -0.91736 < 2.22e-16
#> group0:main_rrr3 0.496526006 0.043852315 0.410577048 0.58247 < 2.22e-16
#> group1:main_rrr3 0.150709726 0.042902886 0.066621615 0.23480 0.00044339
#> group0:main_sss3 0.104903156 0.044586981 0.017514279 0.19229 0.01863388
#> group1:main_sss3 -0.268673714 0.043476602 -0.353886288 -0.18346 6.4211e-10
#>
#> (Intercept) ***
#> group1 ***
#> group0:main_rrr1
#> group1:main_rrr1 ***
#> group0:main_sss1 *
#> group1:main_sss1 ***
#> group0:main_rrr2
#> group1:main_rrr2 **
#> group0:main_sss2 ***
#> group1:main_sss2 ***
#> group0:main_rrr3 ***
#> group1:main_rrr3 ***
#> group0:main_sss3 *
#> group1:main_sss3 ***
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#>
#> Transformed coefficients:
#> estimate standard.error lower.CI upper.CI p.value
#> (Intercept) 6.98873115 0.03124092 6.92750007 7.04996 < 2.22e-16 ***
#> [group=1] -2.66526275 0.04361666 -2.75074984 -2.57978 < 2.22e-16 ***
#> [group=0]:amp1 0.10814874 0.04476646 0.02040810 0.19589 0.01569881 *
#> [group=1]:amp1 2.01088301 0.04307064 1.92646611 2.09530 < 2.22e-16 ***
#> [group=0]:amp2 0.38486534 0.04429235 0.29805393 0.47168 < 2.22e-16 ***
#> [group=1]:amp2 1.01078726 0.04306927 0.92637304 1.09520 < 2.22e-16 ***
#> [group=0]:amp3 0.50748670 0.04390550 0.42143351 0.59354 < 2.22e-16 ***
#> [group=1]:amp3 0.30805679 0.04331705 0.22315694 0.39296 1.1464e-12 ***
#> [group=0]:acr1 1.50531261 0.40300055 0.71544604 2.29518 0.00018752 ***
#> [group=1]:acr1 0.99363319 0.02139103 0.95170754 1.03556 < 2.22e-16 ***
#> [group=0]:acr2 1.51106097 0.11441958 1.28680270 1.73532 < 2.22e-16 ***
#> [group=1]:acr2 -1.43723230 0.04253927 -1.52060774 -1.35386 < 2.22e-16 ***
#> [group=0]:acr3 0.20821230 0.08775523 0.03621521 0.38021 0.01766107 *
#> [group=1]:acr3 -1.05959300 0.13979233 -1.33358093 -0.78561 3.4618e-14 ***
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#>
#> ***********************
#>
#> Dispersion Model
#> Raw model coefficients:
#> estimate standard.error lower.CI upper.CI p.value
#> (Intercept) -0.014239306 0.022379058 -0.058101453 0.02962 0.52460
#> group1 -0.026107503 0.031648988 -0.088138380 0.03592 0.40942
#> group0:disp_rrr1 0.046121979 0.031766123 -0.016138479 0.10838 0.14652
#> group1:disp_rrr1 0.001036835 0.031769911 -0.061231046 0.06330 0.97397
#> group0:disp_sss1 -0.004414136 0.031744495 -0.066632204 0.05780 0.88941
#> group1:disp_sss1 0.001462594 0.031740145 -0.060746946 0.06367 0.96325
#> group0:disp_rrr2 -0.024721973 0.032642991 -0.088701060 0.03926 0.44884
#> group1:disp_rrr2 -0.018949126 0.032075710 -0.081816361 0.04392 0.55468
#> group0:disp_sss2 0.005834423 0.030901442 -0.054731291 0.06640 0.85024
#> group1:disp_sss2 -0.011379341 0.031651043 -0.073414245 0.05066 0.71920
#>
#> Transformed coefficients:
#> estimate standard.error lower.CI upper.CI p.value
#> (Intercept) -0.014239306 0.022379058 -0.058101453 0.02962 0.524595
#> [group=1] -0.026107503 0.031648988 -0.088138380 0.03592 0.409424
#> [group=0]:amp1 0.046332727 0.031749283 -0.015894726 0.10856 0.144474
#> [group=1]:amp1 0.001792821 0.031862239 -0.060656019 0.06424 0.955128
#> [group=0]:amp2 0.025401111 0.032832800 -0.038949995 0.08975 0.439138
#> [group=1]:amp2 0.022103365 0.032812900 -0.042208737 0.08642 0.500554
#> [group=0]:acr1 -0.095415085 0.685505476 -1.438981129 1.24815 0.889300
#> [group=1]:acr1 0.954121278 17.652323187 -33.643796411 35.55204 0.956895
#> [group=0]:acr2 2.909831810 1.208596523 0.541026153 5.27864 0.016057 *
#> [group=1]:acr2 -2.600790419 1.397349835 -5.339545770 0.13796 0.062712 .
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#>
#> ***********************
#>
#> Zero-Inflation Model
#> Raw model coefficients:
#> estimate standard.error lower.CI upper.CI p.value
#> (Intercept) -2.259027e+01 2.548840e+03 -5.018225e+03 4973.044 0.99293
#> group1 -6.193084e-01 4.315689e+03 -8.459214e+03 8457.976 0.99989
#> group0:zi_rrr1 -1.591233e-02 3.629466e+03 -7.113639e+03 7113.607 1.00000
#> group1:zi_rrr1 8.249415e-03 4.927796e+03 -9.658294e+03 9658.310 1.00000
#> group0:zi_sss1 -8.725479e-03 3.733744e+03 -7.318012e+03 7317.995 1.00000
#> group1:zi_sss1 2.464537e-03 5.081551e+03 -9.959654e+03 9959.659 1.00000
#> group0:zi_rrr2 5.272462e-03 3.664849e+03 -7.182966e+03 7182.977 1.00000
#> group1:zi_rrr2 -3.356046e-03 4.985016e+03 -9.770456e+03 9770.449 1.00000
#> group0:zi_sss2 -4.090528e-02 3.691503e+03 -7.235254e+03 7235.173 0.99999
#> group1:zi_sss2 1.626770e-02 5.021448e+03 -9.841841e+03 9841.874 1.00000
#> group0:zi_rrr3 5.462952e-02 3.578003e+03 -7.012703e+03 7012.813 0.99999
#> group1:zi_rrr3 -2.166714e-02 4.881843e+03 -9.568259e+03 9568.216 1.00000
#> group0:zi_sss3 -1.887137e-02 3.640771e+03 -7.135798e+03 7135.761 1.00000
#> group1:zi_sss3 7.706902e-03 4.946009e+03 -9.693991e+03 9694.007 1.00000
#>
#> Transformed coefficients:
#> estimate standard.error lower.CI upper.CI p.value
#> (Intercept) -2.259027e+01 2.548840e+03 -5.018225e+03 4973.044 0.99293
#> [group=1] -6.193084e-01 4.315689e+03 -8.459214e+03 8457.976 0.99989
#> [group=0]:amp1 1.814762e-02 3.677903e+03 -7.208539e+03 7208.575 1.00000
#> [group=1]:amp1 8.609691e-03 4.958908e+03 -9.719273e+03 9719.291 1.00000
#> [group=0]:amp2 4.124368e-02 3.689313e+03 -7.230879e+03 7230.961 0.99999
#> [group=1]:amp2 1.661027e-02 5.014454e+03 -9.828132e+03 9828.165 1.00000
#> [group=0]:amp3 5.779717e-02 3.583251e+03 -7.022984e+03 7023.100 0.99999
#> [group=1]:amp3 2.299698e-02 4.889855e+03 -9.583918e+03 9583.964 1.00000
#> [group=0]:acr1 -2.640019e+00 2.031143e+05 -3.980993e+05 398094.013 0.99999
#> [group=1]:acr1 2.903123e-01 5.866869e+05 -1.149885e+06 1149885.537 1.00000
#> [group=0]:acr2 -1.442609e+00 8.891191e+04 -1.742656e+05 174262.694 0.99999
#> [group=1]:acr2 1.774243e+00 3.005401e+05 -5.890460e+05 589049.563 1.00000
#> [group=0]:acr3 -3.326091e-01 6.290285e+04 -1.232876e+05 123286.982 1.00000
#> [group=1]:acr3 2.799853e+00 2.147276e+05 -4.208556e+05 420861.246 0.99999
Note that this dataset was not simulated with consideration of dispersion or zero-inflation characteristics, hence the lack of significant P-values in the model summary for the dispersion and zero-inflation models.
cglmm
regression
models using DHARMa{DHARMa}
is an R package used to assess residual
diagnostics of regression models fit using {glmmTMB}
(which
is what is used by cglmm()
).
For example, we can apply the functions from DHARMa
on
the glmmTMB
model within by accessing it with
$fit
.