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
Calculating dummies based on other variablesDear specialists, I have a panel data, it includes Stock ID (Stkcd), fiscal year (Year), Background…
How to find nonnumeric characters within a string variable and lists the observations that have this issueI want to identify which observations in my variable has non-numeric characteristics and what is the…
Axis titles bleeding into plot areaHello! First time poster, thank you all for your helpful advice in the past. And apologies if this i…
Recovering p-values from multiple bootstrapped iterations of a logit or glm regressionThe CMS models for choosing comorbidities to include in a risk adjustment model for a quality measur…
Crosstabs automationI am in the process of fully automating a code process. i have 10 different variables and first i ha…
Subscribe to:
Post Comments (Atom)
0 Response to how to represent estimates for covariates using Mata
Post a Comment