geeglm_small_samp: Fit Generalize Estimating Equations with Small Sample...

geeglm_small_sampR Documentation

Fit Generalize Estimating Equations with Small Sample Variance Estimators

Description

This function fits a GEE model using the geeglm function from the geepack-package. Additionally, small sample variance estimates are calculated using one of three methods proposed in the following papers: Pan (2001), Mancl and Derouen (2001), and Wang and Long (2011).

Usage

geeglm_small_samp(
  formula,
  family = poisson,
  data,
  id,
  corstr = "exchangeable",
  small.samp.method = NULL,
  sort = T,
  ...
)

Arguments

formula

A two-sided linear formula object with the response on the left of a ~ operator and the terms, separated by + operators, on the right.

family

The error distribution to be used in the model. Only guassian and poisson families are supported.

data

an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model and the id variable. If not found in data, the variables are taken from environment(formula), typically the environment from which glm is called.

id

a vector or data column name which identifies the clusters. The length of id should be the same as the number of observations. Data are assumed to be sorted so that observations on each cluster appear as contiguous rows in data. If data is not sorted this way, the function will not identify the clusters correctly. If sort=TRUE (default), the dataframe from the data argument is sorted by the id column to avoid this issue.

corstr

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

small.samp.method

a character string specifying the small sample method. The following are permitted: "pan" for the Pan (2001) method, "md" for the Mancl and Derouen (2001) method, and "wl" for the Wang and Long (2011) method. If small.samp.method is null, small sample variance estimates are not computed. The resulting object will be identical to the object created if geeglm from the geepack-package was used.

...

additional arguments passed on to geepack::geeglm.

Details

This function borrows heavily from the corresponding small sample variance estimating functions in the geesmv-package (GEE.var.pan, GEE.var.md and GEE.var.wl). In addition to combining these functions into a single function and using the geeglm function in model fitting, this function also varys from these functions in that it ensures that model offsets are properly accounted for in the calculation of small sample estimators.

Value

This function returns a geeglm object with small modifications:

small.samp.var

an additional item containing the small sample variance estimators is included in the fit object

geese$vbeta

The variance covariance matrix in the geese item from the object fit contains the small sample adjusted variance covaraince matrix.

Author(s)

Elizabeth Wynn, geesmv-authors for underlying code used in small sample size variance estimators.

References

Mancl LA, DeRouen TA (2001). "A covariance estimator for GEE with improved small-sample properties." Biometrics, 57(1), 126-134. ISSN 0006341X. doi:10. 1111/j.0006-341X.2001.00126.x.

Pan W (2001). "On the robust variance estimator in generalised estimating equations." Biometrika, 88(3), 901-906. ISSN 00063444. doi:10.1093/biomet/88.3.901.

Wang M, Long Q (2011). "Modified robust variance estimator for generalized estimating equations with improved small-sample performance." Statistics in Medicine, 30(11), 1278-1291. ISSN 02776715. doi:10.1002/sim.4150

See Also

geeglm, GEE.var.pan, GEE.var.md and GEE.var.wl

Examples

data("simdata")
sample_meta_data <- simdata$metadata

#Subset down to one observation (i.e. gene)
counts=simdata$counts[1,]

#Combine counts, metadata into dataframe
df=cbind(counts, sample_meta_data)

#Sort data by id (Function also does this if sort=T)
df=df[order(df$ids),]

#Fit the Model-use Pan method for small sample variance
fit.gee.pan<-geeglm_small_samp(formula =counts ~ group * time,
                              family=poisson, data=df, id=ids,
                              corstr="exchangeable",
                              small.samp.method="pan", sort=T)

ewynn610/corrRNASeq documentation built on Sept. 29, 2023, 10:37 a.m.