I am looking at how my outcome y evolves over time assuming such evolution may differ by x (binary).
I assume a nonlinear effect of time, which I operationalize as a quadratic effect.
Therefore I have time and time squared in my model, and I interact x with time, so my model looks like
xtreg y time##x timesquare##x, i(pid)
How can I plot y trajectories over time by x?
In a model with a linear effect of time or where I treat time with dummies for each time point I would use “marginsplot” as below…but I cannot figure out how to correctly apply that in the case of a quadratic effect.
xtreg y x##c.time, i(pid) /*or i.time if I want dummies for each time*/
margins x, at(time=(0(5)50))
marginsplot
thanks. Any suggestions is welcome.
Anna
Related Posts with Plotting results from nonlinear effects
Saving obs with parmest or parmbyHi all, I'm using national survey data to analyze health outcomes for particular population groups.…
Interpretation when dependent and independent variables are percentagesDear all, I have a problem with the interpretation of my dependent variables. My dependent variable…
Interaction term as an IV?Hello, I have read a few posts on here that discuss IV when the model has interaction terms, but I …
Survey pointer to spouse without MataI'm using the IPUMS extract of the CPS March Supplement. In their extract, the variables YEAR, SERIA…
Precision issues with rounding of a variableHello Statalist, I am using Stata 15.1 and would like to request advice regarding a precision issue…
Subscribe to:
Post Comments (Atom)
0 Response to Plotting results from nonlinear effects
Post a Comment