Hi everyone,
I followed the (very useful) instructions here but I'm confused regarding one thing. I have a binary treatment T and a continuous covariate X. I'm interested in how the treatment effect of T on my outcome Y varies over the distribution of X. Hence, I'm estimating: - npregress kernel Y T X -
As dicussed in the blog post now I have two options to visualise the treatment effect heterogeneity:
Option A:
- margins i.T, at(X=(-2(0.5)2)) -
- marginsplot -
Option B:
- margins, dydx(T) at(X=(-2(0.5)2)) -
- marginsplot -
In my understanding they should give the exact same result just visualised differently: Option A plots the predicted Y as a function of X once for T==1 and once for T==0, while Option B directly plots the difference between the prediction for T==1 and T==0 as a function of X (because T is binary and hence the derivative dydx is just the difference).
However, in my case they differ! Option A shows that the difference between E(Y|T==1,X) and E(Y|T==0,X) is decreasing with X, while Option B shows the opposite...!!! Can anybody explain what is going on here? For Option B I get basically something linear, it's just an increasing straight line, so it seems the dydx option imposes a constant effect over X or something the like, but I don't find anything like that in the description of the command.
Help is greatly appreciated! Thanks!
↧
Re: Nonparametric regression: Like parametric regression, but not
↧