Upload
trinhkhanh
View
217
Download
0
Embed Size (px)
Citation preview
SAS vs. R
Competing Risk Analysis
Lovedeep Gondara
BC Cancer Agency
Introduction
To understand competing risk, lets just have
a quick look at survival analysis.
Survival Analysis is primarily used to estimate the probability of an event happening after a certain time frame in a time to event analysis and incorporates censoring.
3
Censoring
Time Study end
Patient 1: Event
Patient 4: Event after
Study’s end
Patient 3: Lost to follow-up
Patient 2: Event
Patient 5: No event even
after study’s end
4
Censoring
Patient Time
(days)
Event Censored
1 240 Y N
2 285 Y N
3 250 N Y
4 180 N Y
5 200 N Y
Time
Study end: 365 days
1
3
2
5
4
IntroductionWe generally display the information using following two methods.
Introduction
KM curve
IntroductionCompeting risks concern the situation where more than one cause
of failure is possible.
Introduction
What is Competing risk?Competing risks arise in the analysis of time-to-event data, i.e. when event of
Interest Is impossible to observe due to a different type of event occurring
before.
Eg:
If interest focuses on a specific cause of death, death from a non-disease
related cause would constitute the competing risk.
Example: Competing Risk
Starting condition
Event
(Competing Risk)
Event of Interest
Introduction
Why is it important?Main Assumption of KM –
Patients who are censored have the same survival probabilities as those who
continue to be followed, But it is violated in case of competing risk.
It is well known and pointed out that in presence of competing risks, the
standard product-limit method of describing the distribution of time-to
event yields biased results.
Example
Competing events censored vs. competing events included
Modeling Competing Risk
We will be focusing on model proposed by
Fine and Gray, which is most common and
widely used.
Fitting the model
R is widely used to fit competing risk model
because of available packages that makes the
job much easier such as ‘cmprsk’ which
provides options of plotting cumulative
incidence curves and fitting a multivariate
model.
Fitting the model
SAS does not provide any direct method of
implementing competing risk.
%CIF can be used to estimate cumulative
incidence.
PSHREG
Introducing %PSHREG written by
Maria Kohl
Georg Heinze Medical University of Vienna
With added options and functionality by me
PSHREG
Fits a multivariate Fine and Gray’s competing risk model.
Macro call –
%pshreg(data=mydata, time=time_variable, cens=status_variable, varlist=X1 X2 X3);
PSHREG
%pshreg(data=mydata, time=time_variable, cens=status_variable, varlist=X1 X2 X3);
Where
Data= Name of your SAS dataset.
PSHREG
%pshreg(data=mydata, time=time_variable, cens=status_variable, varlist=X1 X2 X3);
Where
Time = Time variable
PSHREG
%pshreg(data=mydata, time=time_variable, cens=status_variable, varlist=X1 X2 X3);
Where
Cens = Censoring variable with 0 for censored , 1 for event of interest and 2 for competing events.
PSHREG
%pshreg(data=mydata, time=time_variable, cens=status_variable, varlist=X1 X2 X3);
Where
Varlist= List of variables to be used
PSHREG
%pshreg(data=mydata, time=time_variable, cens=status_variable, failcode=1, cencode=2, varlist=X1 X2 X3);
If censoring variable not defined as
mentioned then specify –
Failcode= event of interest
Cencode= for censored observations
PSHREG
Additional options%pshreg(data=mydata, time=time_variable,
cens=status_variable, varlist=X1 X2 X3, options=%str());
Options = Any options for PROC PHREG
Eg: options = %str(rl )
PSHREG
Additional options
%pshreg(data=mydata, time=time_variable, cens=status_variable, varlist=X1 X2 X3, options=%str(), out=sas_data_set);
Out=User defined output dataset
PSHREG
Additional options
%pshreg(data=mydata, time=time_variable, cens=status_variable, varlist=X1 X2 X3, options=%str(), out=sas_data_set, by=);
By = To define subsets(Same as in PHREG)
PSHREG
Additional options
%pshreg(data=mydata, time=time_variable, cens=status_variable, varlist=X1 X2 X3, options=%str(), out=sas_data_set, by=, cuminc=1);
Cuminc=1 (Will display cumulative incidence curves for 1st variable in model) – default is 0 and code is output in log .
PSHREG
For cumulative incidence curve -
PSHREG
Similar to crr in ‘cmprsk’ package as it uses
an estimate of the survivor function to
reweight contributions to the risk sets for
failures from competing causes.
Example
Fitting a simple model using basic
parameters.
%pshreg_new(data=valung, time=time,
cens=status,varlist= Age kps duration, options=%str(rl) );
Example
%pshreg_new(data=valung, time=time, cens=status,varlist= Age kps duration, options=%str(rl) );
Example
Lets try doing same in R using ‘cmprsk’
We can not put all variables straight into the model, so lets bind them together first.
Example
Now call model statement using default parameters.
Example
Lets have a look at our results -
Example
?
Added Options
Class –
You can specify any class variables to be used in the model.
Ref –
Reference level can be specified for the class variable.
Example
%pshreg_new(data=valung, time=time, cens=status,varlist= Age kps duration prior, options=%str(rl), class=prior );
Example
Doing same in R
First recode the factor variable so we can use it in the model.
Or
Example
Then we can fit the model after binding the
new recoded variable in
Example
Wasn’t that hard, right?
But, what if my variable has more than two
levels –
Or
Example
Then we can try figuring out from output the
name of variables and reference level or keep
a sticky note on side to remember it all.
Example
Using backward elimination from options –
%pshreg_new(data=valung, time=time, cens=status,varlist= Age kps duration prior, options=%str(rl selection=backward), class=prior );
Example%pshreg_new(data=valung, time=time, cens=status,varlist= Age kps duration
prior, options=%str(rl selection=backward), class=prior );
Example
Can we do it in R ? Lets try
First look at the output –
Example
Remove the least significant variable
Bind the remaining variables again
Run your model using new variables
Keep on repeating until you get the desired results …
Added Options
HR –
Specify a variable to calculate hazard ratio for that specific variable, same as Hazard ratio statement in PHREG.
Unit –
You can specify a custom unit for hazard ratio such as by 0.1, 10 etc.
Added options
%pshreg_new(data=valung, time=time, cens=status,varlist= Age kps duration prior, options=%str(rl selection=backward), class=prior, hr=kps, unit=10 );
Added Options
Sc –
For plotting scaled Schoenfeld type residuals with 95% confidence limits(to check for time dependent effects)
Added Options%pshreg_new(data=valung, time=time, cens=status,varlist= Age kps
duration prior, options=%str(rl selection=backward), class=prior,sc=1 );
Added Options
Cumvar –
A variable can be specified for which you want cumulative incidence curve for.
Med(Experimental) –
Specify med=1 to get median survival time.
Added Options
%pshreg_new(data=valung, time=time, cens=status,varlist= Age kps duration prior, options=%str(rl selection=backward), class=prior, cuminc=1,cumvar=prior );
Added optionsInternal sort option was added in case of a by
variable as previously you needed to have the
data sorted on by variable if you are using ‘by’
option.
Why use PSHREG
Why should you use PSHREG in SAS ?
Summary
Ease of use
No need to use matrix functions to bind your
variables before using in model and then trying
to figure out from output what was their order.
Summary
Easily specify any Class variable and reference level to be used.
Compute and plot scaled Schoenfeld type residuals to check for time dependency.
Firth correction can be applied for monotone likelihood phenomenon.
Summary
The phenomenon of monotone likelihood is observed in the fitting
process of a Cox model if the likelihood converges to a finite value
while at least one parameter estimate diverges to ±∞.
Advantages
Use all options available in PHREG (Forward Selection, Backward Elimination etc.).
In case of time dependent effects, weighted estimation can be used.
Download
Original macro –
http://cemsiis.meduniwien.ac.at/kb/wf/software/statistische-software/pshreg/
References –
Jason P. Fine and Robert J. Gray (A Proportional Hazards Model for the Subdistribution
of a Competing Risk)Journal of the American Statistical AssociationVol. 94, No. 446 (Jun., 1999), pp. 496-509.
Maria Kohl and Georg Heinze (A SAS Macro for Proportional and NonproportionalSubdistribution Hazards Regression for Survival Analyses with Competing Risks)
Georg Heinze, Michael Schemper (A Solution to the Problem of Monotone Likelihood in Cox Regression)
Georg Heinze, Deniela Dunker (Monotone likelihood and time dependent covariates in Cox’s model)