loopGEE: Loop through multiple generalized estimating equations (GEE)...

Description Usage Arguments Value Author(s) See Also Examples

Description

Loop through each combination of dependent and independent variables, running a generalized estimating equations model on each combination, and generate a dataframe of the results.

Usage

1
2
3
4
loopGEE(data, dependent, independent, id, covariates = NULL,
  interaction = NULL, corstr = "exchangeable", family = gaussian,
  conf.int = TRUE, conf.level = 0.95, na.rm = TRUE,
  filter.indep = FALSE, filter.interact = FALSE, adjust.p.value = FALSE)

Arguments

data

Dataset to run GEE on

dependent

The dependent (aka outcome or response) variables. Must be quoted and can have several.

independent

Like dependent, except the explanatory (aka predictor or exposure) variables.

id

The variable to cluster on for GEE, for instance the 'ID' variable for a person in a longitudinal cohort.

covariates

The covariate variables. Can be multiple covariates.

interaction

A single interaction variable.

corstr

a character string specifying the correlation structure. The following are permitted: '"independence"', '"exchangeable"', '"ar1"', '"unstructured"' and '"userdefined"'

family

See corresponding documentation to glm

conf.int

whether to include a confidence interval

conf.level

confidence level of the interval, used only if conf.int=TRUE

na.rm

Remove missing values from the dataset before running GEE. geeglm can't handle any missingness, so sometimes it's necessary to remove missingness.

filter.indep

Logical; Keep only the rows that have the independent variables.

filter.interact

Logical; Keep only the rows that have the interaction variable.

adjust.p.value

Logical; Adjust for multiple comparisons using the False Discovery Rate.

Value

A dataframe of all the GEE analyses, with estimates, confidence intervals, and p-values.

Author(s)

Luke W. Johnston

See Also

tidy

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
data(state)
ds <- data.frame(state.region, state.x77)
names(ds)
outcome <- c('Income', 'Murder')
exposure <- c('Population', 'Life.Exp', 'Illiteracy')
covar <- c('Area', 'Frost')
cid <- 'state.region'

loopGEE(ds, outcome, exposure, cid)
loopGEE(ds, outcome, exposure, cid, covariates = covar)
loopGEE(ds, outcome, exposure, cid, covariates = covar, interaction = 'HS.Grad')
loopGEE(ds, outcome, exposure, cid, covariates = covar, interaction = 'Area')
loopGEE(ds, outcome, exposure, cid, corstr = 'ar1', conf.level = 0.99)
loopGEE(ds, outcome, exposure, cid, corstr = 'ar1', conf.int = FALSE)
loopGEE(ds, outcome, exposure, cid, corstr = 'ar1', adjust.p.value = TRUE)
loopGEE(ds, outcome, exposure, cid, covariates = covar, adjust.p.value = TRUE)
loopGEE(ds, outcome, exposure, cid, covariates = covar, adjust.p.value = TRUE,
        filter.indep = TRUE)
loopGEE(ds, outcome, exposure, cid, interaction = 'Area', covariates = covar,
        adjust.p.value = TRUE, filter.interact = TRUE)

lwjohnst86/rstatsToolkit documentation built on May 21, 2019, 9:15 a.m.