|
|
|
||||
|
Help the Stat Consulting Group by
giving a gift
| |||||
|
Loading
|
|||||
Analysis of covariance (ANCOVA) is a statistical procedure that allows you to
include both categorical and continuous variables in a single model.
ANCOVA assumes that the regression coefficients are homogeneous (the same)
across the categorical variable. Violation of this assumption can
lead to incorrect conclusions. This page will explore what happens
when you have heterogeneous (different) regressions across groups
and show some strategies for dealing with them.
Here is an example data file we will use. It contains 30 subjects
who used one of three diets, diet 1 (diet=1), diet 2 (diet=2) and
a control group (diet=3). Before the start of the study, the
height of the subject was measured, and after the study the
weight of the subject was measured.
input id diet height weight 1 1 56 140 2 1 60 155 3 1 64 143 4 1 68 161 5 1 72 139 6 1 54 159 7 1 62 138 8 1 65 121 9 1 65 161 10 1 70 145 11 2 56 117 12 2 60 125 13 2 64 133 14 2 68 141 15 2 72 149 16 2 54 109 17 2 62 128 18 2 65 131 19 2 65 131 20 2 70 145 21 3 54 211 22 3 58 223 23 3 62 235 24 3 66 247 25 3 70 259 26 3 52 201 27 3 59 228 28 3 64 245 29 3 65 241 30 3 72 269 end
regress weight i.diet
Source | SS df MS Number of obs = 30
-------------+------------------------------ F( 2, 27) = 128.48
Model | 64350.6 2 32175.3 Prob > F = 0.0000
Residual | 6761.4 27 250.422222 R-squared = 0.9049
-------------+------------------------------ Adj R-squared = 0.8979
Total | 71112 29 2452.13793 Root MSE = 15.825
------------------------------------------------------------------------------
weight | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
diet |
2 | -15.3 7.077036 -2.16 0.040 -29.82088 -.7791207
3 | 89.7 7.077036 12.67 0.000 75.17912 104.2209
|
_cons | 146.2 5.00422 29.22 0.000 135.9322 156.4678
------------------------------------------------------------------------------
contrast {diet .5 .5 -1} // average of 1 & 2 vs 3
Contrasts of marginal linear predictions
Margins : asbalanced
------------------------------------------------
| df F P>F
-------------+----------------------------------
diet | 1 252.29 0.0000
|
Residual | 27
------------------------------------------------
--------------------------------------------------------------
| Contrast Std. Err. [95% Conf. Interval]
-------------+------------------------------------------------
diet |
(1) | -97.35 6.128893 -109.9255 -84.77455
--------------------------------------------------------------
contrast {diet 1 -1 0} // 1 vs 2
Contrasts of marginal linear predictions
Margins : asbalanced
------------------------------------------------
| df F P>F
-------------+----------------------------------
diet | 1 4.67 0.0397
|
Residual | 27
------------------------------------------------
--------------------------------------------------------------
| Contrast Std. Err. [95% Conf. Interval]
-------------+------------------------------------------------
diet |
(1) | 15.3 7.077036 .7791207 29.82088
--------------------------------------------------------------
The ANOVA results show an overall difference among all of the diets
(F = 128.48, p = .0000) and the contrasts show a difference between the control group and
the two diets (t = -15.88, p = .000), and a difference between diet 1 and diet 2
(t = 2.16, p = .04). The ANOVA disregards the information that we have about the subject's
height. As height is probably correlated with weight, this could
be useful as a covariate in an ANCOVA.The results are consistent with those of the ANOVA. There is an overall effect of diet. Also, the control group is significantly different from the two diets, and diet 1 is different from diet 2. The significance level for the comparison of diet 1 versus diet 2 is smaller than the standard ANOVA.regress weight i.diet height margins diet
Source | SS df MS Number of obs = 30
-------------+------------------------------ F( 3, 26) = 157.80
Model | 67409.8111 3 22469.937 Prob > F = 0.0000
Residual | 3702.18893 26 142.391882 R-squared = 0.9479
-------------+------------------------------ Adj R-squared = 0.9419
Total | 71112 29 2452.13793 Root MSE = 11.933
------------------------------------------------------------------------------
weight | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
diet |
2 | -15.3 5.336514 -2.87 0.008 -26.26936 -4.330639
3 | 92.17052 5.363065 17.19 0.000 81.14658 103.1945
|
height | 1.764658 .3807136 4.64 0.000 .9820899 2.547226
_cons | 33.96775 24.50566 1.39 0.177 -16.40435 84.33986
------------------------------------------------------------------------------
Predictive margins Number of obs = 30
Model VCE : OLS
Expression : Linear prediction, predict()
------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
diet |
1 | 145.3765 3.777665 38.48 0.000 137.9724 152.7806
2 | 130.0765 3.777665 34.43 0.000 122.6724 137.4806
3 | 237.547 3.790178 62.67 0.000 230.1184 244.9756
------------------------------------------------------------------------------
We can see that the coefficient (slope) between height
and weight is 1.76. Figure 1 below shows the scatterplot between height and
weight and the line of best fit with slope 1.76.Figure 1. Scatterplot of weight by height with overall regression linegraph twoway (scatter weight height) (lfit weight height)
regress weight i.diet##c.height
margins diet, at(height=(52 72))
marginslot, x(height)
Source | SS df MS Number of obs = 30
-------------+------------------------------ F( 5, 24) = 220.26
Model | 69595.3546 5 13919.0709 Prob > F = 0.0000
Residual | 1516.64536 24 63.1935565 R-squared = 0.9787
-------------+------------------------------ Adj R-squared = 0.9742
Total | 71112 29 2452.13793 Root MSE = 7.9494
-------------------------------------------------------------------------------
weight | Coef. Std. Err. t P>|t| [95% Conf. Interval]
--------------+----------------------------------------------------------------
diet |
2 | -172.5639 41.40619 -4.17 0.000 -258.0221 -87.10574
3 | -132.6675 38.78455 -3.42 0.002 -212.7149 -52.62011
|
height | -.3768309 .4586553 -0.82 0.419 -1.323449 .5697872
|
diet#c.height |
2 | 2.472703 .6486366 3.81 0.001 1.133983 3.811423
3 | 3.566558 .6131609 5.82 0.000 2.301056 4.83206
|
_cons | 170.1664 29.2786 5.81 0.000 109.7384 230.5945
-------------------------------------------------------------------------------
Adjusted predictions Number of obs = 30
Model VCE : OLS
Expression : Linear prediction, predict()
1._at : height = 53
2._at : height = 72
------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_at#diet |
1 1 | 150.1944 5.473201 27.44 0.000 139.4671 160.9217
1 2 | 108.6838 5.473201 19.86 0.000 97.95648 119.411
1 3 | 206.5545 4.509531 45.80 0.000 197.716 215.393
2 1 | 143.0346 4.600292 31.09 0.000 134.0182 152.051
2 2 | 148.5053 4.600292 32.28 0.000 139.4889 157.5217
2 3 | 267.1593 4.714205 56.67 0.000 257.9197 276.399
------------------------------------------------------------------------------

Figure 2. Scatterplot of
weight by height with separate regression lines for each group (diet 1=red,
diet 2=green, diet 3=yellow)Below we perform an analysis that shows the slopes of each of the lines. Even if we found the slope between height and weight to be 0 in the prior analysis, this is still a useful analysis to perform. It is possible that the overall slope for the entire sample was 0, but the slopes for some groups were positive and the others were negative and they cancelled each other out. This analysis would help you see if such a pattern was occurring.
We indeed see below that the slopes seem very different. (Note that the output has been abbreviated.) The slope for diet 1 (-.37) is much smaller than the slope for diet 2 (2.095) and the control group, diet=3 (3.189). We need to check into this further and test whether these slopes are significantly different from each other.bysort diet: regress weight height
_______________________________________________________________________________
-> diet = 1
Source | SS df MS Number of obs = 10
-------------+------------------------------ F( 1, 8) = 0.24
Model | 42.657257 1 42.657257 Prob > F = 0.6396
Residual | 1440.94274 8 180.117843 R-squared = 0.0288
-------------+------------------------------ Adj R-squared = -0.0927
Total | 1483.60 9 164.844444 Root MSE = 13.421
------------------------------------------------------------------------------
weight | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
height | -.3768309 .7743341 -0.49 0.640 -2.162449 1.408787
_cons | 170.1664 49.43018 3.44 0.009 56.18024 284.1526
------------------------------------------------------------------------------
_______________________________________________________________________________
-> diet = 2
Source | SS df MS Number of obs = 10
-------------+------------------------------ F( 1, 8) = 359.81
Model | 1319.56112 1 1319.56112 Prob > F = 0.0000
Residual | 29.3388815 8 3.66736019 R-squared = 0.9782
-------------+------------------------------ Adj R-squared = 0.9755
Total | 1348.90 9 149.877778 Root MSE = 1.915
------------------------------------------------------------------------------
weight | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
height | 2.095872 .110491 18.97 0.000 1.84108 2.350665
_cons | -2.39747 7.053272 -0.34 0.743 -18.66234 13.8674
------------------------------------------------------------------------------
_______________________________________________________________________________
-> diet = 3
Source | SS df MS Number of obs = 10
-------------+------------------------------ F( 1, 8) = 669.93
Model | 3882.53627 1 3882.53627 Prob > F = 0.0000
Residual | 46.3637317 8 5.79546646 R-squared = 0.9882
-------------+------------------------------ Adj R-squared = 0.9867
Total | 3928.90 9 436.544444 Root MSE = 2.4074
------------------------------------------------------------------------------
weight | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
height | 3.189727 .1232367 25.88 0.000 2.905543 3.473912
_cons | 37.49895 7.703032 4.87 0.001 19.73573 55.26218
------------------------------------------------------------------------------
regress weight i.diet##height
Source | SS df MS Number of obs = 30
-------------+------------------------------ F( 5, 24) = 220.26
Model | 69595.3546 5 13919.0709 Prob > F = 0.0000
Residual | 1516.64536 24 63.1935565 R-squared = 0.9787
-------------+------------------------------ Adj R-squared = 0.9742
Total | 71112 29 2452.13793 Root MSE = 7.9494
-------------------------------------------------------------------------------
weight | Coef. Std. Err. t P>|t| [95% Conf. Interval]
--------------+----------------------------------------------------------------
diet |
2 | -172.5639 41.40619 -4.17 0.000 -258.0221 -87.10574
3 | -132.6675 38.78455 -3.42 0.002 -212.7149 -52.62011
|
height | -.3768309 .4586553 -0.82 0.419 -1.323449 .5697872
|
diet#c.height |
2 | 2.472703 .6486366 3.81 0.001 1.133983 3.811423
3 | 3.566558 .6131609 5.82 0.000 2.301056 4.83206
|
_cons | 170.1664 29.2786 5.81 0.000 109.7384 230.5945
-------------------------------------------------------------------------------
The diet*height (coded as _Idi2Xhe and _Idi3Xhe) effect is indeed significant, indicating that the
slopes do differ across the three diet groups.
contrast diet#c.height
Contrasts of marginal linear predictions
Margins : asbalanced
-------------------------------------------------
| df F P>F
--------------+----------------------------------
diet#c.height | 2 17.29 0.0000
|
Residual | 24
-------------------------------------------------
regress weight i.diet##c.height
Source | SS df MS Number of obs = 30
-------------+------------------------------ F( 5, 24) = 220.26
Model | 69595.3546 5 13919.0709 Prob > F = 0.0000
Residual | 1516.64536 24 63.1935565 R-squared = 0.9787
-------------+------------------------------ Adj R-squared = 0.9742
Total | 71112 29 2452.13793 Root MSE = 7.9494
-------------------------------------------------------------------------------
weight | Coef. Std. Err. t P>|t| [95% Conf. Interval]
--------------+----------------------------------------------------------------
diet |
2 | -172.5639 41.40619 -4.17 0.000 -258.0221 -87.10574
3 | -132.6675 38.78455 -3.42 0.002 -212.7149 -52.62011
|
height | -.3768309 .4586553 -0.82 0.419 -1.323449 .5697872
|
diet#c.height |
2 | 2.472703 .6486366 3.81 0.001 1.133983 3.811423
3 | 3.566558 .6131609 5.82 0.000 2.301056 4.83206
|
_cons | 170.1664 29.2786 5.81 0.000 109.7384 230.5945
-------------------------------------------------------------------------------
* diet 1 vs. 2 at height=59, 64, 68
* diet 1 & diet 2 vs 3 at height=59 64 68
margins j.diet, at(height=(59 64 68)) vsquish
Contrasts of adjusted predictions
Model VCE : OLS
Expression : Linear prediction, predict()
1._at : height = 59
2._at : height = 64
3._at : height = 68
------------------------------------------------
| df chi2 P>chi2
-------------+----------------------------------
diet@_at |
(2 vs 1) 1 | 1 33.03 0.0000
(2 vs 1) 2 | 1 16.12 0.0001
(2 vs 1) 3 | 1 0.94 0.3323
(3 vs <3) 1 | 1 619.28 0.0000
(3 vs <3) 2 | 1 1052.30 0.0000
(3 vs <3) 3 | 1 735.06 0.0000
Joint | 4 1090.49 0.0000
------------------------------------------------
--------------------------------------------------------------
| Delta-method
| Contrast Std. Err. [95% Conf. Interval]
-------------+------------------------------------------------
diet@_at |
(2 vs 1) 1 | -26.67443 4.641266 -35.77115 -17.57772
(2 vs 1) 2 | -14.31092 3.564552 -21.29731 -7.324526
(2 vs 1) 3 | -4.420107 4.558951 -13.35549 4.515273
(3 vs <3) 1 | 91.09667 3.660663 83.9219 98.27143
(3 vs <3) 2 | 102.7477 3.167398 96.53971 108.9557
(3 vs <3) 3 | 112.0685 4.133546 103.9669 120.1701
--------------------------------------------------------------
To conduct the next six tests, which request
the predicted value of weight for people on diet 1 at each height and the weight for people on diet
2 at each height, you will need to provide the equation to be used. To do this,
you first need to include the constant (which is called _cons in Stata).
Next, you need to multiply the variable by the value shown in the output from
the tablist. You will also need to multiply the variable height
by the current height. Hence, for the first test, you would multiply _Idiet_1
and _Idiet_2 by the values from the first row of the tablist
output (because we are looking at the weights of people on diet 1), and you
would multiply the variable height and the height*diet interaction
(i.e., the variable called _Idi2Xhe) by 59 because we are looking
only at people who are 59 inches tall. The other five lincom commands
are constructed using the same logic.
margins, at(diet=(1 2) height=(59 64 68)) vsquish
Adjusted predictions Number of obs = 30
Model VCE : OLS
Expression : Linear prediction, predict()
1._at : diet = 1
height = 59
2._at : diet = 1
height = 64
3._at : diet = 1
height = 68
4._at : diet = 2
height = 59
5._at : diet = 2
height = 64
6._at : diet = 2
height = 68
------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_at |
1 | 147.9334 3.28187 45.08 0.000 141.5011 154.3658
2 | 146.0493 2.520519 57.94 0.000 141.1091 150.9894
3 | 144.5419 3.223665 44.84 0.000 138.2237 150.8602
4 | 121.259 3.28187 36.95 0.000 114.8266 127.6913
5 | 131.7383 2.520519 52.27 0.000 126.7982 136.6785
6 | 140.1218 3.223665 43.47 0.000 133.8036 146.4401
------------------------------------------------------------------------------
Focusing on the comparison of diets 1 and 2, these results indicate
a significant difference between diet 1 and diet 2 for those 59 inches tall
(t=-5.75, p < .0001) and a significant difference for those 64 inches tall
(t=-4.01, p=0.0005). For those who are tall (i.e., 68 inches), diet 1 and diet 2 are about equally effective.
This corresponds with what we saw in figure 2.
* weight for (diet 1+diet2) / 2 at height=59, 64, 68
estimates store m1
margins, at(diet=(1 2) height=(59 64 68)) vsquish post
Adjusted predictions Number of obs = 30
Model VCE : OLS
Expression : Linear prediction, predict()
1._at : diet = 1
height = 59
2._at : diet = 1
height = 64
3._at : diet = 1
height = 68
4._at : diet = 2
height = 59
5._at : diet = 2
height = 64
6._at : diet = 2
height = 68
------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_at |
1 | 147.9334 3.28187 45.08 0.000 141.5011 154.3658
2 | 146.0493 2.520519 57.94 0.000 141.1091 150.9894
3 | 144.5419 3.223665 44.84 0.000 138.2237 150.8602
4 | 121.259 3.28187 36.95 0.000 114.8266 127.6913
5 | 131.7383 2.520519 52.27 0.000 126.7982 136.6785
6 | 140.1218 3.223665 43.47 0.000 133.8036 146.4401
------------------------------------------------------------------------------
lincom (1._at + 4._at)/2
( 1) .5*1bn._at + .5*4._at = 0
------------------------------------------------------------------------------
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | 134.5962 2.320633 58.00 0.000 130.0478 139.1446
------------------------------------------------------------------------------
lincom (2._at + 5._at)/2
( 1) .5*2._at + .5*5._at = 0
------------------------------------------------------------------------------
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | 138.8938 1.782276 77.93 0.000 135.4006 142.387
------------------------------------------------------------------------------
lincom (3._at + 6._at)/2
( 1) .5*3._at + .5*6._at = 0
------------------------------------------------------------------------------
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | 142.3319 2.279475 62.44 0.000 137.8642 146.7996
------------------------------------------------------------------------------
estimates restore m1
* weight for diet3 at height=59, 64, 68
margins, at(diet=3 height=(59 64 58)) vsquish
Adjusted predictions Number of obs = 30
Model VCE : OLS
Expression : Linear prediction, predict()
1._at : diet = 3
height = 59
2._at : diet = 3
height = 64
3._at : diet = 3
height = 58
------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_at |
1 | 225.6929 2.831098 79.72 0.000 220.144 231.2417
2 | 241.6415 2.618378 92.29 0.000 236.5096 246.7734
3 | 222.5031 3.03983 73.20 0.000 216.5452 228.4611
------------------------------------------------------------------------------
The output indicates the difference
in weight between diet groups 1 and 2 combined and the control group is
-91.09666 pounds at 59
inches, and this difference is significant. We could obtain that difference by
taking 134.59 (the average for diet groups 1 and 2 at 59 inches) minus 225.69 (the
average for diet group 3 at 59 inches). Likewise, the difference between diet groups 1 and 2 versus
diet group 3 is significant at 64 inches (with a difference of -102.7477 pounds) and at
68 inches (with a difference of -112.0685 pounds). Despite the interaction, the
control group (diet 3) always weighs more than the two diet groups combined.
This is consistent with what we saw in figure 2.
margins diet, dydx(height)
Average marginal effects Number of obs = 30
Model VCE : OLS
Expression : Linear prediction, predict()
dy/dx w.r.t. : height
------------------------------------------------------------------------------
| Delta-method
| dy/dx Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
height |
diet |
1 | -.3768309 .4586553 -0.82 0.411 -1.275779 .522117
2 | 2.095872 .4586553 4.57 0.000 1.196924 2.99482
3 | 3.189727 .4069417 7.84 0.000 2.392136 3.987319
------------------------------------------------------------------------------
margins a.diet, dydx(height)
Contrasts of average marginal effects
Model VCE : OLS
Expression : Linear prediction, predict()
dy/dx w.r.t. : height
------------------------------------------------
| df chi2 P>chi2
-------------+----------------------------------
height |
diet |
(1 vs 2) | 1 14.53 0.0001
(2 vs 3) | 1 3.18 0.0744
Joint | 2 34.58 0.0000
------------------------------------------------
--------------------------------------------------------------
| Contrast Delta-method
| dy/dx Std. Err. [95% Conf. Interval]
-------------+------------------------------------------------
height |
diet |
(1 vs 2) | -2.472703 .6486366 -3.744007 -1.201399
(2 vs 3) | -1.093855 .6131609 -2.295629 .1079179
--------------------------------------------------------------
As we expected, the test comparing the slopes of diet group 1 versus 2 and 3 was
significant, and the test comparing the slopes for diet groups 2 versus 3 was not significant.
Because the slopes for diet groups 2 and 3 do not significantly differ, we can simplify our
model by including one slope for diet group 1, and one combined slope for diet
groups 2 and 3. This model has two benefits: 1) The estimate of the
slope for diet groups 2 and 3 will be more stable (because it is based on
more cases) than slopes computed separately. Second, as we will
see later, comparisons between diet groups 2 and 3 are greatly simplified
since they will have a common slope.The diet23 variable has been created successfully.gen diet1 = 1 if diet == 1 replace diet1 = 0 if inlist(diet,2,3) tab2 diet diet1
-> tabulation of diet by diet1
| diet1
diet | 0 1 | Total
-----------+----------------------+----------
1 | 0 10 | 10
2 | 10 0 | 10
3 | 10 0 | 10
-----------+----------------------+----------
Total | 20 10 | 30
Now, we can use diet23 in our model. The variable diet
(i.e., the variables _Idiet_1 and _Idiet_2) is included to indicate the mean differences among the
three different diet groups, and diet23*height is used to indicate that we want to estimate
two slopes.Notice that diet has 2 df (since it has three levels) but the interaction of diet23*height has only 1 df (since diet23 has only two levels), whereas in section 4 the diet*height interaction had 2 df (since diet has three levels).* generate coding scheme for diet using user defined coding char diet[user] (1 -1 0\0 1 -1) xi3 u.diet u.diet _Idiet_1-3 (naturally coded; _Idiet_3 omitted) * create 2 level diet 1 vs 23 by height interaction gen dt1ht = diet1*height * run regression with diet height diet1vs23*height regress weight _Idiet_1 _Idiet_2 height dt1ht
Source | SS df MS Number of obs = 30
-------------+------------------------------ F( 4, 25) = 252.49
Model | 69394.24 4 17348.56 Prob > F = 0.0000
Residual | 1717.75999 25 68.7103995 R-squared = 0.9758
-------------+------------------------------ Adj R-squared = 0.9720
Total | 71112.00 29 2452.13793 Root MSE = 8.2892
------------------------------------------------------------------------------
weight | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_Idiet_1 | 211.49 36.69425 5.76 0.000 135.9168 287.0632
_Idiet_2 | -108.7911 3.73357 -29.14 0.000 -116.4805 -101.1017
height | 2.707918 .3174089 8.53 0.000 2.054202 3.361634
dt1ht | -3.084749 .5740018 -5.37 0.000 -4.266928 -1.90257
_cons | 65.43679 16.80021 3.89 0.001 30.83611 100.0375
------------------------------------------------------------------------------
lincom _Idiet_1 + 59* dt1ht
( 1) _Idiet_1 + 59.0 dt1ht = 0.0
------------------------------------------------------------------------------
weight | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | 29.48984 4.551245 6.48 0.000 20.11637 38.8633
------------------------------------------------------------------------------
lincom _Idiet_1 + 64* dt1ht
( 1) _Idiet_1 + 64.0 dt1ht = 0.0
------------------------------------------------------------------------------
weight | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | 14.06609 3.714135 3.79 0.001 6.416691 21.7155
------------------------------------------------------------------------------
lincom _Idiet_1 + 68* dt1ht
( 1) _Idiet_1 + 68.0 dt1ht = 0.0
------------------------------------------------------------------------------
weight | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | 1.727099 4.485619 0.39 0.703 -7.511207 10.9654
------------------------------------------------------------------------------
tablist diet _Idiet_1 _Idiet_2
diet _Idiet_1 _Idiet_2 Freq
1 .6666667 .3333333 10
2 -.3333333 .3333333 10
3 -.3333333 -.6666667 10
* weight for diet 1 at height=59, 64, 68
lincom _cons + .6667* _Idiet_1 + .3333* _Idiet_2 + 59* height + (1*59)*dt1ht
( 1) .6667 _Idiet_1 + .3333 _Idiet_2 + 59.0 height + 59.0 dt1ht + _cons = 0.0
------------------------------------------------------------------------------
weight | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | 147.9441 3.422846 43.22 0.000 140.8946 154.9936
------------------------------------------------------------------------------
lincom _cons + .6667* _Idiet_1 + .3333* _Idiet_2 + 64* height + (1*64)*dt1ht
( 1) .6667 _Idiet_1 + .3333 _Idiet_2 + 64.0 height + 64.0 dt1ht + _cons = 0.0
------------------------------------------------------------------------------
weight | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | 146.0599 2.628252 55.57 0.000 140.647 151.4729
------------------------------------------------------------------------------
lincom _cons + .6667* _Idiet_1 + .3333* _Idiet_2 + 68* height + (1*68)*dt1ht
( 1) .6667 _Idiet_1 + .3333 _Idiet_2 + 68.0 height + 68.0 dt1ht + _cons = 0.0
------------------------------------------------------------------------------
weight | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | 144.5526 3.360869 43.01 0.000 137.6308 151.4745
------------------------------------------------------------------------------
* weight for diet 2 at height=59, 64, 68
lincom _cons + -.3333* _Idiet_1 + .3333* _Idiet_2 + 59* height + (0*59)*dt1ht
( 1) - .3333 _Idiet_1 + .3333 _Idiet_2 + 59.0 height + _cons = 0.0
------------------------------------------------------------------------------
weight | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | 118.4543 2.999992 39.48 0.000 112.2757 124.6329
------------------------------------------------------------------------------
lincom _cons + -.3333* _Idiet_1 + .3333* _Idiet_2 + 64* height + (0*59)*dt1ht
( 1) - .3333 _Idiet_1 + .3333 _Idiet_2 + 64.0 height + _cons = 0.0
------------------------------------------------------------------------------
weight | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | 131.9938 2.624199 50.30 0.000 126.5892 137.3985
------------------------------------------------------------------------------
lincom _cons + -.3333* _Idiet_1 + .3333* _Idiet_2 + 68* height + (0*59)*dt1ht
( 1) - .3333 _Idiet_1 + .3333 _Idiet_2 + 68.0 height + _cons = 0.0
------------------------------------------------------------------------------
weight | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | 142.8255 2.970275 48.08 0.000 136.7081 148.9429
------------------------------------------------------------------------------
We can compare the results here with those of section
5.1 (which also compared groups 1 and 2, but estimated separate slopes for
all three groups). We see that the results are quite consistent, i.e., the
difference between diet groups 1 and 2 are different at 59 inches, 64 inches,
but not at 68 inches.
lincom _Idiet_2 + 63.13*height
( 1) _Idiet_2 + 63.13 height = 0.0
------------------------------------------------------------------------------
weight | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | 62.15977 19.94124 3.12 0.005 21.09002 103.2295
------------------------------------------------------------------------------
lincom _cons + -.3333* _Idiet_1 + .3333* _Idiet_2 + 63.13* height + (0*63.13)*dt1ht
( 1) - .3333 _Idiet_1 + .3333 _Idiet_2 + 63.13 height + _cons = 0.0
------------------------------------------------------------------------------
weight | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | 129.638 2.625295 49.38 0.000 124.2311 135.0449
------------------------------------------------------------------------------
lincom _cons + -.3333* _Idiet_1 + -.6667* _Idiet_2 + 63.13* height + (0*63.13)*dt1ht
( 1) - .3333 _Idiet_1 - .6667 _Idiet_2 + 63.13 height + _cons = 0.0
------------------------------------------------------------------------------
weight | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | 238.429 2.638 90.38 0.000 232.996 243.8621
------------------------------------------------------------------------------
The comparison of diets 2 and 3 is significant, and this holds true across all
levels of height. Those in diet group 2 weighed about 108.8 pounds less
than those in diet group 3. For those of average height, the adjusted
mean for diet 2 was 129.6 and for diet 3 was 238.4 (and 129.6 - 238.4 =
-108.8).UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services