The Application of Survival Analysis in Stata Cox

  • Slides: 30
Download presentation
The Application of Survival Analysis in Stata: Cox Regression, Proportional Hazard and Propensity Score

The Application of Survival Analysis in Stata: Cox Regression, Proportional Hazard and Propensity Score Match Yidan Huyan School of Public Health Texas A&M University 2020/07/20

Cox Regression and Proportional Hazard Assumptions • Sample dataset In a clinical trial of

Cox Regression and Proportional Hazard Assumptions • Sample dataset In a clinical trial of cancer medicine, 48 patients were randomly classified into treated (n=28) and placebo (n=20) groups. • Purpose Whether the tested medicine is affect to patients’ surveillances.

Cox Regression and Proportional Hazard Assumptions • webuse drugtr, clear /*open sample dataset*/ •

Cox Regression and Proportional Hazard Assumptions • webuse drugtr, clear /*open sample dataset*/ • stset, clear /*switch the data to raw data*/

Cox Regression and Proportional Hazard Assumptions • stset studytime, failure(died==1) /*set up end events*/

Cox Regression and Proportional Hazard Assumptions • stset studytime, failure(died==1) /*set up end events*/

Cox Regression and Proportional Hazard Assumptions • sts graph, by(drug) risktable

Cox Regression and Proportional Hazard Assumptions • sts graph, by(drug) risktable

Cox Regression and Proportional Hazard Assumptions • stcox var 1 var 2 var 3

Cox Regression and Proportional Hazard Assumptions • stcox var 1 var 2 var 3 … [if] [in] [, options] 1) You must stset your data before using stcox; 2) varlist may contain factor variables; 3) bootstrap, by, fp, jackknife, mfp, mi estimate, nestreg, statsby, stepwise, and svy are allowed; 4) vce(bootstrap) and vce(jackknife) are not allowed with the mi estimate prefix; 5) estimate, shared(), efron, exactm, exactp, tvc(), texp(), vce(), and noadjust are not allowed with the svy prefix; 6) fweights, iweights, and pweights may be specified using stset; 7) Weights are not supported with efron and exactp. Also weights may not be specified if you are using the bootstrap prefix with the stcox command. 8) coeflegend does not appear in the dialog box.

Cox Regression and Proportional Hazard Assumptions • stcox drug The coefficient of drug: The

Cox Regression and Proportional Hazard Assumptions • stcox drug The coefficient of drug: The risk of end event in the testing group is 13. 3% of the control group.

Cox Regression and Proportional Hazard Assumptions • stcox drug age After adjusted the age

Cox Regression and Proportional Hazard Assumptions • stcox drug age After adjusted the age of patient, the chances of the drug=1 group reach the end point is 10. 5% of the placebo group (drug=0); After controlling the treatment method of patient, with each additional year of age, the probability of endpoint events increased by 12%

Cox Regression and Proportional Hazard Assumptions • estat phtest You must stcox your data

Cox Regression and Proportional Hazard Assumptions • estat phtest You must stcox your data before using estat; • stphplot, by(var 1) adjust(var 2 var 3 …) Var 1: independent variable, var 2: control variable; No need to run after the stcox

Cox Regression and Proportional Hazard Assumptions • estat phtest p-value>chi 2, test meets PH

Cox Regression and Proportional Hazard Assumptions • estat phtest p-value>chi 2, test meets PH assumption

Cox Regression and Proportional Hazard Assumptions • stphplot, by(drug) adjust(age) Two lines are parallel

Cox Regression and Proportional Hazard Assumptions • stphplot, by(drug) adjust(age) Two lines are parallel to each other. No intersection point. The PH assumptions is not violated.

Propensity Score Match • teffects psmatch (y) (t x 1 x 2) same as

Propensity Score Match • teffects psmatch (y) (t x 1 x 2) same as • psmatch 2 t x 1 x 2, out(y) logit ate

Propensity Score Match • teffects psmatch (y) (t x 1 x 2, probit), atet

Propensity Score Match • teffects psmatch (y) (t x 1 x 2, probit), atet nn(#) caliper(#) This method takes into account the fact that propensity scores are estimated rather than known when calculating standard errors. § y: outcome variable § t: treatment variable § x 1, x 2, …: covariates § probit/logit: default setting is logit for PSM § atet/ate: atet (average treatment effect on the treated). Default setting is ate (average treatment effect) § nn(#): 1 on # nearest neighbor matching. Default setting is 1 on 1 § caliper(#): setting of caliper matching, e. g. caliper(0. 1)

Propensity Score Match • teffects psmatch (y) (t x 1 x 2, probit), atet

Propensity Score Match • teffects psmatch (y) (t x 1 x 2, probit), atet nn(#) caliper(#) When dependent variables are Nominal/Categorical Variables,there is no difference in Logit and Probit. When dependent variables are Ordinal Variables,using ordered probit model for regression.

Propensity Score Match • psmatch 2 t x 1 x 2 …, out(y) logit

Propensity Score Match • psmatch 2 t x 1 x 2 …, out(y) logit ties ate common odds pscore(varname) quietly This is not official codes. Have to be installed first: ssc install psmatch 2, replace § y: outcome variable § t: treatment variable § x 1, x 2, …: covariates § probit/logit: default setting is logit for PSM § ate: report ATE, ATU and ATET. Default setting is only report ATET. § common: only matching in common support. Default setting is matching all individuals. § odds: odds ratio, p/(1 -p). Default setting is using p-score. § pscore(varname): define the specific variables to use as p-score. Default setting is x 1 x 2 … § quietly: not progress report

Propensity Score Match • psmatch 2 t x 1 x 2 …, outcome(y) neighbor(k)

Propensity Score Match • psmatch 2 t x 1 x 2 …, outcome(y) neighbor(k) noreplacement § neighbor(k): k-nearest neighbor matching. Defaults k=1. § noreplacement: no replacement matching. Defaults matching with placement. Only used for 1 on 1 matching. • psmatch 2 t x 1 x 2 …, outcome(y) radius caliper(real) § radius: using caliper matching § caliper(real): define caliper ε , must be a positive real number

Propensity Score Match • pstest x 1 x 2 …, both graph Post-estimation commands

Propensity Score Match • pstest x 1 x 2 …, both graph Post-estimation commands of psmatch 2. To test the balance after matched data and to show the common support of p-score by drawing a plot. • pstest x 1 x 2 x 3, both graph This command shows whether the variable x 1 x 2 x 3 are balanced after matching. § both: show both the balance status before the matching and after the matching. Defaults only show after matching. § graph: using a plot to show the balance status before and after the matching of each variables.

Propensity Score Match • Sample dataset A subset of the experimental dataset used by

Propensity Score Match • Sample dataset A subset of the experimental dataset used by Lalonde (1986). The particular subset is the one constructed by Dehejia and Wahba (1999) and described there in more detail. • Purpose The possible effect of participation in a job training program on individuals’ earnings in 1978.

Propensity Score Match § use "~\ldw_exper. dta" the dataset could be download from https:

Propensity Score Match § use "~\ldw_exper. dta" the dataset could be download from https: //github. com/gvegayon/nnmatch 2/blob/master/ldw_exper. dta

Propensity Score Match § Variables Variable Description age of participants educ years of education

Propensity Score Match § Variables Variable Description age of participants educ years of education black race status – African American hisp race statsu -- hispanic married status nodegree more than grade school but less than high-school education re 74 earnings in 1974 (in thousands of 1978 $) re 75 earnings in 1975 (in thousands of 1978 $) u 74 unemployed in 1974 u 75 unemployed in 1975 re 78 earnings in 1978 t indictor for participating in the job training program

Propensity Score Match § reg re 78 t age educ black hisp married re

Propensity Score Match § reg re 78 t age educ black hisp married re 74 re 75 u 74 u 75, r Covariances Except the educ and black is significant, all the other variables are not significant.

Propensity Score Match § psmatch 2 t age educ black hisp married re 74

Propensity Score Match § psmatch 2 t age educ black hisp married re 74 re 75 u 74 u 75, outcome(re 78) n(1) ate ties logit common

Propensity Score Match § psmatch 2 t age educ black hisp married re 74

Propensity Score Match § psmatch 2 t age educ black hisp married re 74 re 75 u 74 u 75, outcome(re 78) n(1) ate ties logit common Results of logit regression ATT=1. 411, t-stat=1. 68 <1. 96 not significant

Propensity Score Match § pstest age educ black hisp married re 74 re 75

Propensity Score Match § pstest age educ black hisp married re 74 re 75 u 74 u 75, both graph After matching, most % bias of variables are smaller than 10%. Most matched variables have smaller std. than unmatched. Except re 75 and u 75, most results t *H 0: noof differ

Propensity Score Match § psgraph Most observed data are in the range of common

Propensity Score Match § psgraph Most observed data are in the range of common support. Thus, only a few data will lost during the PSM.

Propensity Score Match § psmatch 2 t age educ black hisp married re 74

Propensity Score Match § psmatch 2 t age educ black hisp married re 74 re 75 u 74 u 75, outcome(re 78) n(4) ate ties logit common quietly Matching results of 1: 4 is similar to 1: 1, the obvious different is the estimated ATET value.

Propensity Score Match § sum _pscore § dis 0. 25*r(sd) §. 01979237 0. 25*sigma_hat_pscore

Propensity Score Match § sum _pscore § dis 0. 25*r(sd) §. 01979237 0. 25*sigma_hat_pscore = 0. 02 To involve more data, the caliper is set as 0. 01.

Propensity Score Match § psmatch 2 t age educ black hisp married re 74

Propensity Score Match § psmatch 2 t age educ black hisp married re 74 re 75 u 74 u 75, outcome(re 78) n(4) cal(0. 01) ate ties logit common quietly the caliper matching is similar to the simple matching. It means most of the 1: 4 marching were happened in the range of caliper 0. 01.

Propensity Score Match • Results The average treatment effect of participating in job training

Propensity Score Match • Results The average treatment effect of participating in job training is positive, which is significant both in brokerage and statistically.

REFERENCES • https: //www. stata. com/manuals 13/ststcox. pdf • https: //github. com/gvegayon/nnmatch 2/blob/master/ld w_exper.

REFERENCES • https: //www. stata. com/manuals 13/ststcox. pdf • https: //github. com/gvegayon/nnmatch 2/blob/master/ld w_exper. dta