[R] Epidemiology Tools

Thomas Lumley tlumley at u.washington.edu
Tue May 4 16:12:36 CEST 2004


On Mon, 3 May 2004, Francis Dimzon wrote:

> Hi all,
>
> Please help on this.  We will be teaching epidemiology using opensource
> software. What are R built-in functions or functions in available packages
> that are capable of doing these:
>
> a) Logistic regression   (glm?)

glm

> b) Conditional logistic regression

clogit (survival package)

> c) Logistic regression with random effects

It depends what you mean.  Random intercept models are in the glmmML
package, approximate maximum likelihood for more complicated models (PQL) is
available in MASS and nlme packages.  Doug Bates is making progress on
more accurate approximations, but I'm not sure where he's got to.

Personally, I teach marginal models (GEE estimates) before random
effects effects models to epidemiologists. GEE is in the gee and geepack
packages. (I realise this is a minority view, but it is based on
experience).

> d) Beta-binomial regression

Don't know. I'd use a logistic regression model with sandwich variances
(eg gee or glm with robcov from the Design package). I don't see any real
advantage of beta-binomial regression.

> e) Poisson regression
glm

> f) Weibull regression

survreg in the survival package

> g) Exponential regression

For censored data, survreg, for uncensored data, glm

> h) Cox proportional hazards regression
coxph in survival

> i) Cox regression with time repeated covariables
coxph in survival

> j) Kaplan-Meier Analysis and Plots

survfit and survdiff  (for left-truncated data you need to use coxph).

> k) Post-fit analysis with plots, delta-betas, hazard functions
Just about every  model has delta-betas. For the Cox model look at the
help page help(residuals.coxph).

Tests and graphical diagnostics for the proportional hazards assumption
are in cox.zph.  survfit() gives fitted survival curves

Hazard rate functions are estimated by the muhaz package.

> l) meta analysis

rmeta (which is also useful for Mantel-Haenszel-type analyses of
stratified 2x2 tables, and for drawing forest plots even outside
meta-analyses).

	-thomas




More information about the R-help mailing list