2
$\begingroup$

I plotted a treatment effect on some performance measure over the course of an experiment. Stata has a nice feature called margins and marginsplot to do this.

So what I do is run a linear regression, where the time trend is a third degree polynomial, like

reg depvar control##c.time1##c.time1##c.time1 ..., vce(cluster clustvar)

$$y=\beta_1 control\times time+\beta_2 control\times time^2+\beta_3 control\times time^3+\beta_4 time+\beta_5 time^2+\beta_6 time^3+X'\gamma+\epsilon$$ where "control" is a dummy denoting the control group, and "c.time1" is the time variable in months (the ## denote the interactions in Stata). In other words, I fit a time trend for the treatment and one for the control group. The plot is obtained by first computing the average prediction over time via the margins command, and then plotting it:

margins, at(time1==(1(1)39)) over(control)

marginsplot

The end result is this: enter image description here

As you can see, the width of the confidence intervals looks like a continuous function of the month (x axis). But for example in month 4 or 21 the CI is extremely narrow, whereas it is quite broad for, e.g., month 12.

Why is that? It is weird looking, and I can't explain why width in one month is so much narrower than in the other. At first I though that maybe there are many more observations in month 21 that reduce standard errors (and hence narrow CIs), but this is not the case. Why else would the width of confidence intervals differ by so much?

The default method to compute these CIs is the delta-method. If I use the option "vce(unconditional)" for margins, the confidence intervals are much broader, but roughly of equal width for each month. Which would be the better choice here?

$\endgroup$
  • 2
    $\begingroup$ If you boil it back down to linear you should see the reason. The 95%CI of the predicted slope is the narrowest at the means of x and y. The behaviors you are expecting is perhaps of the prediction interval, not confidence interval. Why the narrower range in 4th month, I am not sure... probably the combined effects of the different independent variables. $\endgroup$ – Penguin_Knight Nov 25 '13 at 17:42
  • $\begingroup$ Ah, nice. As it happens, the mean month is 21, so this fits. Can you give a pointer why we expect the delta method to give minimal standard errors at the mean of the data? The delta method states that a nonlinear transformation $G$ of random variable $\beta$ has asymptotic variance $$Var(G(\beta))=\frac{\partial G(\mu)}{\partial \mu'}Var(\beta) \frac{\partial G(\mu)}{\partial \mu}.$$ How do I see here that the standard error is minimal at the mean of the data ($\beta$ and $\mu$ refer to the estimates, so this is not obvious to me)? $\endgroup$ – Nameless Nov 25 '13 at 19:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.