Question:
I following this book learning on survival analysis: https://link.springer.com/book/10.10...-1-4419-6646-9
My question is about the code which was given by the author. Data found below.
Clinic is a categorical variable of 1 or 2. prison is a categorical variable of 0 or 1.
Code:
stcox prison dose clin_pr clin_do, strata(clinic). //this gives the HR for a combined clinic //The book suggests the following to get an output for the HR for prison 1 VS PRISON 0 for CLinic == 2 //My question: *********How does STATA know that it needs to output the HR for clinic ==2 in this code given below lincom prison+2*clin_pr, hr *The interaction terms were defined previously as: *generate interaction terms gen clin_pr=clinic*prison gen clin_do=clinic*dose
stcox prison dose if clinic ==2
Code:
* Example generated by -dataex-. For more info, type help dataex clear input double(id clinic status survt prison dose) byte(_st _d) int _t byte _t0 float(clin_pr clin_do) byte(_est_A _est_LRTEST_0) 1 1 1 428 0 50 1 1 428 0 0 50 1 1 2 1 1 275 1 55 1 1 275 0 1 55 1 1 3 1 1 262 0 55 1 1 262 0 0 55 1 1 4 1 1 183 0 30 1 1 183 0 0 30 1 1 5 1 1 259 1 65 1 1 259 0 1 65 1 1 6 1 1 714 0 55 1 1 714 0 0 55 1 1 7 1 1 438 1 65 1 1 438 0 1 65 1 1 8 1 0 796 1 60 1 0 796 0 1 60 1 1 9 1 1 892 0 50 1 1 892 0 0 50 1 1 10 1 1 393 1 65 1 1 393 0 1 65 1 1 11 1 0 161 1 80 1 0 161 0 1 80 1 1 12 1 1 836 1 60 1 1 836 0 1 60 1 1 13 1 1 523 0 55 1 1 523 0 0 55 1 1 14 1 1 612 0 70 1 1 612 0 0 70 1 1 15 1 1 212 1 60 1 1 212 0 1 60 1 1 16 1 1 399 1 60 1 1 399 0 1 60 1 1 17 1 1 771 1 75 1 1 771 0 1 75 1 1 18 1 1 514 1 80 1 1 514 0 1 80 1 1 19 1 1 512 0 80 1 1 512 0 0 80 1 1 21 1 1 624 1 80 1 1 624 0 1 80 1 1 end
Comment