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: margins dydx for logit model with interaction terms
From
Richard Williams <[email protected]>
To
[email protected], [email protected]
Subject
Re: st: margins dydx for logit model with interaction terms
Date
Thu, 09 Aug 2012 16:50:03 -0500
At 03:32 PM 8/9/2012, David Quinn wrote:
Thanks, Richard. I did not use factor variable notation. Hence,
that's why I also set the interactions at specific values in the
margins command. Is there a reason to use the factor notation
instead?
Yes. You want to get the correct results. ;-) See
http://www.nd.edu/~rwilliam/stats/Margins01.pdf
There is also an article in the current Stata Journal that expands on
the above. You can probably do it without factor variables, but the
odds are much greater you will make a mistake.
I think that Stata is interpreting the "atmeans" part of the margins
command as setting all variables at their means, including the
variable of interest (the one placed in parentheses after dydx).
Perhaps what I need to do is remove the "atmeans" part, and instead
include the control variable (X4) in the -at- specification and set it
at its mean value.
--Dave
On Thu, Aug 9, 2012 at 4:20 PM, Richard Williams
<[email protected]> wrote:
> At 11:30 AM 8/9/2012, David Quinn wrote:
>>
>> Hello,
>>
>> I am estimating a logit model as such: Y=X1 + X2 + X3 + X4 + X1*X3 +
>> X2*X3.
>
>
> What was the actual logit command? Did you use factor variable notation? If
> not -margins- will assume x1 and x2 are continuous rather than dichotomous.
> Assuming you want to treat x3 as continuous, The command should
be something
> like
>
> logit y i.x1 i.x2 x3 x4 i.x1#c.x3 i.x2#c.x3
>
>
>
>> X1 and X2 are binary predictors. X3 is an ordinal predictor. X4 is a
>> control variable. X1*X3 and X2*X3 are the interaction of X1 and X2,
>> respectively, with X3.
>>
>> I'd like to assess the discrete change in my dependent variable for X1
>> at different levels of X3, given that I expect there to be interaction
>> effects of X1 and X3. I also need to set X2 and X2*X3 at zero while
>> doing this in order to calculate the proper discrete change of
>> interest. As for the control variable X4, I'd like to just keep it at
>> its mean value.
>>
>> I used the following margins command to calculate the discrete change in
>> X1:
>>
>> margins, dydx(X1) atmeans at(X3=(1 2 3) X1*X3=(1 2 3) X2=0 X2*X3=0)
>
>
> if you have used factor variable notation, I think all you need is
>
> margins, dydx(x1) atmeans at(x3=1 2 3) x2 = 0)
>
> I could be wrong so make sure it looks right.
>
>
>
>> "Atmeans" places X4 at its mean, while the stuff after "at" specifies
>> the specific values at which to hold the other variables while
>> calculating the change.
>>
>> But in the legend that accompanies the results, it keeps saying that
>> X1 is being held at its mean value when the discrete change
>> calculations are being made. Why does margins set the variable of
>> interest--located after the dydx command--to its mean value when
>> calculating the discrete change, when clearly one would want the dydx
>> calculations to be made at specific values of the variable of
>> interest? I just assumed that placing the variable of interest after
>> dydx would tell Stata to calculate the change in Y as that variable
>> moves from zero to one, holding all other variables at the values
>> specified after "at."
>>
>> Am I doing something incorrectly?
>>
>> Perhaps I should just use King et al.'s CLARIFY package to calculate
>> the predicted probabilities, or perhaps even follow Buis' (2010)
>> advice and calculate the odds. From what I gather, those two are a
>> bit more straightforward then using the margins command.
>>
>> Thanks in advance,
>> --Dave
>> *
>> * 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/
>
>
> -------------------------------------------
> Richard Williams, Notre Dame Dept of Sociology
> OFFICE: (574)631-6668, (574)631-6463
> HOME: (574)289-5227
> EMAIL: [email protected]
> WWW: http://www.nd.edu/~rwilliam
>
>
> *
> * 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/
*
* 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/
-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME: (574)289-5227
EMAIL: [email protected]
WWW: http://www.nd.edu/~rwilliam
*
* 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/