Bookmark and Share

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]

Re: st: Interactions and factor variables with ivregress


From   Andrea Drechsler <[email protected]>
To   <[email protected]>
Subject   Re: st: Interactions and factor variables with ivregress
Date   Wed, 26 Sep 2012 13:53:36 -0400

Statalisters,

I've run into the same problem as below, only I'm using -ivreg2-.
Specifically, I'm looking for a way to do something like the -margins-
command after -ivreg2-.  It seems that -ivreg2- doesn't yet support
factor variables.  Is there another way to get the results like those
from -margins- after using -ivreg2- with an endogenous interaction?

Many thanks,

Andrea


On Thu, Sep 20, 2012 at 07:38 AM, Bert Lloyd <[email protected]> wrote:

> 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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index