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!
Related Posts with how to represent estimates for covariates using Mata
Need some help interpreting fe in StataMPI've been teaching myself STATA code for my research paper. I've copied the code and the output of i…
GMM with multi-level moment conditonsHi all, I want to do a two-step GMM estimation with multi-level moment conditons (the objective fun…
How to get matching results in combination?Dear all, here is the code: Code: tempfile using * Example generated by -dataex-. To install: ssc …
Generate a New Variable: if anyI have a variable called DocVisit that records the number of times a respondent visits a clinic. It …
Log transform a variableIf we try to log transform a variable in STATA, why does the result(logX value) obtained differ from…
Subscribe to:
Post Comments (Atom)
0 Response to how to represent estimates for covariates using Mata
Post a Comment