RegresindeCox
Javier Zamora
JavierZamora
UnidaddeBioestadsticaClnica.IRYCIS
Objetivosdelanlisisdesupervivencia
Estimareinterpretarlascurvasde
i i / i
supervivenciay/oriesgo.
Compararcurvasdesupervivencia,por
ejemplo,entredostratamientos,oentredos,
oms,gruposdepacientes.
Evaluarlarelacindelasupervivenciacon
Evaluar la relacin de la supervivencia con
otras,msdeuna,variablespronsticas.
1
19/11/2013
Compararcurvasdesupervivencia
esdistintalasupervivenciaentrehombresy
mujeres?
j ?
Supervivencia del paciente
1.00
0.75
0.50
0.25
0
0.00
Compararcurvas
Supervivencia del paciente
1.00
failure _d:
d: estpac == 1
0
Events Events
0.00
chi2(1) = 4.38
Pr>chi2 = 0.0365
Dos problemas:
Cuantificar la diferencia
Hombres y mujeres pueden ser distintos
respecto a otro factor
4
2
19/11/2013
Anlisismultivariante
Elanlisismultivariante (modelosderegresin)
permitesolucionarambosproblemas:
permite solucionar ambos problemas:
Cuantificaelefecto
Ajustaelefectoporotrasvariablesdeconfusin
Ensupervivencia(variabletiempoa)seusa,
sobretodo,elmodelodeCox
Alternativas:
Alternativas:
diseoexperimental
diseoestratificado
ndicedepropensin
5
Modelosderegresin
Otrosmodelosasumendistintasformasparala
funcin de supervivencia (Weibull exponencial
funcindesupervivencia(Weibull,exponencial,
gamma,...)planteandoelmodeloderegresinpara
losparmetrosdelasfunciones.
Peroelmspopular,porsusencillezyfacilidadpara
interpretarloscoeficientes,eseldenominado
modeloderiesgoproporcional
d l d i i l omodelodeCox
d l d C
3
19/11/2013
ModelodeCox
h(t, X ) = h0 (t )ea1X1+...+ak X k
h0(t): riesgo cuando todas las variables Xi son 0, o riesgo basal,
que es variable con el tiempo.
o, equivalentemente HR
h(t , X )
ln = a1X1 + ... + ak Xk
h 0(t)
Interpretacindei
i es el logaritmo del riesgo relativo cuando Xi aumenta una
unidad, mantenindose constantes las dems variables.
4
19/11/2013
ModelodeCox(stcox)
Ejemplo:efectodelsexodelreceptor
. stcox sexorec
2:
HR 1:
10
5
19/11/2013
Otrosfactores:tiempoendilisis(tpodial)
Efectoporcadamesendilisis(tpodial)
p
stcox tpodial
_t Haz. Ratio Std. Err. z P>|z| [95% Conf. Interval]
Culeselefectoporaoendilisis?
Efectoao=1.00576712 =1.071=>
7%incrementoderiesgoporao
. lincom 12*tpodial, eform
( 1) 12*tpodial = 0
11
Entendiendoloscoeficientes
Efectopormesendilisis(tpodial).Culeselefectoporaoendilisis?
_t
t H
Haz. R ti
Ratio Std Err.
Std. E z P | |
P>|z| [95% Conf.
C f Interval]
I t l]
stcox tpodial,nohr
h(t, X )
HR = = ea1X1+...+ak X k = e120.0057501 = 1.071 7%
h0 (t )
12
6
19/11/2013
Otrosfactores:necrosistubularaguda(nta)
Efectodesufrirlanecrosistubularaguda(NTASI==1;NO==2)
_t
t Haz Ratio
Haz. Std Err.
Std. Err z P>|z| [95% Conf.
Conf Interval]
Cambiandolareferenciasemejoralainterpretacin
stcox 1.nta
_t Haz. Ratio Std. Err. z P>|z| [95% Conf. Interval]
13
Variosfactoresderiesgojuntos
. stcox sexorec nta tpodial
14
7
19/11/2013
Estimacindeloscoeficientes
Loscoeficientesseestimanpormximaverosimilitud
Lospaquetesestadsticossuelenusarla
L t t d ti l l
aproximacindePeto(buenasiencadatiempodi<ni)
Loscoeficientesestimadossonasintticamente
normalesconvarianzasconocidas
EstimacindeloscoeficienteseIC95%
stcox 1.nta,nohr
_t Coef. Std. Err. z P>|z| [95% Conf. Interval]
H0: i = a ( a)
2
w = w 2
H1: i a i )
var(
Generalmente a = 0 ; (e0=1)
IC (1-)% i z / 2EE(
)
I ei z / 2EE( I )
16
8
19/11/2013
Bondaddeajuste.
Evaluacindelmodelocompleto
Contraste conellogaritmodelcocientede
verosimilitudes(LCV)olog.likelihood
i ilit d (LCV) l lik lih d ratio ti
. stcox tpodial sexorec nta, noshow nolog
17
Comparacinentremodelos(LCV)
Lapruebadellogaritmodelcocientede
i ilit d (LCV) d
verosimilitudes(LCV)puedeusarsepara
compararmodelos
Procedimiento:
Seajustanambosmodelos
Seguardanlasestimaciones
Se guardan las estimaciones
Secomparan
18
9
19/11/2013
Comparacinentremodelos(LCV)
Guardamosestimaciones(x2modelos):
Statistics Postestimation Manage
estimation results Store inmemory
(nombre1)
Secomparan
Statistics Postestimation Tests
Likelihoodratiotest
(nombre1 nombre2)
VctorAbraira 19
Almacenamosestimaciones
(estimates store)
20
10
19/11/2013
Comparamosestimaciones
(lrtest)
21
Ejemplo
. stcox tpodial sexorec nta, noshow nolog
22
11
19/11/2013
Ejemplo
. stcox sexorec nta if e(sample), noshow nolog
No. of
f subjects = 1292 Number of
f obs = 1292
No. of failures = 204
Time at risk = 92197.9
LR chi2(2) = 10.69
Log likelihood = -1304.6515 Prob > chi2 = 0.0048
23
Ejemplo
. lrtest ( modelo_3var) ( modelo_2var)
24
12
19/11/2013
Comparacinmodelos
Sepuedehacerconellogaritmodelcociente
deverosimilitudes(LCV),peroesmssencillo
d i ilit d (LCV) ill
usarlaopcion testparametersqueusael
testdeWald,noeldelLCV.
Ambostestsonasintticamenteequivalentes.
UnidaddeBioestadsticaClnica 25
Comparacindemodelos
(testparm)
. testparm tpodial
( 1) tpodial = 0
chi2( 1) = 5.75
Prob > chi2 = 0.0165 26
13
19/11/2013
SupervivenciaestimadaporCox
El modelo de Cox tambin se puede
poner como S(t ) = S0 (t )expp(b X +...+b X ) 1 1 k k
1.00
1
0.75
75
.7
Survival
0.50
.5
0.25
.25
0.00
0
27
SupervivenciaestimadaconCox
28
14
19/11/2013
Sesinprcticamodelos deCox(univar)
Archivocurso_supervivencia
ConstruirsendosmodelosdeCoxparaanalizar
elefectosobrelasupervivenciadelinjerto
Sexodelreceptor(sexorec)
Edaddelreceptor(edadr)
Necrosistubularaguda(nta)
Tiempoendilisis(tpodial)enaos
Grupodetratamiento(Gtrata)
UnidaddeBioestadsticaClnica 29
Variablesindicadoras(dummy)
ModelosderegresindeCox
15
19/11/2013
Ejemplo
Sequierecompararlasupervivenciaaunacierta
intervencinquirrgicaen3hospitales.
intervencin quirrgica en 3 hospitales
Sesigueencadahospitalaunamuestraaleatoriade
pacientesintervenidosyseobtienenlossiguientes
tiempos(enmeses):
Hosp
p A ((0):
) 1,, 3,, 7,, 8*,, 12,, 12,, 15*
Hosp B (1): 2, 2, 3, 8, 10, 10, 12*, 15
Hosp C (2): 1, 1, 3, 7, 10*, 12, 12, 14, 15*
31
Ejemplo
SepuedeanalizarconCox,
pero se estara asumiendo
peroseestaraasumiendo
multiplicatividad
Sicodificamos
HospitalA=0
HospitalB=1
HospitalC=2
El
ElHR
HR paraelHospital
para el Hospital C con
con
respectoalA eselcuadrado
delHR del B.Esrazonable
estaasuncin?
32
16
19/11/2013
Ejemplomortalidadhospitales
0 5 10 15
analysis time
hospital = A hospital = B
hospital = C
33
Ejemplomortalidadhospitales
No. of subjects = 24 Number of obs = 24
No. of failures = 19
Time at risk = 195
LR chi2(1) = 0 01
0.01
Log likelihood = -48.881504 Prob > chi2 = 0.9396
34
17
19/11/2013
Variablesdummy
Lasolucineslamismaqueenlosotrosmodelosde
regresin;creartantasvariablescomocategoras
regresin; crear tantas variables como categoras
menos1, denominadasvariablesindicadoras conel
siguienteesquema:
35
Variablesdummy
A B C
Hospital A 1 0 0
Hospital B 0 1 0
Hospital C 0 0 1
SidejamosfueralavariableAusamoscomoreferenciaeseHospital
h(t )
El modelo queda: ln = a B + a C ...
h0 (t ) 1 2
18
19/11/2013
Variablesdummy
A B C
Hospital A 1 0 0
Hospital B 0 1 0
Hospital C 0 0 1
h( t )
ln = a B + a C + ...
h0 (t ) 1 2
Hos A
Hos.
h(t ) h(t) = h0(t)
l
ln 0
h0 (t )
h(t ) e 1 HR Hos. B respecto al A
1
Hos. B ln
h0 (t )
e2 HR Hos. C respecto al A
37
Ejemplo
Analizarlosdatosdelejemplo conregresin
d C d i bl "d
deCox,usandovariables"dummy" "
38
19
19/11/2013
VariablesindicadorasenStata
39
Ejemploconvariablesindicadoras
No. of subjects = 24 Number of obs = 24
No. of failures = 19
Time at risk = 195
LR chi2(2) = 0.35
Log likelihood = -48.710913 Prob > chi2 = 0.8407
hospital
1 1.378235 .8103021 0.55 0.585 .4353903 4.362827
2 1.074779 .6304629 0.12 0.902 .3404132 3.393376
40
20
19/11/2013
Otroejemplo(hospitales_2.dta)
Datostambindemortalidadde3hospitales
Kaplan-Meier survival estimates
Log-rank test for equality of survivor functions
1.00
Events Events
hospital observed expected
0.75
A 8 12.26
B 12 4.55
0.50
C 9 12.19
Total 29 29.00
0.25
chi2(2) = 16.13
Pr>chi2 = 0.0003
0.00
0
0 5 10 15
analysis time
hospital = A hospital = B
hospital = C
41
AnalizadoconCox
Sine dummy
at s 5 5
LR chi2(1) = 0.05
Log likelihood = -101.72914 Prob > chi2 = 0.8284
Con dummy
Time at risk 525
LR chi2(2) = 11.36
Log likelihood = -96.074439 Prob > chi2 = 0.0034
hospital
1 4.239841 1.96597 3.12 0.002 1.708662 10.52066
2 1.119338 .5454527 0.23 0.817 .4306962 2.90905
( 1) 1.hospital = 0
( 2) 2.hospital = 0
chi2( 2) = 12.84 42
Prob > chi2 = 0.0016
21
19/11/2013
Cambiarlareferencia:
b#.hospital
LR chi2(2) = 11.36
Log likelihood = -96.074439 Prob > chi2 = 0.0034
_t
t Haz. Ratio Std. Err. z P>|z| [95% Conf. Interval]
hospital
1 4.239841 1.96597 3.12 0.002 1.708662 10.52066
2 1.119338 .5454527 0.23 0.817 .4306962 2.90905
HRconrespectoalnivelhospital=0(HospitalA)
SicambiamoslareferenciaalhospitalB
stcox b1.hospitalp
LR chi2(2) = 11.36
Log likelihood = -96.074439 Prob > chi2 = 0.0034
hospital
0 .2358579 .1093649 -3.12 0.002 .0950511 .5852531
2 .2640046 .1192954 -2.95 0.003 .1088881 .6400925
43
Prctica
Utilizandolosdatosdelacohortede
t l t renales:
transplantes l
Analizarelefectodeltratamientomediante
KaplanMeier ymedianteelmodelodeCox.
Valorarlaadecuacindeusarvariables
indicadoras.
44
22