I am attempting to find a program that will let me conduct Cox regression on my matched case-control dataset.
Please assist.
p.s. I have STATA, SPSS, and MedCalc
I am attempting to find a program that will let me conduct Cox regression on my matched case-control dataset.
Please assist.
p.s. I have STATA, SPSS, and MedCalc
Half the battle with many questions is understanding the terminology. Matching implies within group (or within pair) correlation. Under appropriate circumstances matching can be dealt with paired t-tests, conditional logistic regression or mixed effects models.
In survival analysis (or time to event analysis), within group correlation is known as shared FRAILTY. Stata covers frailty pretty thoroughly.
An example of the use of Stata for Cox PH with frailty on the UCLA website from Hosmer & Lemeshow's book is here.
Here is a paper discussing the concept of shared frailty in twins.
An example is provided with Stata 11. See the 2nd last example here. I'll copy from the STATA SURVIVAL ANALYSIS AND EPIDEMIOLOGICAL TABLES REFERENCE MANUAL [ST] (pp141-142).
webuse catheter, clear
list in 1/10
+----------------------------------------------------------------+
| patient time infect age female _st _d _t _t0 |
|----------------------------------------------------------------|
1. | 1 16 1 28 0 1 1 16 0 |
2. | 1 8 1 28 0 1 1 8 0 |
3. | 2 13 0 48 1 1 0 13 0 |
4. | 2 23 1 48 1 1 1 23 0 |
5. | 3 22 1 32 0 1 1 22 0 |
|----------------------------------------------------------------|
6. | 3 28 1 32 0 1 1 28 0 |
7. | 4 318 1 31.5 1 1 1 318 0 |
8. | 4 447 1 31.5 1 1 1 447 0 |
9. | 5 30 1 10 0 1 1 30 0 |
10. | 5 12 1 10 0 1 1 12 0 |
+----------------------------------------------------------------+
"Consider the data from a study of 38 kidney dialysis patients, as described in McGilchrist and Aisbett (1991). The study is concerned with the prevalence of infection at the catheter insertion point. Two recurrence times (in days) are measured for each patient, and each recorded time is the time from initial insertion (onset of risk) to infection or censoring.
Each patient (patient) has two recurrence times (time) recorded, with each catheter insertion resulting in either infection (infect==1) or right-censoring (infect==0). Among the covariates measured are age and sex (female==1 if female, female==0 if male).
stset time, fail(infect)
stcox age female, shared(patient)
Cox regression --
Breslow method for ties Number of obs = 76
Gamma shared frailty Number of groups = 38
Group variable: patient
No. of subjects = 76 Obs per group: min = 2
No. of failures = 58 avg = 2
Time at risk = 7424 max = 2
Wald chi2(2) = 11.66
Log likelihood = -181.97453 Prob > chi2 = 0.0029
------------------------------------------------------------------------------
_t | Haz. Ratio Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
age | 1.006202 .0120965 0.51 0.607 .9827701 1.030192
female | .2068678 .095708 -3.41 0.001 .0835376 .5122756
-------------+----------------------------------------------------------------
theta | .4754497 .2673108
------------------------------------------------------------------------------
Likelihood-ratio test of theta=0: chibar2(01) = 6.27 Prob>=chibar2 = 0.006
Note: standard errors of hazard ratios are conditional on theta.
From the output, we obtain $\hat{\theta}$ = 0.475, and given the standard error of $\hat{\theta}$ and likelihood-ratio test of H0:$\theta$ = 0, we find a significant frailty effect, meaning that the correlation within patient cannot be ignored."
Me again. This is similar to a twin study - two measurements in the same unit (i.e. two from one patient or one from each twin) If we ignore frailty the estimates change, especially the sex effect:
stcox age female
Cox regression -- Breslow method for ties
No. of subjects = 76 Number of obs = 76
No. of failures = 58
Time at risk = 7424
LR chi2(2) = 6.67
Log likelihood = -185.10993 Prob > chi2 = 0.0355
------------------------------------------------------------------------------
_t | Haz. Ratio Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
age | 1.002245 .0091153 0.25 0.805 .9845377 1.020271
female | .4499194 .1340786 -2.68 0.007 .2508832 .8068592
------------------------------------------------------------------------------
Dummy variable model in response to Andy W's question (below):
gen pnum = patient - floor(_n/2)
list in 1/10
+-----------------------------------------------------------------------+
| patient time infect age female pnum _st _d _t _t0 |
|-----------------------------------------------------------------------|
1. | 1 16 1 28 0 1 1 1 16 0 |
2. | 1 8 1 28 0 0 1 1 8 0 |
3. | 2 13 0 48 1 1 1 0 13 0 |
4. | 2 23 1 48 1 0 1 1 23 0 |
5. | 3 22 1 32 0 1 1 1 22 0 |
|-----------------------------------------------------------------------|
6. | 3 28 1 32 0 0 1 1 28 0 |
7. | 4 318 1 31.5 1 1 1 1 318 0 |
8. | 4 447 1 31.5 1 0 1 1 447 0 |
9. | 5 30 1 10 0 1 1 1 30 0 |
10. | 5 12 1 10 0 0 1 1 12 0 |
+-----------------------------------------------------------------------+
stcox age female pnum
Cox regression -- Breslow method for ties
No. of subjects = 76 Number of obs = 76
No. of failures = 58
Time at risk = 7424
LR chi2(3) = 7.63
Log likelihood = -184.63204 Prob > chi2 = 0.0543
------------------------------------------------------------------------------
_t | Haz. Ratio Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
age | 1.001207 .0091269 0.13 0.895 .9834779 1.019257
female | .4259506 .1295227 -2.81 0.005 .2347073 .7730221
pnum | .7639054 .2111721 -0.97 0.330 .4443606 1.313238
------------------------------------------------------------------------------
The coefficients are different and the evidence of a sex effect has disappeared.
stcox
command was the correct approach.
$\endgroup$
If you are using Stata, you can just look at the stcox
command. Examples are available from Stata or UCLA website.
Also, take a look at Analysis of matched cohort data from the Stata Journal (2004 4(3)).
Under R, you can use the coxph()
function from the survival
library.