knitr::opts_chunk$set( tidy = TRUE, collapse = TRUE, comment = "#>", fig.path = "README-" )
You can install the release version of multgee:
install.packages("multgee")
The source code for the release version of multgee is available on CRAN at:
Or you can install the development version of multgee:
# install.packages("devtools") devtools::install_github("AnestisTouloumis/multgee")
The source code for the development version of multgee is available on github at:
To use multgee, you should load the package as follows:
library("multgee")
This package provides a generalized estimating equations (GEE) solver for fitting marginal regression models with correlated nominal or ordinal multinomial responses based on a local odds ratios parameterization for the association structure [see @Touloumis2013].
There are two core functions to fit GEE models for correlated multinomial responses:
ordLORgee for an ordinal response scale. Options for the marginal model include cumulative link models or an adjacent categories logit model,nomLORgee for a nominal response scale. Currently, the only option is a marginal baseline category logit model.The main arguments in both functions are:
data),formula),id),repeated).The association structure among the correlated multinomial responses is expressed via marginalized local odds ratios [@Touloumis2013]. The estimating procedure for the local odds ratios can be summarized as follows: For each level pair of the repeated variable, the available responses are aggregated across clusters to form a square marginalized contingency table. Treating these tables as independent, an RC-G(1) type model is fitted in order to estimate the marginalized local odds ratios. The LORstr argument determines the form of the marginalized local odds ratios structure. Since the general RC-G(1) model is closely related to the family of association models, one can instead fit an association model to each of the marginalized contingency tables by setting LORem = "2way" in the core functions.
There are also five useful utility functions:
confint for obtaining Wald--type confidence intervals for the regression parameters using the standard errors of the sandwich (method = "robust") or of the model--based (method = "naive") covariance matrix. The default option is the sandwich covariance matrix (method = "robust"),waldts for assessing the goodness-of-fit of two nested GEE models based on a Wald test statistic,vcov for obtaining the sandwich (method = "robust") or model--based (method = "naive") covariance matrix of the regression parameters,intrinsic.pars for assessing whether the underlying association structure does not change dramatically across the level pairs of repeated,gee_criteria for reporting commonly used criteria to select variables and/or association structure for GEE models. The following R code replicates the GEE analysis presented in @Touloumis2013.
data("arthritis") intrinsic.pars(y, arthritis, id, time, rscale = "ordinal")
The intrinsic parameters do not differ much. This suggests that the uniform local odds ratios structure might be a good approximation for the association pattern.
fitord <- ordLORgee(formula = y ~ factor(time) + factor(trt) + factor(baseline), data = arthritis, id = id, repeated = time) summary(fitord)
The 95\% Wald confidence intervals for the regression parameters are
confint(fitord)
To illustrate model comparison, consider another model with age and sex as additional covariates:
fitord1 <- update(fitord, formula = . ~ . + age + factor(sex)) waldts(fitord, fitord1) gee_criteria(fitord, fitord1)
According to the Wald test, there is no evidence of no difference between the two models. The QICu criterion suggest that fitord should be preferred over fitord1.
The statistical methods implemented in multgee are described in @Touloumis2013. A detailed description of the functionality of multgee can be found in @Touloumis2015. Note that an updated version of this paper also serves as a vignette:
browseVignettes("multgee")
print(citation("multgee"), bibtex = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.