View source: R/core_functions.R
icc_counts | R Documentation |
Estimates the intraclass correlation coefficient (ICC) for count data
icc_counts(
data,
y,
id,
met = NULL,
type = c("rep", "con"),
fam = c("poisson", "nbinom1", "nbinom2", "zip", "zinb1", "zinb2"),
conf = 0.95
)
data |
A data frame containing at least two columns: outcome and subject identifier. In case of estimating the ICC for concordance setting, a third column with the method identifier will be needed. |
y |
Character string indicating the name of the outcome column in the dataset. |
id |
Character string indicating the name of the subjects column in the dataset. |
met |
Character string indicating the name of the methods column in the dataset. Only needed in the concordance setting. |
type |
Character string. It chooses the setting in which the ICC should be estimated. Valid values are: |
fam |
Character string. The within-subjects pdf to use. Valid options are: |
conf |
Confidence level for the confidence interval estimation. Default value is set to 95%. |
The intraclass correlation coefficient (ICC) is estimated using the variance components of a generalized linear mixed model (GLMM) (Carrasco, 2010).
The GLMM is estimated using the glmmTMB package (Brooks et al. 2017). The ICC standard error is estimated by applying the delta method (Ver Hoef, 2012) using the variance-covariance matrix of parameters involved in the ICC estimate.
The parameters involved in the estimation of the ICC depends on the within-subjects pdf family chosen: the between-subjects variance, the between-methods variability (in case of concordance analysis), and parameters implicated in the within-subjects family chosen. In all cases the output includes the overall expectation identified as mu; the between-subjects variance named as BSVar (log-scale); the between-methods variability (in case of concordance analysis) named as BMVar (log-scale).
In the Negative Binomial pdf with variance linearly increasing with the mean (Hardin and Hilbe, 2007),
Var(y_i)=\mu_i*(1+r)
and Negative Binomial pdf with variance quadratically increasing with the mean (Hardin and Hilbe, 2007)
Var(y_i)=\mu_i*(1+r*\mu_i)
the extra-dispersion parameter r is included in the output.
For zero-inflated models, the probability of observing an extra zero is included in the output as pi.
An object of class iccc.The output is a list with the following components:
model. An object of class glmmTMB. The estimated generalized linear mixed model.
ICC. Estimate of the ICC, its standard error and confidence interval.
varcomp. Variance components and parameters related to ICC expression.
Brooks, M. E., Kristensen, K., van Benthem, K. J., Magnusson, A., Berg, C. W., Nielsen, A., Skaug, H. J., Mächler, M. and Bolker, B. M. (2017). glmmTMB balances speed and flexibility among packages for zero-inflated generalized linear mixed modeling. The R Journal, 9(2), 378–400.
Carrasco, J. (2010). A Generalized Concordance Correlation Coefficient Based on the Variance Components Generalized Linear Mixed Models for Overdispersed Count Data. Biometrics, 66(3), 897-904.
W. Hardin and J. Hilbe. (2007). Generalized Linear Models and Extensions. Stata Press.
Ver Hoef, J.M. (2012) Who Invented the Delta Method?, The American Statistician, 66:2, 124-127,
# Poisson model. Repeatability setting.
iccpois<-icc_counts(Grimso,y="Tot",id="TransectID")
# Negative Binomial with proportional extra-dispersion. Concordance setting
iccnb2<-icc_counts(AF,y="y",id="id",met="met",type="con",fam="nbinom2")
# Zero-inflated Poisson model. Repeatability setting
icczip<-icc_counts(EPP,y="Social",id="id",fam="zip")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.