Learn R Programming

⚠️There's a newer version (1.3.8) of this package.Take me there.

Multivariate Event Times (mets)

Implementation of various statistical models for multivariate event history data <10.1007/s10985-013-9244-x>. Including multivariate cumulative incidence models <10.1002/sim.6016>, and bivariate random effects probit models (Liability models) <10.1016/j.csda.2015.01.014>. Also contains two-stage binomial modelling that can do pairwise odds-ratio dependence modelling based marginal logistic regression models. This is an alternative to the alternating logistic regression approach (ALR).

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
prtw <- ipw(Surv(time,status==0)~country, data=prt,
            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"),
                    weight="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

27,833

Version

1.2.9

License

GPL (>= 2)

Maintainer

Klaus Holst

Last Published

September 6th, 2021

Functions in mets (1.2.9)

Dbvn

Derivatives of the bivariate normal cumulative distribution function
ClaytonOakes

Clayton-Oakes model with piece-wise constant hazards
Bootphreg

Wild bootstrap for Cox PH regression
BinAugmentCifstrata

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

Aalen frailty model
binreg

Binomial Regression for censored competing risks data
back2timereg

Convert to timereg object
binregATE

Average Treatment effect for censored competing risks data using Binomial Regression
FG_AugmentCifstrata

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

Relative risk for additive gamma model
binregCasewise

Estimates the casewise concordance based on Concordance and marginal estimate using binreg
Grandom.cif

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

Simple linear spline
bicomprisk

Estimation of concordance in bivariate competing risks data
blocksample

Block sampling
cif

Cumulative incidence with robust standard errors
dby

Calculate summary statistics grouped by
cifreg

CIF regression
biprobit

Bivariate Probit model
dcor

summary, tables, and correlations for data frames
cor.cif

Cross-odds-ratio, OR or RR risk regression for competing risks
count.history

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

Estimates the casewise concordance based on Concordance and marginal estimate using prodlim but no testing
dermalridgesMZ

Dermal ridges data (monozygotic twins)
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.
base1cumhaz

rate of CRBSI for HPN patients of Copenhagen
divide.conquer.timereg

Split a data set and run function from timereg and aggregate
bptwin

Liability model for twin data
ghaplos

ghaplos haplo-types for subjects of haploX data
divide.conquer

Split a data set and run function
dreg

Regression for data frames with dutility call
fast.reshape

Fast reshape
drcumhaz

Rate for leaving HPN program for patients of Copenhagen
cluster.index

Finds subjects related to same cluster
basehazplot.phreg

Plotting the baslines of stratified Cox
casewise.test

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

Estimation of covariance for bivariate recurrent events with terminal event
base4cumhaz

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

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

Inverse Probability of Censoring Weights
interval.logitsurv.discrete

Discrete time to event interval censored data
dspline

Simple linear spline
dtable

tables for data frames
dtransform

Transform that allows condition
dcut

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

Concordance Computes concordance and casewise concordance
dermalridges

Dermal ridges data (families)
doubleFGR

Double CIF Fine-Gray model with two causes
dprint

list, head, print, tail
gof.phreg

GOF for Cox PH regression
lifecourse

Life-course plot
dlag

Lag operator
easy.survival.twostage

Wrapper for easy fitting of Clayton-Oakes or bivariate Plackett models for bivariate survival data
eventpois

Extract survival estimates from lifetable analysis
recreg

Recurrent events regression with terminal event
np

np data set
multcif

Multivariate Cumulative Incidence Function example data set
random.cif

Random effects model for competing risks data
drelevel

relev levels for data frames
daggregate

aggregating for for data frames
ipw2

Inverse Probability of Censoring Weights
gofG.phreg

Stratified baseline graphical GOF test for Cox covariates in PH regression
familycluster.index

Finds all pairs within a cluster (family)
simClaytonOakesWei

Simulate from the Clayton-Oakes frailty model
predict.phreg

Predictions from proportional hazards model
survival.twostageCC

Twostage survival model for multivariate survival data
print.casewise

prints Concordance test
test.conc

Concordance test Compares two concordance estimates
fast.approx

Fast approximation
npc

For internal use
haploX

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

Fast pattern
dsort

Sort data frame
prob.exceed.recurrent

Estimation of probability of more that k events for recurrent events process
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.
km

Kaplan-Meier with robust standard errors
gofM.phreg

GOF for Cox covariates in PH regression
familyclusterWithProbands.index

Finds all pairs within a cluster (famly) with the proband (case/control)
mets.options

Set global options for mets
pmvn

Multivariate normal distribution function
plack.cif

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

Fast recurrent marginal mean when death is possible
phreg

Fast Cox PH regression
mets-package

Analysis of Multivariate Events
tetrachoric

Estimate parameters from odds-ratio
simMultistate

Simulation of illness-death model
ttpd

ttpd discrete survival data on interval form
rpch

Piecewise constant hazard distribution
hapfreqs

hapfreqs data set
phregR

Fast Cox PH regression and calculations done in R to make play and adjustments easy
haplo.surv.discrete

Discrete time to event haplo type analysis
logitSurv

Proportional odds survival model
simRecurrentII

Simulation of recurrent events data based on cumulative hazards II
mlogit

Multinomial regression based on phreg regression
migr

Migraine data
simRecurrent

Simulation of recurrent events data based on cumulative hazards
twostageMLE

Twostage survival model fitted by pseudo MLE
simRecurrentTS

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

Stutter data set
prt

Prostate data set
mena

Menarche data set
summary.cor

Summary for dependence models for competing risks
twin.clustertrunc

Estimation of twostage model with cluster truncation in bivariate situation
twinsim

Simulate twin data
twinlm

Classic twin model for quantitative traits
twinbmi

BMI data set
survival.iterative

Survival model for multivariate survival data
simAalenFrailty

Simulate from the Aalen Frailty model
lifetable.matrix

Life table
simClaytonOakes

Simulate from the Clayton-Oakes frailty model
survival.twostage

Twostage survival model for multivariate survival data
gofZ.phreg

GOF for Cox covariates in PH regression