I have the following dataset:
data_1 <- data.frame( id = c(1, 1, 2, 2, 3, 3), start = c(0, 5, 0, 3, 0, 4), stop = c(5, 10, 3, 7, 4, 8), event = c(1, 0, 1, 1, 0, 1), covariate = factor(c("A", "A", "B", "B", "A", "B")) ) using this code:
cox_model <- coxph(Surv(start, stop, event) ~ covariate + cluster(id), data = data_1) my covaraiteB estimate is 2.732.
then in the second row, I add two days to both start and end:
data_2 <- data.frame( id = c(1, 1, 2, 2, 3, 3), start = c(0, 7, 0, 3, 0, 4), stop = c(5, 12, 3, 7, 4, 8), event = c(1, 0, 1, 1, 0, 1), covariate = factor(c("A", "A", "B", "B", "A", "B")) ) again, fit the model:
cox_model_2 <- coxph(Surv(start, stop, event) ~ covariate + cluster(id), data = data_2) and my covaraiteB estimate is now 2.109.
Why does this happen? I just added two days to both start and end of one of the rows, it shouldn't change anything, so why does it affect model estimates?
And if I want the model to treat data_2 similar to data_1, is there a way to do it without transforming data_2 to data_1 (i.e., by adding something in the formula statement)?