I have a regression model using discrete time hazard regression. And I wanted to study the effect of modifier A (binary) and factor B(linear spline with 5 knots, represents by “B?" in below), and the interaction between A and B (represents by "B?int?" below) to the outcome y. There was 3 follow-up timepoints, so fu1, fu2, fu3 were used in the discrete time model.
Therefore, the regression writes: cloglog y i.A B? B?int? fu1 fu2 fu3, nocon eform
Then I want to calculate the estimates for 100 points, and use these estimates to draw a graph. And my question is highlighted in red below: I wonder to represent the coefficients for fu1, fu2, fu3 in mata structure, should I use m0? To simply my question, how to represent estimates in mata for the “covariates”.
Here is the code I wrote:
set obs 100
mata:xw=st_data(.,”B?")
mata:xn=J(100,5,0)
mata:m0=J(100,1,0)
mata:m1=J(100,1,1)
mata:x0=(xw,m0,m0,xn,m0,m0,m0) // reference group
mata:x1=(xw,m0,m0,xw,m0,m0,m0) // group 1 in A, without main effect
mata:x2=(xw,m0,m1,xw,m0,m0,m0) // group 1 in A, with main effect
mata:x3=(xn,m0,m0,xw,m0,m0,m0) // group 1 interaction
Thank you very much!
Therefore, the regression writes: cloglog y i.A B? B?int? fu1 fu2 fu3, nocon eform
Then I want to calculate the estimates for 100 points, and use these estimates to draw a graph. And my question is highlighted in red below: I wonder to represent the coefficients for fu1, fu2, fu3 in mata structure, should I use m0? To simply my question, how to represent estimates in mata for the “covariates”.
Here is the code I wrote:
set obs 100
mata:xw=st_data(.,”B?")
mata:xn=J(100,5,0)
mata:m0=J(100,1,0)
mata:m1=J(100,1,1)
mata:x0=(xw,m0,m0,xn,m0,m0,m0) // reference group
mata:x1=(xw,m0,m0,xw,m0,m0,m0) // group 1 in A, without main effect
mata:x2=(xw,m0,m1,xw,m0,m0,m0) // group 1 in A, with main effect
mata:x3=(xn,m0,m0,xw,m0,m0,m0) // group 1 interaction
Thank you very much!
Comment