I am trying to write an R code for the likelihood function for a cox model with gamma frailty. I know there are packages in R which would do that easily. But I want to write a customized likelihood function for cox model with gamma frailty for my own data rather than using packages.
ID Start_Time End_Time Gap_Time Status X1 X3 X3
1 0 10 10 1 12 A 150
1 11 90 79 0 16 B 601
2 0 45 45 1 25 A 278
2 46 69 23 1 18 A 895
2 70 90 20 0 23 C 246
3 0 14 14 1 9 A 516
3 15 34 19 1 17 D 385
3 35 61 26 1 10 B 520
3 62 85 23 1 5 C 669
3 86 90 4 0 32 C 553
As I would consider myself as an advanced beginner in R and statistics, I need help on this to learn how to do it step by step in R. I was wondering if there is any available codes for that from which I can refer to?
I appreciate any help and advice.