0

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.

F.gh
  • 23
  • 6
  • Do you particularly want to do it from scratch (eg for learning purposes) - because if not, I would first try to find one of the existing packages, work out where the likelihood function there is defined and modify that. Or at least look at it for inspiration. – Peter Ellis Jul 03 '18 at 00:29
  • @PeterEllis Even if it is a modified version from a package it would be very very helpful to me. My final purpose is to use general optimization packages like optim to maximize that customized likelihood function. – F.gh Jul 03 '18 at 13:32

0 Answers0