Hello Statalist community,
I’m having trouble understanding the graphical diagnostics for the parallel trends assumption after running the didregress command, as shown in the Stata documentation here: https://www.stata.com/manuals/causaldidregress.pdf.
According to the documentation, a visual diagnostic of this assumption can be obtained by plotting the means of the outcome over time for both groups, or by visualizing the results of the linear-trends model. The estat trendplots command displays two graphs: one for the observed means and another for the linear-trends model.
Initially, I assumed that the graph of observed means could be generated using the following commands:
collapse (mean) satis, by(procedure month)
twoway connected satis month if procedure == 0 || connected satis month if procedure == 1
But the graph is different in that the treatment group doesn't have observations from January to March and the values of control group are higher than trendplots.
I then tried plotting the means using a model-based approach:
regress satis i.procedure i.month
margins, at(procedure=0 month=(1(1)7) )
margins, at(procedure=1 month=(1(1)7) )
But the predicted values from this approach differ from those shown in the estat trendplots graph.
Is there a way to reproduce the observed means graph shown in estat trendplots using separate commands?
Thank you in advance for your help.

I’m having trouble understanding the graphical diagnostics for the parallel trends assumption after running the didregress command, as shown in the Stata documentation here: https://www.stata.com/manuals/causaldidregress.pdf.
According to the documentation, a visual diagnostic of this assumption can be obtained by plotting the means of the outcome over time for both groups, or by visualizing the results of the linear-trends model. The estat trendplots command displays two graphs: one for the observed means and another for the linear-trends model.
Initially, I assumed that the graph of observed means could be generated using the following commands:
collapse (mean) satis, by(procedure month)
twoway connected satis month if procedure == 0 || connected satis month if procedure == 1
But the graph is different in that the treatment group doesn't have observations from January to March and the values of control group are higher than trendplots.
I then tried plotting the means using a model-based approach:
regress satis i.procedure i.month
margins, at(procedure=0 month=(1(1)7) )
margins, at(procedure=1 month=(1(1)7) )
But the predicted values from this approach differ from those shown in the estat trendplots graph.
Is there a way to reproduce the observed means graph shown in estat trendplots using separate commands?
Thank you in advance for your help.
Comment