Q:

Fixed coefficient/Offset in Fine&Gray competing-risk adjusted model (FGR)

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?)

A:

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)

