The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Model specification

Oliver Jayasinghe and Rex Parsons

library(GLMMcosinor)
library(dplyr)

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.

Using cglmm()

The following examples use data simulated by the the simulate_cosinor function.

Specifying a single-component model with no grouping variable

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:

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\pi\) 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:

autoplot(object, superimpose.data = TRUE)

Specifying a single-component model with a grouping variable and a shared MESOR

Now, we can add a grouping variable by adding the name of the group in the amp_acro() function:

testdata_simple_gaussian <- simulate_cosinor(
  1000,
  n_period = 2,
  mesor = 5,
  amp = 2,
  acro = 1,
  beta.mesor = 4,
  beta.amp = 1,
  beta.acro = 0.5,
  family = "gaussian",
  period = c(12),
  n_components = 1,
  beta.group = TRUE
)
object <- cglmm(
  Y ~ amp_acro(times,
    period = 12,
    group = "group"
  ),
  data = testdata_simple_gaussian,
  family = gaussian
)
object
#> 
#>  Conditional Model 
#> 
#>  Raw formula: 
#> Y ~ group:main_rrr1 + group:main_sss1 
#> 
#>  Raw Coefficients: 
#>                  Estimate
#> (Intercept)       4.47411
#> group0:main_rrr1  1.03269
#> group1:main_rrr1  0.90209
#> group0:main_sss1  1.67745
#> group1:main_sss1  0.48497
#> 
#>  Transformed Coefficients: 
#>               Estimate
#> (Intercept)    4.47411
#> [group=0]:amp  1.96984
#> [group=1]:amp  1.02419
#> [group=0]:acr  1.01896
#> [group=1]:acr  0.49328

In the example above, the amplitude and phase are being estimated separately for the two groups but the intercept term is shared. This represents a shared estimate of the MESOR for both groups and is useful if two groups are known to have a common baseline (or equilibrium point). Hence, we would interpret the transformed coefficients as follows:

autoplot(object)

However, the groups in this dataset were simulated with two different MESORs, and so it would be more appropriate to specify an intercept term in the formula, as this will estimate the MESOR for both group = 0 and group = 1:

Specifying a single-component model with a grouping variable and an intercept (MESOR)

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:

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.

autoplot(object)

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

Specifying more complicated models using the amp_acro() function

The 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:

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.08271
#> 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.97625
#> [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:

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

Dispersion and zero-inflation model specification

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)       7.00727
#> group1           -2.59054
#> group0:main_rrr1  0.02756
#> group1:main_rrr1  1.05602
#> group0:main_sss1  0.03723
#> group1:main_sss1  1.67441
#> group0:main_rrr2  0.08269
#> group1:main_rrr2  0.07966
#> group0:main_sss2  0.32119
#> group1:main_sss2 -1.03860
#> group0:main_rrr3  0.48947
#> group1:main_rrr3  0.18786
#> group0:main_sss3  0.08698
#> group1:main_sss3 -0.34030
#> 
#>  Transformed Coefficients: 
#>                Estimate
#> (Intercept)     7.00727
#> [group=1]      -2.59054
#> [group=0]:amp1  0.04632
#> [group=1]:amp1  1.97960
#> [group=0]:amp2  0.33166
#> [group=1]:amp2  1.04165
#> [group=0]:amp3  0.49714
#> [group=1]:amp3  0.38871
#> [group=0]:acr1  0.93353
#> [group=1]:acr1  1.00812
#> [group=0]:acr2  1.31882
#> [group=1]:acr2 -1.49425
#> [group=0]:acr3  0.17587
#> [group=1]:acr3 -1.06638
#> 
#> ***********************
#> 
#>  Dispersion Model 
#> 
#>  Raw  Formula: 
#> ~group + group:disp_rrr1 + group:disp_sss1 + group:disp_rrr2 +      group:disp_sss2 
#> 
#>  Raw  Coefficients: 
#>                  Estimate
#> (Intercept)      -0.04246
#> group1            0.00794
#> group0:disp_rrr1  0.00064
#> group1:disp_rrr1  0.04120
#> group0:disp_sss1 -0.00175
#> group1:disp_sss1 -0.07287
#> group0:disp_rrr2 -0.05476
#> group1:disp_rrr2  0.03177
#> group0:disp_sss2  0.00499
#> group1:disp_sss2 -0.00519
#> 
#>  Transformed  Coefficients: 
#>                Estimate
#> (Intercept)    -0.04246
#> [group=1]       0.00794
#> [group=0]:amp1  0.00187
#> [group=1]:amp1  0.08371
#> [group=0]:amp2  0.05499
#> [group=1]:amp2  0.03219
#> [group=0]:acr1 -1.22090
#> [group=1]:acr1 -1.05617
#> [group=0]:acr2  3.05079
#> [group=1]:acr2 -0.16197
#> 
#> ***********************
#> 
#>  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.73609
#> group1          -0.12227
#> group0:zi_rrr1  -0.02761
#> group1:zi_rrr1  -0.02945
#> group0:zi_sss1  -0.01856
#> group1:zi_sss1  -0.01175
#> group0:zi_rrr2  -0.01670
#> group1:zi_rrr2  -0.02220
#> group0:zi_sss2   0.01896
#> group1:zi_sss2   0.01175
#> group0:zi_rrr3  -0.01725
#> group1:zi_rrr3  -0.01240
#> group0:zi_sss3  -0.01489
#> group1:zi_sss3  -0.01081
#> 
#>  Transformed  Coefficients: 
#>                 Estimate
#> (Intercept)    -22.73609
#> [group=1]       -0.12227
#> [group=0]:amp1   0.03327
#> [group=1]:amp1   0.03170
#> [group=0]:amp2   0.02526
#> [group=1]:amp2   0.02512
#> [group=0]:amp3   0.02279
#> [group=1]:amp3   0.01645
#> [group=0]:acr1  -2.54964
#> [group=1]:acr1  -2.76193
#> [group=0]:acr2   2.29290
#> [group=1]:acr2   2.65485
#> [group=0]:acr3  -2.42941
#> [group=1]:acr3  -2.42448

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.

Using 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)       7.0072674345   0.0304439347  6.9475984191  7.06694 < 2.22e-16
#> group1           -2.5905444295   0.0432852080 -2.6753818783 -2.50571 < 2.22e-16
#> group0:main_rrr1  0.0275582847   0.0416583843 -0.0540906483  0.10921   0.508272
#> group1:main_rrr1  1.0560184938   0.0441243920  0.9695362748  1.14250 < 2.22e-16
#> group0:main_sss1  0.0372258416   0.0441390484 -0.0492851036  0.12374   0.399018
#> group1:main_sss1  1.6744104542   0.0427826124  1.5905580748  1.75826 < 2.22e-16
#> group0:main_rrr2  0.0826892325   0.0426586231 -0.0009201324  0.16630   0.052575
#> group1:main_rrr2  0.0796598300   0.0429283556 -0.0044782008  0.16380   0.063504
#> group0:main_sss2  0.3211853192   0.0434896642  0.2359471437  0.40642 1.5208e-13
#> group1:main_sss2 -1.0385982201   0.0437746745 -1.1243950056 -0.95280 < 2.22e-16
#> group0:main_rrr3  0.4894710131   0.0431346228  0.4049287059  0.57401 < 2.22e-16
#> group1:main_rrr3  0.1878623401   0.0434224473  0.1027559074  0.27297 1.5157e-05
#> group0:main_sss3  0.0869801338   0.0429676620  0.0027650638  0.17120   0.042938
#> group1:main_sss3 -0.3402950395   0.0434387762 -0.4254334764 -0.25516 4.7296e-15
#>                     
#> (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)     7.00726744     0.03044393  6.94759842  7.06694 < 2.22e-16 ***
#> [group=1]      -2.59054443     0.04328521 -2.67538188 -2.50571 < 2.22e-16 ***
#> [group=0]:amp1  0.04631655     0.04318681 -0.03832805  0.13096   0.283509    
#> [group=1]:amp1  1.97960234     0.04273992  1.89583364  2.06337 < 2.22e-16 ***
#> [group=0]:amp2  0.33165874     0.04375864  0.24589338  0.41742 3.4749e-14 ***
#> [group=1]:amp2  1.04164867     0.04367711  0.95604312  1.12725 < 2.22e-16 ***
#> [group=0]:amp3  0.49713923     0.04298482  0.41289053  0.58139 < 2.22e-16 ***
#> [group=1]:amp3  0.38870679     0.04387439  0.30271456  0.47470 < 2.22e-16 ***
#> [group=0]:acr1  0.93353228     0.92072420 -0.87105399  2.73812   0.310625    
#> [group=1]:acr1  1.00812238     0.02231041  0.96439478  1.05185 < 2.22e-16 ***
#> [group=0]:acr2  1.31881807     0.12779000  1.06835428  1.56928 < 2.22e-16 ***
#> [group=1]:acr2 -1.49424683     0.04130723 -1.57520751 -1.41329 < 2.22e-16 ***
#> [group=0]:acr3  0.17586648     0.08673128  0.00587629  0.34586   0.042589 *  
#> [group=1]:acr3 -1.06637503     0.11057756 -1.28310307 -0.84965 < 2.22e-16 ***
#> ---
#> 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.0424588507   0.0223681343 -0.0862995883  0.00138 0.057672 .
#> group1            0.0079365875   0.0316337422 -0.0540644078  0.06994 0.801899  
#> group0:disp_rrr1  0.0006402729   0.0317752519 -0.0616380764  0.06292 0.983924  
#> group1:disp_rrr1  0.0412040639   0.0317994013 -0.0211216175  0.10353 0.195062  
#> group0:disp_sss1 -0.0017546224   0.0316649792 -0.0638168413  0.06031 0.955810  
#> group1:disp_sss1 -0.0728690786   0.0318664306 -0.1353261349 -0.01041 0.022213 *
#> group0:disp_rrr2 -0.0547613512   0.0312852024 -0.1160792212  0.00656 0.080051 .
#> group1:disp_rrr2  0.0317694259   0.0314949312 -0.0299595048  0.09350 0.313111  
#> group0:disp_sss2  0.0049859540   0.0322946458 -0.0583103885  0.06828 0.877303  
#> group1:disp_sss2 -0.0051913162   0.0321902540 -0.0682830548  0.05790 0.871881  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Transformed coefficients:
#>                     estimate standard.error      lower.CI upper.CI    p.value
#> (Intercept)     -0.042458851    0.022368134  -0.086299588  0.00138  0.0576718
#> [group=1]        0.007936588    0.031633742  -0.054064408  0.06994  0.8018992
#> [group=0]:amp1   0.001867793    0.031771992  -0.060404168  0.06414  0.9531215
#> [group=1]:amp1   0.083711872    0.031951063   0.021088940  0.14633  0.0087929
#> [group=0]:amp2   0.054987865    0.031271144  -0.006302451  0.11628  0.0786757
#> [group=1]:amp2   0.032190778    0.031669302  -0.029879912  0.09426  0.3094074
#> [group=0]:acr1  -1.220904085   16.954907077 -34.451911316 32.01010  0.9425948
#> [group=1]:acr1  -1.056166211    0.378851458  -1.798701424 -0.31363  0.0053066
#> [group=0]:acr2   3.050794227    0.587552520   1.899212449  4.20238 2.0763e-07
#> [group=1]:acr2  -0.161974513    0.994655080  -2.111462646  1.78751  0.8706406
#>                   
#> (Intercept)    .  
#> [group=1]         
#> [group=0]:amp1    
#> [group=1]:amp1 ** 
#> [group=0]:amp2 .  
#> [group=1]:amp2    
#> [group=0]:acr1    
#> [group=1]:acr1 ** 
#> [group=0]:acr2 ***
#> [group=1]:acr2    
#> ---
#> 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.273609e+01   2.754634e+03 -5.421719e+03 5376.247 0.99341
#> group1         -1.222703e-01   4.020894e+03 -7.880929e+03 7880.685 0.99998
#> group0:zi_rrr1 -2.761050e-02   3.916428e+03 -7.676085e+03 7676.029 0.99999
#> group1:zi_rrr1 -2.944578e-02   4.161874e+03 -8.157153e+03 8157.094 0.99999
#> group0:zi_sss1 -1.856496e-02   4.003992e+03 -7.847699e+03 7847.662 1.00000
#> group1:zi_sss1 -1.174938e-02   4.256061e+03 -8.341738e+03 8341.715 1.00000
#> group0:zi_rrr2 -1.669803e-02   3.972574e+03 -7.786118e+03 7786.085 1.00000
#> group1:zi_rrr2 -2.220441e-02   4.221661e+03 -8.274326e+03 8274.281 1.00000
#> group0:zi_sss2  1.895789e-02   3.950308e+03 -7.742443e+03 7742.481 1.00000
#> group1:zi_sss2  1.175075e-02   4.198954e+03 -8.229786e+03 8229.810 1.00000
#> group0:zi_rrr3 -1.724934e-02   3.875391e+03 -7.595644e+03 7595.610 1.00000
#> group1:zi_rrr3 -1.239694e-02   4.119606e+03 -8.074293e+03 8074.268 1.00000
#> group0:zi_sss3 -1.489192e-02   3.898267e+03 -7.640478e+03 7640.448 1.00000
#> group1:zi_sss3 -1.080982e-02   4.142766e+03 -8.119682e+03 8119.660 1.00000
#> 
#> Transformed coefficients:
#>                     estimate standard.error      lower.CI   upper.CI p.value
#> (Intercept)    -2.273609e+01   2.754634e+03 -5.421719e+03   5376.247 0.99341
#> [group=1]      -1.222703e-01   4.020894e+03 -7.880929e+03   7880.685 0.99998
#> [group=0]:amp1  3.327157e-02   3.954060e+03 -7.749783e+03   7749.849 0.99999
#> [group=1]:amp1  3.170335e-02   4.183415e+03 -8.199310e+03   8199.374 0.99999
#> [group=0]:amp2  2.526313e-02   4.002157e+03 -7.844059e+03   7844.109 0.99999
#> [group=1]:amp2  2.512202e-02   4.253870e+03 -8.337407e+03   8337.457 1.00000
#> [group=0]:amp3  2.278835e-02   3.859249e+03 -7.563966e+03   7564.012 1.00000
#> [group=1]:amp3  1.644799e-02   4.102235e+03 -8.040217e+03   8040.250 1.00000
#> [group=0]:acr1 -2.549640e+00   1.192259e+05 -2.336810e+05 233675.914 0.99998
#> [group=1]:acr1 -2.761934e+00   1.335787e+05 -2.618121e+05 261806.589 0.99998
#> [group=0]:acr2  2.292900e+00   1.551800e+05 -3.041450e+05 304149.555 0.99999
#> [group=1]:acr2  2.654853e+00   1.658433e+05 -3.250443e+05 325049.644 0.99999
#> [group=0]:acr3 -2.429409e+00   1.717653e+05 -3.366562e+05 336651.354 0.99999
#> [group=1]:acr3 -2.424479e+00   2.529165e+05 -4.957096e+05 495704.797 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.

Assessing residual diagnostics of 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.

library(DHARMa)
#> This is DHARMa 0.4.7. For overview type '?DHARMa'. For recent changes, type news(package = 'DHARMa')
plotResiduals(simulateResiduals(object$fit))

plotQQunif(simulateResiduals(object$fit))

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.