I am trying to draw a forest plot for the results of cox model with repeated measures considering subjects ids; here is a part of my big data;
data <- read.table(header=TRUE, text="
Id start end QS Age Event
01 0 70 1 25 1
01 70 78 2 25 1
01 78 85 3 25 1
02 0 92 4 23 1
02 92 98 5 23 1
02 98 105 6 23 1
02 105 106 7 23 0
")
The cox model is:
set.seed(1234)
model <- coxph(Surv(start, end, Event) ~ QS + Age
+ cluster(Id), data = data, id=Id)
with the results:
> model
Call:
coxph(formula = Surv(start, end, Event) ~ QS, data = data, id = Id,
cluster = Id)
coef exp(coef) se(coef) robust se z p
QS -1.896e+01 5.829e-09 1.310e+04 1.000e+00 -18.96 <2e-16
Likelihood ratio test=4.16 on 1 df, p=0.04142
n= 7, number of events= 6
The function for forest plot
ggforest(model, data = data)
provides a figure like:
which is not my ideal and I am not sure if it is the right picture. For example why the id is considered as a variable in the picture.