# Statistical Analysis in Epidemiology

## Documentation for package ‘Epi’ version 2.65

- DESCRIPTION file.
- User guides, package vignettes and other documentation.

## Help Pages

A B C D E F G H I L M N O P R S T U W X Y Z misc

Epi-package | Epi: Functions for manipulation and statistical analysis of epidemiological data

## -- A --

AaJ | The Aalen-Johansen estimator of state probabilities from a multistate 'Lexis' object.
AaJ.Lexis | The Aalen-Johansen estimator of state probabilities from a multistate 'Lexis' object.
absorbing | Time series and other methods for Lexis objects
addCov | Add covariates (typically clinical measurements) taken at known times to a Lexis object.
addCov.Lexis | Add covariates (typically clinical measurements) taken at known times to a Lexis object.
addDrug | Expand a Lexis object with information of drug exposure based on purchase dates and -amounts
addDrug.Lexis | Expand a Lexis object with information of drug exposure based on purchase dates and -amounts
adtte2Lexis | Create a Lexis Object Given an ADAM ADTTE Dataset.
after | Time series and other methods for Lexis objects
apc.fit | Fit an Age-Period-Cohort model to tabular data.
apc.frame | Produce an empty frame for display of parameter-estimates from Age-Period-Cohort-models.
apc.LCa | Fit Age-Period-Cohort models and Lee-Carter models with effects modeled by natural splines.
apc.lines | Plot APC-estimates in an APC-frame.
apc.plot | Plot the estimates from a fitted Age-Period-Cohort model
Aplot | Functions to plot rates from a table classified by age and calendar time (period)
as.Date.cal.yr | Functions to convert character, factor and various date objects into a number, and vice versa.

## -- B --

B.dk | Births in Denmark by year and month of birth and sex
bdendo | A case-control study of endometrial cancer
bdendo11 | A case-control study of endometrial cancer
before | Time series and other methods for Lexis objects
births | Births in a London Hospital
blcaIT | Bladder cancer mortality in Italian males
bootLexis | Create a bootstrap sample of persons (as identified by 'lex.id') from a Lexis object
boxarr | Draw boxes and arrows for illustration of multistate models.
boxes | Draw boxes and arrows for illustration of multistate models.
boxes.Lexis | Draw boxes and arrows for illustration of multistate models.
boxes.matrix | Draw boxes and arrows for illustration of multistate models.
boxes.MS | Draw boxes and arrows for illustration of multistate models.
BrCa | Clinical status, relapse, metastasis and death in 2982 women with breast cancer.
breaks | Extract time band data from a split Lexis object
brv | Bereavement in an elderly cohort

## -- C --

cal.yr | Functions to convert character, factor and various date objects into a number, and vice versa.
cbind.Lexis | Combining a Lexis objects with data frames or other Lexis objects
ccwc | Generate a nested case-control study
ci.Crisk | Compute cumulative risks and expected sojourn times from models for cause-specific rates.
ci.cum | Compute cumulative sum of estimates.
ci.eta | Linear predictor ('eta') from a formula, coefficients, vcov and a prediction frame.
ci.exp | Compute linear functions of parameters with standard errors and confidence limits, optionally transforming to a different scale.
ci.lin | Compute linear functions of parameters with standard errors and confidence limits, optionally transforming to a different scale.
ci.mat | Compute linear functions of parameters with standard errors and confidence limits, optionally transforming to a different scale.
ci.pd | Compute confidence limits for a difference of two independent proportions.
ci.pred | Compute linear functions of parameters with standard errors and confidence limits, optionally transforming to a different scale.
ci.ratio | Compute linear functions of parameters with standard errors and confidence limits, optionally transforming to a different scale.
ci.surv | Compute cumulative sum of estimates.
clear | Functions to manage and explore the workspace
clogistic | Conditional logistic regression
coarse.Lexis | Expand a Lexis object with information of drug exposure based on purchase dates and -amounts
contr.2nd | Contrast matrices
contr.cum | Contrast matrices
contr.diff | Contrast matrices
contr.orth | Contrast matrices
count | Special functions for use in stat.table
countLexis | Cut follow-up at a specified date for each person.
coxph.Lexis | Fit intensity models to follow-up data in Lexis objects
coxphLexis | Fit intensity models to follow-up data in Lexis objects
cp.lines | Plot period and cohort effects in an APC-frame.
cp.matlines | Plot period and cohort effects in an APC-frame.
cp.matpoints | Plot period and cohort effects in an APC-frame.
cp.matshade | Plot period and cohort effects in an APC-frame.
cp.points | Plot period and cohort effects in an APC-frame.
Cplot | Functions to plot rates from a table classified by age and calendar time (period)
crr.Lexis | Fit a competing risks regression model (Fine-Gray model) using a Lexis object)
cutLexis | Cut follow-up at a specified date for each person.

## -- D --

dbox | Draw boxes and arrows for illustration of multistate models.
decurve | Projection of a model matrix on the orthogonal complement of a trend or curvature.
detrend | Projection of a model matrix on the orthogonal complement of a trend or curvature.
diet | Diet and heart data
DMconv | Conversion to diabetes
DMepi | Epidemiological rates for diabetes in Denmark 1996-2015
DMlate | The Danish National Diabetes Register.
DMrand | The Danish National Diabetes Register.
dur | Time series and other methods for Lexis objects

## -- E --

effx | Function to calculate effects
effx.match | Function to calculate effects for individually matched case-control studies
entry | Time series and other methods for Lexis objects
Epi | Epi: Functions for manipulation and statistical analysis of epidemiological data
erl | Compute survival functions from rates and expected residual lifetime in an illness-death model as well as years of life lost to disease.
erl1 | Compute survival functions from rates and expected residual lifetime in an illness-death model as well as years of life lost to disease.
etm | Create a data structures suitable for use with packages 'mstate' or 'etm'.
etm.Lexis | Create a data structures suitable for use with packages 'mstate' or 'etm'.
ewrates | Rates of lung and nasal cancer mortality, and total mortality.
exit | Time series and other methods for Lexis objects
expand.data | Function to expand data for regression analysis of interval censored data.

## -- F --

factorize | Transform a Lexis (or stacked.Lexis) object
factorize.Lexis | Transform a Lexis (or stacked.Lexis) object
fgrep | Convenience versions of grep
fillarr | Draw boxes and arrows for illustration of multistate models.
fit.add | Fit an additive excess risk model to interval censored data.
fit.baseline | Fit a piecewise contsnt intesity model for interval censored data.
fit.mult | Fits a multiplicative relative risk model to interval censored data.
float | Calculate floated variances
ftrend | Fit a floating trend to a factor in generalized linear model

## -- G --

gam.Lexis | Fit intensity models to follow-up data in Lexis objects
gamLexis | Fit intensity models to follow-up data in Lexis objects
gen.exp | Generate covariates for drug-exposure follow-up from drug purchase records.
glm.Lexis | Fit intensity models to follow-up data in Lexis objects
glmLexis | Fit intensity models to follow-up data in Lexis objects
gmortDK | Population mortality rates for Denmark in 5-years age groups.

## -- H --

harm | Create a basis of harmonic functions.
hivDK | hivDK: seroconversion in a cohort of Danish men

## -- I --

Icens | Fits a regression model to interval censored data.
id.span | Is 'x' in the column span of matrix 'A' and what columns are linearly dependent?
idSpan | Is 'x' in the column span of matrix 'A' and what columns are linearly dependent?
in.span | Is 'x' in the column span of matrix 'A' and what columns are linearly dependent?
inSpan | Is 'x' in the column span of matrix 'A' and what columns are linearly dependent?

## -- L --

LCa.fit | Fit Lee-Carter-type models for rates to arbitrarily shaped observations of rates in a Lexis diagram.
legendbox | Draw a box with text explaining the numbers in and between boxes from 'boxes.MS' and 'boxes.Lexis'
lep | An unmatched case-control study of leprosy incidence
levels.Lexis | Transform a Lexis (or stacked.Lexis) object
Lexis | Create a Lexis object of follow-up
Lexis.diagram | Plot a Lexis diagram
Lexis.lines | Draw life lines in a Lexis diagram.
Lexis2msm | Convert a Lexis obejct to a data set suitable for input to the 'msm:msm' function.
LexisScarf | Generate a knitting pattern for a tube-shaped scarf with Lexis lines
lexVars | The time scales of a Lexis object
lgrep | Convenience versions of grep
Life.lines | Compute dates/ages for life lines in a Lexis diagram
lines.apc | Plot APC-estimates in an APC-frame.
lines.Lexis | Lexis diagrams
lines.pState | Simulate a Lexis object representing follow-up in a multistate model.
linesEst | Plot estimates with confidence limits (forest plot)
lls | Functions to manage and explore the workspace
lungDK | Male lung cancer incidence in Denmark

## -- M --

M.dk | Mortality in Denmark 1974 ff.
mat2pol | Plot columns of a matrix as stacked areas.
matshade | Plot confidence intervals as shaded areas around lines.
mcutLexis | Cut follow-up at multiple event dates and keep track of order of events
merge.Lexis | Merge a Lexis object with a data frame
mh | Mantel-Haenszel analyses of cohort and case-control studies
mortDK | Population mortality rates for Denmark in 1-year age-classes.
msdata | Create a data structures suitable for use with packages 'mstate' or 'etm'.
msdata.Lexis | Create a data structures suitable for use with packages 'mstate' or 'etm'.

## -- N --

N.dk | Population size in Denmark
N2Y | Create risk time ("Person-Years") in Lexis triangles from population count data.
NArray | Set up an array of NAs, solely from the list of dimnames
ncut | Function to group a variable in intervals.
ngrep | Convenience versions of grep
nice | Nice breakpoints for axes on plots
nickel | A Cohort of Nickel Smelters in South Wales
nid | Create a bootstrap sample of persons (as identified by 'lex.id') from a Lexis object
nid.Lexis | Create a bootstrap sample of persons (as identified by 'lex.id') from a Lexis object
Ns | Natural splines - (cubic splines linear beyond outermost knots) with convenient specification of knots and possibility of centering, detrending and clamping.
nState | Simulate a Lexis object representing follow-up in a multistate model.

## -- O --

occup | A small occupational cohort
order.Lexis | Transform a Lexis (or stacked.Lexis) object
orderLexis | Transform a Lexis (or stacked.Lexis) object
overlap | Check if records in a Lexis object represent overlapping epochs
overlap.Lexis | Check if records in a Lexis object represent overlapping epochs

## -- P --

paths | Generate paths traveled through a Lexis multistate model data frame.
paths.Lexis | Generate paths traveled through a Lexis multistate model data frame.
pc.lines | Plot period and cohort effects in an APC-frame.
pc.matlines | Plot period and cohort effects in an APC-frame.
pc.matpoints | Plot period and cohort effects in an APC-frame.
pc.matshade | Plot period and cohort effects in an APC-frame.
pc.points | Plot period and cohort effects in an APC-frame.
pctab | Create percentages in a table
percent | Special functions for use in stat.table
plot.apc | Plot the estimates from a fitted Age-Period-Cohort model
plot.LCa | Fit Lee-Carter-type models for rates to arbitrarily shaped observations of rates in a Lexis diagram.
plot.Lexis | Lexis diagrams
plot.pState | Simulate a Lexis object representing follow-up in a multistate model.
plotCIF | Plotting Aalen-Johansen curves for competing events
plotEst | Plot estimates with confidence limits (forest plot)
plotevent | Plot Equivalence Classes
points.Lexis | Lexis diagrams
pointsEst | Plot estimates with confidence limits (forest plot)
poisreg | Family Object for Poisson Regression
Pplot | Functions to plot rates from a table classified by age and calendar time (period)
pr | Diabetes prevance as of 2010-01-01 in Denmark
preceding | Time series and other methods for Lexis objects
predict.LCa | Fit Lee-Carter-type models for rates to arbitrarily shaped observations of rates in a Lexis diagram.
print.floated | Calculate floated variances
print.Icens | Fits a regression model to interval censored data.
print.LCa | Fit Lee-Carter-type models for rates to arbitrarily shaped observations of rates in a Lexis diagram.
print.Lexis | Create a Lexis object of follow-up
print.mh | Mantel-Haenszel analyses of cohort and case-control studies
print.stat.table | Tables of summary statistics
print.summary.Lexis | Summarize transitions and risk time from a Lexis object
projection.ip | Projection of columns of a matrix.
pState | Simulate a Lexis object representing follow-up in a multistate model.
PY.ann | Lexis diagrams
PY.ann.Lexis | Lexis diagrams

## -- R --

rateplot | Functions to plot rates from a table classified by age and calendar time (period)
ratio | Special functions for use in stat.table
rbind.Lexis | Combining a Lexis objects with data frames or other Lexis objects
rcutLexis | A function to cut follow-up at intermediate event times.
Relevel | Reorder and combine levels of a factor
Relevel.factor | Reorder and combine levels of a factor
Relevel.Lexis | Transform a Lexis (or stacked.Lexis) object
rm.tr | Remove transitions from a Lexis object.
ROC | Function to compute and draw ROC-curves.

## -- S --

S.typh | Salmonella Typhimurium outbreak 1996 in Denmark.
show.apc.LCa | Fit Age-Period-Cohort models and Lee-Carter models with effects modeled by natural splines.
simLexis | Simulate a Lexis object representing follow-up in a multistate model.
sortLexis | Transform a Lexis (or stacked.Lexis) object
splitLexis | Split follow-up time in a Lexis object
st2alb | Clinical trial: Steno2 baseline and follow-up.
st2clin | Clinical trial: Steno2 baseline and follow-up.
stack.Lexis | Functions to facilitate analysis of multistate models.
stackedCIF | Plotting Aalen-Johansen curves for competing events
stat.table | Tables of summary statistics
status | Time series and other methods for Lexis objects
steno2 | Clinical trial: Steno2 baseline and follow-up.
subset.Lexis | Subsetting Lexis (and stacked.Lexis) objects
subset.stacked.Lexis | Subsetting Lexis (and stacked.Lexis) objects
succeeding | Time series and other methods for Lexis objects
summary.Icens | Fits a regression model to interval censored data.
summary.LCa | Fit Lee-Carter-type models for rates to arbitrarily shaped observations of rates in a Lexis diagram.
summary.Lexis | Summarize transitions and risk time from a Lexis object
surv1 | Compute survival functions from rates and expected residual lifetime in an illness-death model as well as years of life lost to disease.
surv2 | Compute survival functions from rates and expected residual lifetime in an illness-death model as well as years of life lost to disease.

## -- T --

tbox | Draw boxes and arrows for illustration of multistate models.
Termplot | A wrapper for 'termplot' that optionally (but by default) exponentiates terms, and plot them on a common log-scale. Also scales x-axes to the same physical scale.
testisDK | Testis cancer incidence in Denmark, 1943-1996
thinCol | Is 'x' in the column span of matrix 'A' and what columns are linearly dependent?
thoro | Thorotrast Study
timeBand | Extract time band data from a split Lexis object
timeScales | The time scales of a Lexis object
timeSince | The time scales of a Lexis object
tmat | Functions to facilitate analysis of multistate models.
tmat.Lexis | Functions to facilitate analysis of multistate models.
transform.Lexis | Transform a Lexis (or stacked.Lexis) object
transform.stacked.Lexis | Transform a Lexis (or stacked.Lexis) object
transient | Time series and other methods for Lexis objects
tsNA20 | The time scales of a Lexis object
twoby2 | Analysis of a two by two table

## -- U --

unLexis | Remove Lexis attributes from a 'Lexis' object.

## -- W --

Wald | Compute linear functions of parameters with standard errors and confidence limits, optionally transforming to a different scale.

## -- X --

xcutLexis | Cut follow-up in a 'Lexis' object by event date(s) while preserving the original states.

## -- Y --

Y.dk | Population risk time in Denmark
yll | Compute survival functions from rates and expected residual lifetime in an illness-death model as well as years of life lost to disease.

## -- Z --

ZArray | Set up an array of NAs, solely from the list of dimnames

## -- misc --

[.Lexis | Subsetting Lexis (and stacked.Lexis) objects