1
$\begingroup$

I have a dataframe with a number of covariates or different types (binary, numeric, factors) and 2 competing outcomes. The presence of one outcome would preclude the occurrence of the other outcome. The dataframe is organised thus:

ID    covar1 covar2 covar3   covar4  time  status
1       45     0     male     321    573   1
2       64     1     female   64     622   2
3       23     1     male     122    1023  1
4       87     0     male     201    457   2
5       56     0     female   35     223   2
6       65     1     female   402    1627  1
7       61     1     male     105    2964  2

There are no censored outcomes

I am performing a competing risks analysis to see the effect of covar2 on outcome. I am using 2 different packages and get very different results.

Method 1: using cmprsk package

cov <- model.matrix(~ covar1 + covar2 + covar3 + covar4, data = data.df)[, -1]
crr(data.df$time, data.df$status, cov1 = cov, failcode = 1, cencode = 0)

Method 2: Using riskRegression package

riskRegression(Hist(time,status) ~ covar1 + covar2 + covar3 + covar4, data = data.df, cause = 1, link = "prop")

Are these 2 methods equivalent? As they provide very different results from each other for the effect of covar2.
Method 1 gives an (exponentiated) coefficient of 1.18
Method 2 gives an (exponentiated) coefficient of 0.75

Furthermore, method 2 gives very different results depending on whether the "alternate" (competing) outcome is changed from being coded as a 2 to a 0 in the dataframe:
(1.18 if competing outcome coded as 0,
1.93 if competing outcome coded as 2).
This change doesn't happen with crr if you change the coding from 2 to 0 in the dataframe and then change cencode to 2 (results stay the same). (again, there are no censored outcomes in this dataframe).
There doesn't seem to be a cencode equivalent in the riskRegression command.

It is worryingly easy to get very different results depending on how you handle these commands.

Please could somebody explain:

1) Why these commands (method 1 vs method 2) are not equivalent
and
2) Why the results of riskRegression change depending on how the competing outcome is coded

$\endgroup$
  • 1
    $\begingroup$ I don't have an answer, it will probably come from looking at source code. Just as a caution: R packages are not validated, not even a little bit. I can't help but notice the documentation for riskRegression is sparse, vague, and incorrect at times. For instance, the argument "cause" is described as "cause of interest". What is that? Does that in fact mean failure code? Check into it by simulating some data, running riskRegression examples with crr, etc. $\endgroup$ – AdamO Sep 18 '18 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.