Learn R Programming

Multivariate Event Times (mets)

Implementation of various statistical models for multivariate event history data doi:10.1007/s10985-013-9244-x. Including multivariate cumulative incidence models doi:10.1002/sim.6016, and bivariate random effects probit models (Liability models) doi:10.1016/j.csda.2015.01.014. Modern methods for survival analysis, including regression modelling (Cox, Fine-Gray, Ghosh-Lin, Binomial regression) with fast computation of influence functions.

Installation

install.packages("mets")

The development version may be installed directly from github (requires Rtools on windows and development tools (+Xcode) for Mac OS X):

remotes::install_github("kkholst/mets", dependencies="Suggests")

or to get development version

remotes::install_github("kkholst/mets",ref="develop")

Citation

To cite the mets package please use one of the following references

Thomas H. Scheike and Klaus K. Holst and Jacob B. Hjelmborg (2013). Estimating heritability for cause specific mortality based on twin studies. Lifetime Data Analysis. http://dx.doi.org/10.1007/s10985-013-9244-x

Klaus K. Holst and Thomas H. Scheike Jacob B. Hjelmborg (2015). The Liability Threshold Model for Censored Twin Data. Computational Statistics and Data Analysis. http://dx.doi.org/10.1016/j.csda.2015.01.014

BibTeX:

@Article{,
  title={Estimating heritability for cause specific mortality based on twin studies},
  author={Scheike, Thomas H. and Holst, Klaus K. and Hjelmborg, Jacob B.},
  year={2013},
  issn={1380-7870},
  journal={Lifetime Data Analysis},
  doi={10.1007/s10985-013-9244-x},
  url={http://dx.doi.org/10.1007/s10985-013-9244-x},
  publisher={Springer US},
  keywords={Cause specific hazards; Competing risks; Delayed entry;
	    Left truncation; Heritability; Survival analysis},
  pages={1-24},
  language={English}
}

@Article{,
  title={The Liability Threshold Model for Censored Twin Data},
  author={Holst, Klaus K. and Scheike, Thomas H. and Hjelmborg, Jacob B.},
  year={2015},
  doi={10.1016/j.csda.2015.01.014},
  url={http://dx.doi.org/10.1016/j.csda.2015.01.014},
  journal={Computational Statistics and Data Analysis}
}

Examples

library("mets")

data(prt) ## Prostate data example (sim)

## Bivariate competing risk, concordance estimates
p33 <- bicomprisk(Event(time,status)~strata(zyg)+id(id),
                  data=prt, cause=c(2,2), return.data=1, prodlim=TRUE)
#> Strata 'DZ'
#> Strata 'MZ'

p33dz <- p33$model$"DZ"$comp.risk
p33mz <- p33$model$"MZ"$comp.risk

## Probability weights based on Aalen's additive model (same censoring within pair)
prtw <- ipw(Surv(time,status==0)~country+zyg, data=prt,
            obs.only=TRUE, same.cens=TRUE, 
            cluster="id", weight.name="w")

## Marginal model (wrongly ignoring censorings)
bpmz <- biprobit(cancer~1 + cluster(id), 
                 data=subset(prt,zyg=="MZ"), eqmarg=TRUE)

## Extended liability model
bpmzIPW <- biprobit(cancer~1 + cluster(id),
                    data=subset(prtw,zyg=="MZ"),
                    weights="w")
smz <- summary(bpmzIPW)

## Concordance
plot(p33mz,ylim=c(0,0.1),axes=FALSE, automar=FALSE,atrisk=FALSE,background=TRUE,background.fg="white")
axis(2); axis(1)

abline(h=smz$prob["Concordance",],lwd=c(2,1,1),col="darkblue")
## Wrong estimates:
abline(h=summary(bpmz)$prob["Concordance",],lwd=c(2,1,1),col="lightgray", lty=2)

Copy Link

Version

Install

install.packages('mets')

Monthly Downloads

10,832

Version

1.3.5

License

GPL (>= 2)

Maintainer

Klaus Holst

Last Published

January 11th, 2025

Functions in mets (1.3.5)

Grandom.cif

Additive Random effects model for competing risks data for polygenetic modelling
LinSpline

Simple linear spline
TRACE

The TRACE study group of myocardial infarction
basehazplot.phreg

Plotting the baslines of stratified Cox
bicomprisk

Estimation of concordance in bivariate competing risks data
blocksample

Block sampling
biprobit

Bivariate Probit model
binregG

G-estimator for binomial regression model (Standardized estimates)
WA_recurrent

While-Alive estimands for recurrent events
binregTSR

2 Stage Randomization for Survival Data or competing Risks Data
binregCasewise

Estimates the casewise concordance based on Concordance and marginal estimate using binreg
binregATE

Average Treatment effect for censored competing risks data using Binomial Regression
cluster.index

Finds subjects related to same cluster
cifreg

CIF regression
binreg

Binomial Regression for censored competing risks data
casewise

Estimates the casewise concordance based on Concordance and marginal estimate using prodlim but no testing
cor.cif

Cross-odds-ratio, OR or RR risk regression for competing risks
concordanceCor

Concordance Computes concordance and casewise concordance
calgb8923

CALGB 8923, twostage randomization SMART design
bptwin

Liability model for twin data
dcor

summary, tables, and correlations for data frames
casewise.test

Estimates the casewise concordance based on Concordance and marginal estimate using timereg and performs test for independence
cif

Cumulative incidence with robust standard errors
binomial.twostage

Fits Clayton-Oakes or bivariate Plackett (OR) models for binary data using marginals that are on logistic form. If clusters contain more than two times, the algoritm uses a compososite likelihood based on all pairwise bivariate models.
dermalridges

Dermal ridges data (families)
bmt

The Bone Marrow Transplant Data
dermalridgesMZ

Dermal ridges data (monozygotic twins)
drelevel

relev levels for data frames
dcut

Cutting, sorting, rm (removing), rename for data frames
dsort

Sort data frame
dtable

tables for data frames
dspline

Simple linear spline
count.history

Counts the number of previous events of two types for recurrent events processes
doubleFGR

Double CIF Fine-Gray model with two causes
dprint

list, head, print, tail
fast.pattern

Fast pattern
familycluster.index

Finds all pairs within a cluster (family)
covarianceRecurrent

Estimation of covariance for bivariate recurrent events with terminal event
eventpois

Extract survival estimates from lifetable analysis
fast.reshape

Fast reshape
familyclusterWithProbands.index

Finds all pairs within a cluster (famly) with the proband (case/control)
dlag

Lag operator
divide.conquer

Split a data set and run function
easy.binomial.twostage

Fits two-stage binomial for describing depdendence in binomial data using marginals that are on logistic form using the binomial.twostage funcion, but call is different and easier and the data manipulation is build into the function. Useful in particular for family design data.
dtransform

Transform that allows condition
divide.conquer.timereg

Split a data set and run function from timereg and aggregate
gof.phreg

GOF for Cox PH regression
gofM.phreg

GOF for Cox covariates in PH regression
diabetes

The Diabetic Retinopathy Data
haploX

haploX covariates and response for haplo survival discrete survival
fast.approx

Fast approximation
daggregate

aggregating for for data frames
gofG.phreg

Stratified baseline graphical GOF test for Cox covariates in PH regression
hfaction_cpx12

hfaction, subset of block randmized study HF-ACtion from WA package
dreg

Regression for data frames with dutility call
drcumhaz

Rate for leaving HPN program for patients of Copenhagen
hapfreqs

hapfreqs data set
dby

Calculate summary statistics grouped by
evalTerminal

Evaluates piece constant covariates at min(D,t) where D is a terminal event
lifetable.matrix

Life table
ghaplos

ghaplos haplo-types for subjects of haploX data
npc

For internal use
event.split

event.split (SurvSplit).
interval.logitsurv.discrete

Discrete time to event interval censored data
haplo.surv.discrete

Discrete time to event haplo type analysis
medweight

Computes mediation weights
ipw

Inverse Probability of Censoring Weights
gofZ.phreg

GOF for Cox covariates in PH regression
mediatorSurv

Mediation analysis in survival context
glm_IPTW

IPTW GLM, Inverse Probaibilty of Treatment Weighted GLM
ipw2

Inverse Probability of Censoring Weights
multcif

Multivariate Cumulative Incidence Function example data set
phreg

Fast Cox PH regression
logitSurv

Proportional odds survival model
np

np data set
migr

Migraine data
plack.cif

plack Computes concordance for or.cif based model, that is Plackett random effects model
lifecourse

Life-course plot
km

Kaplan-Meier with robust standard errors
pmvn

Multivariate normal distribution function
prt

Prostate data set
print.casewise

prints Concordance test
phregR

Fast Cox PH regression and calculations done in R to make play and adjustments easy
prob.exceed.recurrent

Estimation of probability of more that k events for recurrent events process
resmean.phreg

Restricted mean for stratified Kaplan-Meier or Cox model with martingale standard errors
mena

Menarche data set
melanoma

The Melanoma Survival Data
random.cif

Random effects model for competing risks data
recurrentMarginal

Fast recurrent marginal mean when death is possible
resmeanATE

Average Treatment effect for Restricted Mean for censored competing risks data using IPCW
reexports

Objects exported from other packages
resmeanIPCW

Restricted IPCW mean for censored survival data
simRecurrentTS

Simulation of recurrent events data based on cumulative hazards: Two-stage model
rpch

Piecewise constant hazard distribution
summary.cor

Summary for dependence models for competing risks
mlogit

Multinomial regression based on phreg regression
recreg

Recurrent events regression with terminal event
rcrisk

Simulation of Piecewise constant hazard models with two causes (Cox).
simClaytonOakes

Simulate from the Clayton-Oakes frailty model
simClaytonOakesWei

Simulate from the Clayton-Oakes frailty model
mets-package

mets: Analysis of Multivariate Event Times
simRecurrentII

Simulation of recurrent events data based on cumulative hazards II
ttpd

ttpd discrete survival data on interval form
simMultistate

Simulation of illness-death model
twin.clustertrunc

Estimation of twostage model with cluster truncation in bivariate situation
tetrachoric

Estimate parameters from odds-ratio
twinbmi

BMI data set
phreg_rct

Lu-Tsiatis More Efficient Log-Rank for Randomized studies with baseline covariates
predictRisk.phreg

Risk predictions to work with riskRegression package
sim.cox

Simulation of output from Cox model.
twinstut

Stutter data set
twostageMLE

Twostage survival model fitted by pseudo MLE
test.conc

Concordance test Compares two concordance estimates
survivalG

G-estimator for Cox and Fine-Gray model
phreg_IPTW

IPTW Cox, Inverse Probaibilty of Treatment Weighted Cox regression
predict.phreg

Predictions from proportional hazards model
simAalenFrailty

Simulate from the Aalen Frailty model
summaryGLM

Reporting OR (exp(coef)) from glm with binomial link and glm predictions
twinlm

Classic twin model for quantitative traits
twinsim

Simulate twin data
rchazC

Piecewise constant hazard distribution
sim.cif

Simulation of output from Cumulative incidence regression model
survival.twostage

Twostage survival model for multivariate survival data
rchaz

Simulation of Piecewise constant hazard model (Cox).
sim.cause.cox

Simulation of cause specific from Cox models.
mets.options

Set global options for mets
EVaddGam

Relative risk for additive gamma model
Dbvn

Derivatives of the bivariate normal cumulative distribution function
ACTG175

ACTG175, block randmized study from speff2trial package
FG_AugmentCifstrata

Augmentation for Fine-Gray model based on stratified NPMLE Cif (Aalen-Johansen)
BinAugmentCifstrata

Augmentation for Binomial regression based on stratified NPMLE Cif (Aalen-Johansen)
Event

Event history object
ClaytonOakes

Clayton-Oakes model with piece-wise constant hazards
Bootphreg

Wild bootstrap for Cox PH regression
Effbinreg

Efficient IPCW for binary data
back2timereg

Convert to timereg object
aalenMets

Fast additive hazards model with robust standard errors
base4cumhaz

rate of Mechanical (hole/defect) complication for catheter of HPN patients of Copenhagen
base1cumhaz

rate of CRBSI for HPN patients of Copenhagen
EventSplit

Event split with two time-scales, time and gaptime
base44cumhaz

rate of Occlusion/Thrombosis complication for catheter of HPN patients of Copenhagen
aalenfrailty

Aalen frailty model