epi.eff {Epi}R Documentation

Function to calculate effects

Description

The function calculates the effects of an exposure on a response, possibly stratified by a stratifying variable, and/or controlled for one or more confounding variables.

Usage

epi.eff(response, type = "metric", exposure, strata = NULL, control = NULL, fup = NULL, data = NULL)

Arguments

response The response variable - must be numeric
type The type of responsetype - must be one of "metric", "binary", "failure", or "count"
exposure The exposure variable can be numeric or a factor
strata The strata stratifying variable - must be a factor
control The control variable(s) - must take the form data.frame(variable names)
fup The fup variable contains the follow-up time for a failure response
data data refers to the data frame used

Details

epi.eff(), without arguments, produces a list of arguments

Value

comp1 Effects of exposure
comp2 Tests of significance

Author(s)

Michael Hills, mhills@blueyonder.co.uk

Examples

data(births)
attach(births)
hyp<-factor(hyp,labels=c("normal","hyper"))
sex<-factor(sex,labels=c("male","female"))

# bweight is the birth weight of the baby in gms, and is a metric response (the default)

# effect of hypertension on birth weight
epi.eff(bweight,exposure=hyp) 
# effect of hypertension on birth weight stratified by sex
epi.eff(bweight,exposure=hyp,strata=sex) 
# effect of hypertension on birth weight controlled for sex
epi.eff(bweight,exposure=hyp,control=data.frame(sex)) 
# effect of gestation time on birth weight
epi.eff(bweight,exposure=gestwks) 
# effect of gestation time on birth weight stratified by sex
epi.eff(bweight,exposure=gestwks,strata=sex) 
# effect of gestation time on birth weight controlled for sex
epi.eff(bweight,exposure=gestwks,control=data.frame(sex)) 

# lowbw is a binary response coded 1 for low birth weight and 0 otherwise

# effect of hypertension on low birth weight
epi.eff(lowbw,type="binary",exposure=hyp)
# effect of hypertension on low birth weight stratified by sex
epi.eff(lowbw,type="binary",exposure=hyp,strata=sex)
# effect of hypertension on low birth weight controlled for sex
epi.eff(lowbw,type="binary",exposure=hyp,control=data.frame(sex))
# effect of gestation time on low birth weight
epi.eff(lowbw,type="binary",exposure=gestwks)
# effect of gestation time on low birth weight stratified by sex
epi.eff(lowbw,type="binary",exposure=gestwks,strata=sex)
# effect of gestation time on low birth weight controlled for sex
epi.eff(lowbw,type="binary",exposure=gestwks,control=data.frame(sex))

[Package Epi version 0.7.4 Index]