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: positive interaction - negative covariance


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: positive interaction - negative covariance
Date   Sat, 23 Feb 2013 15:25:22 +0000

What you now describe is quite different from what you explained at
the outset: you had -- it is all here in the thread -- a simple
regression with just x z x*z as predictors; now it's a -glm- with
logit link and extra predictors.

With just

x z x*z

as predictors, you can plot the implied straight lines directly with
-twoway function-. For a more complicated model you will need the more
complex machinery of -margins- and -marginsplot-.

It's still true, as David underlined, that if the terms using
interactions are not significant at conventional levels, the
interaction can't be regarded as well established.

A quite separate point is this. As the Statalist FAQ explains, you are
assumed to use Stata 12 unless you explain otherwise; that being so,
advice is not to mix -xi:- and factor variable notation in an
up-to-date Stata.

Nick

On Sat, Feb 23, 2013 at 10:58 AM, andrea pedrazzani
<[email protected]> wrote:
> Sorry, I misunderstoond the syntax. If I do as you suggest (using
> -x-), I have two straight line, both with almost the same positive
> slope. The first one (where the condition Z is absent) has a bit
> higher intercept and is slightly steeper than the second (where the
> condition is present).
>
> As for the model, I meant a fractional logit. I am using
>
> xi: glm DEPVAR    X  Z  X*Z  other-covariates   i.fixed-effects,
> family(binomial) r
>
> where DEPVAR is a fractional response variable.
>
>
> Best,
> Andrea
>
> 2013/2/23 Nick Cox <[email protected]>:
>> Correction. The code should end
>>
>> , ra(1 1764)
>>
>> On Sat, Feb 23, 2013 at 12:45 AM, Nick Cox <[email protected]> wrote:
>>> This is very confusing.
>>>
>>> 1. In terms of your previous statement of "a simple regression model"
>>> you should have applied code like this, tailored to the special syntax
>>> of -twoway function-.
>>>
>>> local b0 = 1.663478
>>> local b1 = .0021067
>>> local b2 = -.3692713
>>> local b3 = -.0010758
>>>
>>> twoway function `b0' + `b1'*x, ra(1 1764) || ///
>>>         function `b0' + (`b1' + `b3')*x + `b2', x(1 1764)
>>>
>>> after which the functions would appear as perfect straight lines; no
>>> jaggedness is implied. The jaggedness is a consequence of using -dur-
>>> when only -x- is allowed and needed. -x- is a generic x axis variable
>>> and unrelated to any variable in the dataset.
>>>
>>> 2. But now you are telling us that it is a flogit model, a term I
>>> don't recognise.
>>>
>>> I think you won't get good help if you don't explain clearly and
>>> consistently what you are doing.
>>>
>>> Nick
>>>
>>> On Fri, Feb 22, 2013 at 10:50 PM, andrea pedrazzani
>>> <[email protected]> wrote:
>>>> Thank you very much Nick, Jay and David.
>>>>
>>>>
>>>> My -x- is -dur-, whose range is from 1 to 1764.
>>>> I plotted the two curves as you suggested me:
>>>>
>>>>
>>>> local b0 = 1.663478
>>>> local b1 = .0021067
>>>> local b2 = -.3692713
>>>> local b3 = -.0010758
>>>>
>>>> twoway function `b0' + `b1'*dur, ra(1 1764) || ///
>>>>        function `b0' + (`b1' + `b3')*dur + `b2', ra(1 1764)
>>>>
>>>>
>>>> The two functions have the same shape and are very close to each
>>>> other. Both tend to slightly increase as -x- increases (the functions
>>>> are really jagged, because -dur- has many values). The first one
>>>> (where the condition Z is absent) is always a bit higher than the
>>>> second (where the condition is present). If I am not wrong, this
>>>> indicates that the impact of both on my dependent variable goes in the
>>>> same (positive) direction.
>>>>
>>>>
>>>> To Jay: my dependent variable is a proportion (I am using flogit)
>>>>
>>>>
>>>> To David:
>>>>> Thus, X has a positive impact on Y when Z is present and when Z is
>>>>> absent, but those contributions are not significantly different.  That
>>>>> is, the interaction is essentially absent.
>>>>
>>>> Thank you for clarifying the point. Indeed, if I compare the
>>>> confidence interval of b1 to the confidence interval of (b1+b3), they
>>>> are not statistically different. Is it the same? In a book I read, the
>>>> authors make this comparison.
>>>>
>>>>
>>>> 2013/2/22 David Hoaglin <[email protected]>:
>>>>> Dear Andrea,
>>>>>
>>>>> The basis for a statement about the interaction is the estimate of b3
>>>>> and its standard error: After taking into account the contributions of
>>>>> X and Z, the interaction is not significant (p = .245).
>>>>>
>>>>> Thus, X has a positive impact on Y when Z is present and when Z is
>>>>> absent, but those contributions are not significantly different.  That
>>>>> is, the interaction is essentially absent.
>>>>>
>>>>> A negative covariance between b1 and b3 is to be expected.
>>>>>
>>>>> You may want to remove XZ from the model.
>>>>>
>>>>> Regards,
>>>>>
>>>>> David Hoaglin
>>>>>
>>>>> On Fri, Feb 22, 2013 at 12:32 PM, andrea pedrazzani
>>>>> <[email protected]> wrote:
>>>>>> Hello,
>>>>>>
>>>>>> I have a simple regression model with an interaction: Y = b0 + (b1)X +
>>>>>> (b2)Z + (b3)XZ.
>>>>>> Z is a dummy (0 or 1).
>>>>>>
>>>>>> b1 = .0021067  (SE= .0008513 and p=0.013)
>>>>>> b2 = -.3692713  (SE= .2329837 and p=0.113)
>>>>>> b3 = -.0010758  (SE= .000926 and p=0.245)
>>>>>>
>>>>>> Hence, the combined coefficient (i.e., the coefficient on X when Z=1)
>>>>>> is positive:
>>>>>> b1+b3 =  .0021067 + -.0010758 = .0010309
>>>>>>
>>>>>> with SE = sqrt( var(b1) + var(b3)*(Z^2) + 2Z*cov(b1,b3)  )
>>>>>>             = sqrt( .0000007246 + .0000008574*1 + -.0000007079*2 )
>>>>>>             = .00040768
>>>>>>
>>>>>> To get the p-value for the combinet coefficient, I did
>>>>>> .0010309/.00040768 = 2.528699.  The corresponding p = 0.0114.
>>>>>>
>>>>>> Summing up, X has a positive impact on Y when the condition Z is
>>>>>> present (.0010309), and a positive impact also when the condition Z is
>>>>>> not present (.0021067).
>>>>>> So, what can I say about the interaction? What kind of interaction is
>>>>>> it when the impact of X is positive both when the condition is present
>>>>>> and when it is absent? Moreover, the coefficients b1 and (b1+b3) are
>>>>>> very similar to each other.
>>>>>> Also, both b1 and the combined coefficient (b1+b3) are positive, but
>>>>>> the covariance between b1 and b3 is negative. It sounds strange to
>>>>>> me...
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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