0

I want to fit a Fine&Gray competing risk adjusted model including an offset. In other types of models, I am used to being able to simply put in >offset(x), which will add an offset with coefficient 1. I tried to do the same using the FGR function from the package riskRegression. I didn't get a warning message, but I then noticed that the coefficients for the model with and without offset(x) were exactly the same for the other variables

Example:

#install.packages(riskRegression")
library(riskRegression)
matrix <- matrix(c(3,6,3,2,5,4,7,2,8,2,
               0.8,0.6,0.4,0.25,0.16,0.67,0.48,0.7,0.8,0.78,
               60,55,61,62,70,49,59,63,62,64,
               15,16,18,12,16,13,19,12,15,14,
               0,2,1,0,1,1,0,1,2,0,
               345,118,225,90,250,894,128,81,530,268),
             nrow=10,ncol=6)
df <- data.frame(matrix)
colnames(df) <- c("x","y","z", "a","event","time")

fit <- FGR(Hist(time,event)~ offset(x)+a+y+z, data=df, cause=1)
fit
fit2 <- FGR(Hist(time,event)~ a+y+z, data=df, cause=1)
fit2

If you run this script, you can see that the coefficients of a, y and z do not change, while you are not getting a warning that offset cannot be used (so apparantly it just simply ignored offset(x)).

Does anybody know of a way to include x as an offset (i.e. with coefficient fixed at 1) in FGR? (Edit: Or another way to calculate the correct coefficents for a, y and z with fixed x?)

Tami
  • 133
  • 8
  • [Helpful-link](https://stackoverflow.com/questions/32252167/r-how-to-offset-and-match-within-a-dataframe), This may solve your problem. – kvk30 Apr 04 '18 at 11:44
  • @kvk30: I am uncertain how this link would help me in the context of survival analysis and fixed coefficents with regression analysis. I am not looking to match within a dateframe. – Tami Apr 04 '18 at 12:35
  • Sorry I thought you are trying offset for certain column values using data frame, I will check and come to you. – kvk30 Apr 04 '18 at 13:03
  • 1
    is there any reason why you have to use the package riskRegression? you can specify offsets in the survival package with fine-gray models, see this link how to use the survival package for finegray models, just wrap offset(x) around your variable of choice :https://cran.r-project.org/web/packages/survival/vignettes/compete.pdf – Mike Apr 04 '18 at 15:17
  • @Mike: Not particularly that I am aware of, it is just the package + scripts from co-workers. I will definitely check that out, thanks! – Tami Apr 05 '18 at 12:48
  • @Mike: That worked like a charm! If you could make that an answer I can accept it:) Thanks so much! – Tami Apr 05 '18 at 13:39
  • Why would you want an offset of 1 in a survival analysis? (Relative risks usually being the exponentiated coefficients so the assumed baseline relative risk set by the offset of 1 would be e, the base of the natural logarithms.) And what does it mean to have a single "offset" when there are two types of event? – IRTFM Jun 24 '19 at 23:22

1 Answers1

-1

You can use the survival package for Fine-Gray models with offsets. Just wrap the variable you would like to have the offset with offset(var). I set the model below to model event 1. See code below:

library(survival)

matrix <- matrix(c(3,6,3,2,5,4,7,2,8,2,
                   0.8,0.6,0.4,0.25,0.16,0.67,0.48,0.7,0.8,0.78,
                   60,55,61,62,70,49,59,63,62,64,
                   15,16,18,12,16,13,19,12,15,14,
                   0,2,1,0,1,1,0,1,2,0,
                   345,118,225,90,250,894,128,81,530,268),
                 nrow=10,ncol=6)
df <- data.frame(matrix)
colnames(df) <- c("x","y","z", "a","event","time")

coxph(Surv(time,event==1)~ offset(x)+a+y+z, data=df)
Mike
  • 3,797
  • 1
  • 11
  • 30
  • I'm not sure this answers the question. That does not appear to be a Fine-Gray model estimation procedure. The survival package has a `finegray` function that can develop a model with two types of non-censored event variables. On the other hand, I think the question is ill-posed since there is no explanation of how a single offset is supposed to be interpreted in the context of a competing risk analysis. – IRTFM Jun 24 '19 at 23:29