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
Inquire about .regress y if x == 0I saw a code which is kind of like Code: regress y if x == 0 Both x and y are dummy variables. What…
Collapse to the meanHello, A very trivial question. I would like to collapse to the mean by converting the daily date to…
FE- 0/1 ProblemHi there! I have a panel dataset. I’m doing a Fixed Effects Regression. I have this central variabl…
Merging when one data set has 2 entries per householdHi Statalist! I have a question about merging. I have household level data of farmers and their ag…
Leading zeros for displaying scalarsI would like to take the results of scalars and generate a new macro variable. An example is shown b…
Subscribe to:
Post Comments (Atom)
0 Response to Plotting results from nonlinear effects
Post a Comment