+ Reply to Thread
Results 1 to 2 of 2

Thread: Interaction Terms in Linear regression

  1. #1
    Points: 4, Level: 1
    Level completed: 7%, Points required for next Level: 46

    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Interaction Terms in Linear regression




    In R I used the linear regression call for three variables:

    y, x, and c

    Y and X are numeric where C is a dichotomous {0,1}. X and C are the regressors.

    Since there was no linear relationship between X and Y when C = 0, I just ignored it and regressed the model using the subset of the sample where C = 1.

    When I went back and regressed X + C + X*C, I obtained a linear model where B0 and B1 were identical to the previous B0 and B1 and the interaction coefficient was non-zero. This only bothers me because when I regressed only over C = 0, I obtained a constant relationship independent of X, but it did not equal the original constant + the contribution due to the interaction (in case I just programmed the index backwards)


    Any clue what's going on?


    For the actual output:



    lm(formula = ovsat ~ lifesat, data = active.dataset)

    Residuals:
    Min 1Q Median 3Q Max
    -1.97991 -0.25075 0.06956 0.34956 1.02009

    Coefficients:
    Estimate Std. Error t value Pr(>|t|)
    (Intercept) 3.01781 0.43395 6.954 4.15e-10 ***
    lifesat 0.24053 0.09909 2.427 0.0171 *



    lm(formula = ovsat ~ lifesat * status, data = dataset)

    Residuals:
    Min 1Q Median 3Q Max
    -1.97991 -0.44380 0.06956 0.46903 1.64736

    Coefficients:
    Estimate Std. Error t value Pr(>|t|)
    (Intercept) 3.0178 0.5198 5.806 2.47e-08 ***
    lifesat 0.2405 0.1187 2.026 0.044 *
    status[T.2] 1.0276 0.7486 1.373 0.171
    lifesat:status[T.2] -0.4188 0.1690 -2.479 0.014 *



    lm(formula = ovsat ~ lifesat, data = inactive.dataset)

    Residuals:
    Min 1Q Median 3Q Max
    -1.64264 -0.58380 -0.03186 0.55620 1.64736

    Coefficients:
    Estimate Std. Error t value Pr(>|t|)
    (Intercept) 4.0454 0.6101 6.631 1.52e-09 ***
    lifesat -0.1783 0.1362 -1.309 0.193

  2. #2
    Omega Contributor
    Points: 38,396, Level: 100
    Level completed: 0%, Points required for next Level: 0
    hlsmith's Avatar
    Location
    Not Ames, IA
    Posts
    7,001
    Thanks
    398
    Thanked 1,186 Times in 1,147 Posts

    Re: Interaction Terms in Linear regression


    I didn't stare too hard at the above results, but skim and starting typing. Something like this is best portrayed using graphs. Graph the best fit line overlaid on a scatterplot for the continuous variables. Next, do the same thing, but dichotomize the IV based on the categorical variable. Now make the points on the graph coordinate with the group they are in and plot the lines generate from the interaction model.


    This should help you understand what may be occurring. Also, feel free to post these graphs so we can also learn and evaluate the effects.


    Thanks.
    Stop cowardice, ban guns!

+ Reply to Thread

           




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts






Advertise on Talk Stats