*! version 1.4 09oct2018
help stcrmix

Title

stcrmix -- Estimation of Mixtures of Generalized Gamma Models for Competing Risks

Syntax

stcrmix [varlist] [if] [in],
[options]

where varlist includes covariates to be used in the estimation of the proportion of subjects that achieve each competing event.
This regression is carried out in the logit scale (i.e., log of the odds of event being the type one event).

Event types
*cr1(numlist) specifies the list of events that correspond to competing risk 1.

*cr2(numlist) specifies the list of events that correspond to competing risk 2.

*cru(numlist) specifies the list of codes identifying individuals for whom the event type was unobserved
(either event-free or event observed but the type is unkown).

Distributions
distribution(exponential) exponential distribution

distribution(weibull) Weibull distribution

distribution(lognormal) lognormal distribution

distribution(ggamma) generalized gamma distribution

Outcome variables
*failure(varname) specifies the variable containing the events.

*enter(varname) specifies the variable containing entry times which is zero for individuals observed from origin.

*time(varname) specifies the variable containing times at the end of follow up.

*uppertime(varname) specifies the variable containing the maximum possible time by when all are expected to develop one event or the other (e.g., 100 years if age is the time scale).

Predictors/Exposures
cr1loc(varlist) variables in location component of the distribution of times to competing risk 1.

cr1anc1(varlist) variables in scale component of the distribution of times to competing risk 1.

cr1anc2(varlist) variables in shape component of the distribution of times to competing risk 1.

cr2loc(varlist) variables in location component of the distribution of times to competing risk 2.

cr2anc1(varlist) variables in scale component of the distribution of times to competing risk 2.

cr2anc2(varlist) variables in shape component of the distribution of times to competing risk 2.

Weighting
wt(varlist) variable containing inverse probability weights.

* cr1 cr2 cru failure enter time uppertime are required.

Description

stcrmix fits competing risk models through mixtures of generalized gamma distributions,
using maximum likelihood, according to methods in Checkley, Brower and Munoz (2010).
This command allows for the specification of two competing risk events, along with a category for individuals
for whom the event type was unobserved. Moreover, an upper censoring time should be specified.
This is assumed to be the latest potential time at which an individual would be expected to develop one event or the other
which is content dependent but if unknown, user can select the times corresponding to when individuals will reach 125 years of age.
In terms of parameters, this model allows for seven components of parameters to be estimated,
including one for the proportion of subjects that achieve each competing risk,
and then three parameters for the distribution of times to each competing risk (location, scale and shape).

Options

Event types

cr1(numlist) is required and specifies the events that are associated with events due to the competing risk 1.

cr2(numlist) is required and specifies the events that are associated with events due to the competing risk 2.

cru(numlist) is required and specifies the codes identifying individuals for whom the event type was unobserved.

Distributions

This command allows for the specification of the type of distribution
that will be used in the mixtures.

ggamma is the most flexible distribution, where a location, scale,
and shape parameter will be estimated

weibull fixes the shape parameter to be 1, and estimates a location and
a scale parameter.

lognormal fixes the shape parameter to be 0, and estimates a location and
a scale parameter.

exponential fixes the shape and scale parameter to be equal to 1 and
estimates a location parameter.

Outcome variables

failure(varname) is required and specifies the variable that contains the events.

enter(varname) is required and specifies the variable that contains the entry time for each observation which will take the value zero for individuals observed from origin.

time(varname) is required and specifies the variable that contains times at the end of follow-up.

uppertime(varname) is required and specifies the variable that contains the maximum possible time when all are expected to develop one event or the other.

For a model estimation in which the maximum possible time is unknown,
you can set the varname for the uppertime
to when individuals will reach 125 years of age.

Predictors/Exposures

cr1loc(varlist) specifies the covariates listed in varlist whose
linear combination stipulates the regression for the location component for competing risk 1.

cr1anc1(varlist) specifies the covariates listed in varlist whose
linear combination stipulates the regression for the (log) scale component for competing risk 1.

cr1anc2(varlist) specifies the covariates listed in varlist whose
linear combination stipulates the regression for the shape component for competing risk 1.

cr2loc(varlist) specifies the covariates listed in varlist whose
linear combination stipulates the regression for the location component for competing risk 2.

cr2anc1(varlist) specifies the covariates listed in varlist whose
linear combination stipulates the regression for the (log) scale component for competing risk 2.

cr2anc2(varlist) specifies the covariates listed in varlist whose
linear combination stipulates the regression for the shape component for competing risk 2.

Weighting

wt(varlist) indicates the variable to be used for inverse probability weighting.

Examples

Note: this example comes from the paper by
Ng et al. (2017)

Setup

Data set from the CKID study contain the ready for use variables entry for enter, exit for time and event for failure

. use "https://statepi.jhsph.edu/ckid/racial_differences_dialysis_transplant_ckid.dta", clear

Generate an indicator variable for CKD onset after birth

. gen ageatCKDgt0= (ageatCKDonset >0)

Setup an upper bound: by 40 years after diagnosis of non-glomerular chronic kidney disease,
everyone will need either a dialysis or a kidney transplant

. gen upperexit=40

Anchor entry time at 2 years from onset and modify exit time appropriately

. drop if exit <= 2 /*exclude those whose exit is less than 2 years*/

. replace entry= entry - 2 /* moves the origin to 2 years */

. replace entry=0 if entry < 0 /* those entering the study before 2 years duration are seen from the new origin at 2 */

. replace exit= exit - 2

. replace upperexit= upperexit - 2 /*to anchor upperexit at 2 also */

Replace the upper censoring time by the actual time of event if the subject had an event

. replace upperexit= exit if event==1 | event==2

Set data as survival (not required for stcrmix) to explore time by when mostly all will have one event or the other

. stset exit, enter(entry) failure(event=1,2)

. streg , d(ggamma)

To obtain the 99.5th percentile from the fitted generalized gamma distribution

. gen Quantile99p5= exp([_t]_cons)*((e(kappa)^2)*invgammap(e(kappa)^(-2), (e(kappa)>0)*0.995+(e(kappa)<=0)*0.005))^(e(sigma)/e(kappa))

. display Quantile99p5 /*this justifies the use of 40 for uppertime */

Fit competing-risks model with a mixture of generalized gamma distributions. In this model, we allow the proportion
of events to vary by race and by whether CKD onset occured after birth, allow race to modify all location, scale and shape parameters,
and allow whether CKD onset occured after birth to modify the location of event 2.

. stcrmix b1nb0 ageatCKDgt0 , cr1(1) cr2(2) cru(0) distribution(ggamma) failure(event) enter(entry) time(exit) uppertime(upperexit) cr1loc(b1nb0) cr1anc1(b1nb0) cr1anc2(b1nb0) cr2loc(b1nb0 ageatCKDgt0) cr2anc1(b1nb0) cr2anc2(b1nb0)

Check a more parsimonious model, where we use an Weibull distribution allowing the two covariates to have similar effects.

. stcrmix b1nb0 ageatCKDgt0, cr1(1) cr2(2) cru(0) distribution(weibull) failure(event) enter(entry) time(exit) uppertime(upperexit) cr1loc(b1nb0) cr1anc1(b1nb0) cr2loc(b1nb0 ageatCKDgt0) cr2anc1(b1nb0)

Inverse probability weighting is one potential way to adjust for confounding or selection bias. This command allows for the inclusion of a variable with inverse probability weights. Here is an exmaple fitting competing-risks model with a mixture of generalized gamma distributions with stabilized inverse probability weighting.

. stcrmix b1nb0 , cr1(1) cr2(2) cru(0) distribution(ggamma) failure(event) enter(entry) time(exit) uppertime(upperexit) cr1loc(b1nb0) cr1anc1(b1nb0) cr1anc2(b1nb0) cr2loc(b1nb0) cr2anc1(b1nb0) cr2anc2(b1nb0)	wt(sipw)

Stored results

stcrmix stores the following in e():

Scalars

e(N) number of observations

e(k) number of parameters

e(k_eq) number of equations in e(b)

e(k_eq_model) number of equations in overall model test

e(k_dv) number of dependent variables

e(df_m) model degrees of freedom

e(ll) log likelihood

e(chi2) chi-squared

e(p) significance

e(rank) rank of e(V)

e(ic) number of iterations

e(rc) return code

e(converged) 1 if converged, 0 otherwise

Macros

e(cmd) stcrmix

e(chi2type) Wald; type of model chi-squared test

e(opt) type of optimization

e(vce) vcetype specified in vce()

e(which) max or min; whether optimizer is to perform
maximization or minimization

e(ml_method) type of ml method

e(user) name of likelihood-evaluator program

e(technique) maximization technique

e(properties) b V

e(predict) program used to implement predict

Matrices

e(b) coefficient vector

e(ilog) iteration log

e(gradient) gradient vector

e(V) variance-covariance matrix of the estimators

Functions

e(sample) marks estimation sample

Reference

Checkley W, Brower RG, Munoz A. Inference for mutually exclusive competing
events through a mixture of generalized gamma distributions.
Epidemiology. 2010 Jul; 21(4): 557-565.
Available at: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3227544/

Ng DK, Moxey-Mims M, Warady BA, Furth SL, Munoz A. Racial differences in renal
replacement therapy initiation among children with a non-glomerular cause of
chronic kidney disease.
Annals of Epidemiology. 2016 Nov; 26(11): 780-787.
Available at: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5110248/

Authors

Perry Kuo

MD, MPH

Johns Hopkins Bloomberg School of Public Health

perrykuo@jhu.edu

Usama Bilal

MD, MPH, PhD

Drexel Dornsife School of Public Health

ubilal@drexel.edu

Alvaro Munoz

PhD

Johns Hopkins Bloomberg School of Public Health

amunoz@jhu.edu