Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Interactions and factor variables with ivregress
From
Bert Lloyd <[email protected]>
To
statalist <[email protected]>
Subject
st: Interactions and factor variables with ivregress
Date
Thu, 20 Sep 2012 07:38:53 -0400
Dear Statalist,
I am estimating a model with
Outcome y
Treatment T
Continuous covariate X
Continuous instrument Z
and believe the effect of T on y varies with X. I could like to
estimate an IV model interacting T with X and use -margins, dydx()
at([interesting values of X])- to obtain estimated treatment effects
for different values of X.
If T were exogenous, I would run
reg y i.T##c.X
margins, dydx(T) at(X=(0.5(0.5)9.5))
and this works fine with simulated data: -margins- returns estimated
treatment effects that vary sensibly with X.
However, when I run what I think is the parallel IV regression
ivregress 2sls y (i.T##c.X=c.Z##c.X)
I get
depvars may not be factor variables
r(198);
and -trace- tells me that the problem is occuring in
ivregress.Estimate at the line
_iv_parse y (i.T##c.X=c.Z##c.X)
Can anyone suggest a way to estimate this model so that the results
can be easily processed with -margins, dydx()-? If not, I suppose I
could do the interactions by hand, although I find this often leads to
my messing up the calculations of the marginal effects.
Many thanks in advance,
BL
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/