Solution to STA 250 Assignment #2 (Fall 1999), Second Data Set

Here is a model solution to Assignment #2 (Postscript, PDF), for one particular set of data (and here is another). This solution continues with the analysis of this data set from where the solution to Assignment #1 left off. The analysis below assumes that the data has been cleaned up as in Assignment #1, and that new Minitab columns have been created as described there. Some new columns were created for this assignment. You can view the final version of the worksheet with all the new columns in Postscript or PDF.

The discussion below is interspersed with portions of Minitab output. There are also links to a few plots, in Postscript or PDF formats. The Postscript is best viewed on CQUEST by choosing "0.707" from the "1.000" menu.

Effect of grain on illness

To address the question of whether feeding any grain (even a small amount) causes illness, I did a two-sample t-test comparing the days of illness for the 8 animals fed no grain with the days of illness for the 8 animals fed 0.5kg of grain. To do this, I created a new column called 'test1' set to '1' for the animals fed no grain, '2' for the animals fed 0.5kg of grain, and '*' for the animals fed more than 0.5kg of grain. The two groups can then be compared with the twot command, as follows (with the other animals being ignored):
MTB > twot 'ill-alive' 'test1'

Two Sample T-Test and Confidence Interval

Two sample T for ill-alive

test1       N      Mean     StDev   SE Mean
1           7      3.29      1.25      0.47
2           8     16.12      4.88       1.7

95% CI for mu (1) - mu (2): ( -16.97,  -8.7)
T-Test mu (1) = mu (2) (vs not =): T = -7.17  P = 0.0001  DF = 8
One animal fed 0kg of grain was recorded as being ill for 118 days, which is impossible, since the experiment ran for only 100 days. This value was hence marked as unknown, leaving only 7 animals in that group.

The two-sided p-value of 0.0001 is strong evidence that the means of the two groups differ. This is a valid conclusion only if the assumptions behind the t-test are close to being correct, however. These assumptions are that the observations are independent, and that they are normally distributed.

The independence assumption cannot be checked by looking at the data. One would have to ask the experimenters whether things like contagious diseases might have lead to a substantial degree of dependence between the days of illness for different animals.

The normality assumption can be checked by looking at stemplots for the two groups:

MTB > stem 'ill-alive';
SUBC> by 'test1'.

Character Stem-and-Leaf Display

Stem-and-leaf of ill-aliv  test1 = 1       N  = 7
Leaf Unit = 1.0                            N* = 1


   (6)   0 133344
    1    0 5


Stem-and-leaf of ill-aliv  test1 = 2       N  = 8
Leaf Unit = 1.0


    3    1 001
   (2)   1 89
    3    2 001
There is no reason to suspect non-normality from these plots, though common sense would indicate that at least once in a while an animal will be sick for many days, so the distributions must be skewed to the right at least somewhat.

There is therefore no strong reason to doubt that the t-test is valid, though problems are possible. We have pretty good reason to believe that feeding 0.5kg of grain a day does cause an increase in illness compared to feeding no grain.

I did another t-test to address the question of whether feeding lots of grain (1.5kg or 2.0kg) causes illness, compared to feeding a smaller amount of grain (0.5kg or 1.0kg). For this test, I created a column called 'test2', set to '1' for the 16 animals fed 0.5kg or 1.0kg of grain, to '2' for the 11 animals fed 1.5kg or 2.0kg of grain who didn't die, and to '*' for the animals fed no grain. I ignored the five dead animals that were fed 2.0kg of grain because the days of illness for four of them were substantially less than for the animals in the 1.5kg and 2.0kg group who didn't die. They appear to have died early, before they had the chance to be ill for long. Including them would therefore give a misleading result. Here is the t-test comparing the days of illness for the two groups:

MTB > twot 'ill-alive' 'test2'

Two Sample T-Test and Confidence Interval

Two sample T for ill-alive

test2        N      Mean     StDev   SE Mean
1           16     15.13      4.80       1.2
2           11     22.73      4.36       1.3

95% CI for mu (1) - mu (2): ( -11.3,  -3.9)
T-Test mu (1) = mu (2) (vs not =): T = -4.27  P = 0.0003  DF = 22
The two-sided p-value of 0.0003 is strong evidence that feeding lots of grain (1.5kg or 2.0kg) leads to more illness than feeding a smaller amount of grain (0.5kg or 1.0kg), provided the assumptions behind the t-test are satisfied. As before, the independence assumption cannot be checked from the data, but we can look at stemplots to check the normality assumption:
MTB > stem 'ill-alive';
SUBC> by 'test2'.

Character Stem-and-Leaf Display

Stem-and-leaf of ill-aliv  test2 = 1       N  = 16
Leaf Unit = 1.0


    1    0 7
    7    1 000113
   (5)   1 66889
    4    2 0012


Stem-and-leaf of ill-aliv  test2 = 2       N  = 11
Leaf Unit = 1.0


    2    1 59
   (6)   2 011334
    3    2 58
    1    3 1
Again, there is not clear sign of non-normality, though the actual distribution must be at least somewhat skewed. Since the sample sizes are bigger for this test, we can be a bit more confident than for the first test that the normality assumption for the sample means is approximately satisfied.

Effect of grain on weight gain

First, I'll look again at the simple regressions that were also done for Assignment #1, this time computing confidence intervals for the slope of the regression line. The five dead animals were omitted from the analysis, though the fact that all five deaths occurred in the group fed 2.0kg of grain is cause to qualify any conclusion that feeding that amount of grain is a good idea.

Here is the regression of final weight ('ewt') on grain fed ('grain'), for the live animals:

The regression equation is
ewt-alive = 222 + 19.9 grain-alive

34 cases used 1 cases contain missing values

Predictor        Coef       StDev          T        P
Constant      221.723       6.907      32.10    0.000
grain-al       19.911       6.449       3.09    0.004

S = 24.36       R-Sq = 23.0%     R-Sq(adj) = 20.5%

Analysis of Variance

Source            DF          SS          MS         F        P
Regression         1      5655.4      5655.4      9.53    0.004
Residual Error    32     18985.7       593.3
Total             33     24641.1
One of the 35 live animals was not included, because the final weight recorded for this animal is the same as the starting weight, which appears to be a recording error. The confidence interval for the slope (the regression coefficient of 'grain') is therefore found using the t-distribution with 34-2=32 degrees of freedom. From Table D in the book, the critical value for a 95% confidence interval is about 2.04, using the value for 30 df since there is no line for 32 df. The confidence interval for the slope can therefore be computed as
(19.9 - 2.04*6.449, 19.9 + 2.04*6.449) = (6.7, 33.1)

Here is the regression of change in weight for the live animals (called 'cwt', computed as 'ewt'-'swt') on grain fed:

The regression equation is
cwt-alive = 68.6 + 22.1 grain-alive

34 cases used 1 cases contain missing values

Predictor        Coef       StDev          T        P
Constant       68.594       3.068      22.36    0.000
grain-al       22.097       2.864       7.71    0.000

S = 10.82       R-Sq = 65.0%     R-Sq(adj) = 63.9%

Analysis of Variance

Source            DF          SS          MS         F        P
Regression         1      6965.1      6965.1     59.51    0.000
Residual Error    32      3745.3       117.0
Total             33     10710.4

Unusual Observations
Obs   grain-al   cwt-aliv         Fit   StDev Fit    Residual    St Resid
 15       0.50      57.00       79.64        2.11      -22.64       -2.13R 

R denotes an observation with a large standardized residual
The confidence interval for the slope in this regression is calculated in the same way as above, with the result being
(22.1 - 2.04*2.864, 22.1 + 2.04*2.864) = (16.3, 27.9)

The true values for the slopes for these two regressions should be the same. The first represents the effect of grain on the final weight, the second the effect of grain on the change in weight. These effects could be different only if the starting weight were different for animals fed different amounts of grain. But since the animals were assigned to groups fed different amounts of grain randomly, there should be no systematic tendency for animals fed different amounts of grain to have different starting weights.

Although the estimated slopes in the two regressions are measures of the same thing (the effect of grain on weight), the second regression appears to be preferable, since it results in a smaller standard deviation for the residuals, hence a smaller standard error for the slope in the regression, and therefore a narrower confidence interval for this slope. In fact, the second confidence interval lies entirely within the first interval. This improved precision is due to the elimination of random variation due to different starting weights when we look at the change in weight rather than the final weight. When looking at males and females separately, it therefore makes sense to look at the change in weight rather than the final weight. The data for the live animals was separated according to sex using an unstack command, as follows:

MTB > unstack ('grain-alive' 'cwt-alive') ('gr-a-m' 'cwt-a-m') ('gr-a-f' 'cwt-a-f');
SUBC> subscripts 'sex-alive'.
I then did the regression for males only:
The regression equation is
cwt-a-m = 71.3 + 21.7 gr-a-m

16 cases used 1 cases contain missing values

Predictor        Coef       StDev          T        P
Constant       71.344       3.896      18.31    0.000
gr-a-m         21.695       3.866       5.61    0.000

S = 10.93       R-Sq = 69.2%     R-Sq(adj) = 67.0%

Analysis of Variance

Source            DF          SS          MS         F        P
Regression         1      3757.9      3757.9     31.48    0.000
Residual Error    14      1671.0       119.4
Total             15      5428.9
And for females only:
The regression equation is
cwt-a-f = 64.2 + 24.4 gr-a-f

Predictor        Coef       StDev          T        P
Constant       64.169       5.060      12.68    0.000
gr-a-f         24.397       4.501       5.42    0.000

S = 10.78       R-Sq = 64.7%     R-Sq(adj) = 62.5%

Analysis of Variance

Source            DF          SS          MS         F        P
Regression         1      3414.2      3414.2     29.38    0.000
Residual Error    16      1859.5       116.2
Total             17      5273.8
The regression coefficients are similar for the males and females, with the differences being small compared to the standard errors. The standard deviation of the residuals is about the same for the two separate regressions as for the combined regression. This leads me to think that there is really no difference between the males and females, but to do a formal statistical test, we need to combine these two regressions into one.

To do this, I computed the 'fgrain' column as follows:

MTB > let 'fgrain'='sex-alive'*'grain-alive'
I then did a regression of 'cwt' on 'sex', 'grain', and 'fgrain', for the live animals:
The regression equation is
cwt-alive = 71.3 - 7.17 sex-alive + 21.7 grain-alive + 2.70 fgrain

34 cases used 1 cases contain missing values

Predictor        Coef       StDev          T        P
Constant       71.344       3.869      18.44    0.000
sex-aliv       -7.175       6.395      -1.12    0.271
grain-al       21.695       3.839       5.65    0.000
fgrain          2.702       5.938       0.46    0.652

S = 10.85       R-Sq = 67.0%     R-Sq(adj) = 63.7%

Analysis of Variance

Source            DF          SS          MS         F        P
Regression         3      7179.8      2393.3     20.34    0.000
Residual Error    30      3530.5       117.7
Total             33     10710.4

Source       DF      Seq SS
sex-aliv      1         7.7
grain-al      1      7147.8
fgrain        1        24.4
The constant terms and the coefficient for 'grain' match the values found in the regression for males only, which makes sense since for males the other two terms are zero (since both 'sex' and 'fgrain' are zero for males). The constant plus the coefficient for 'sex' matches the constant found in the regression for females only, and the sum of the coefficients for 'grain' and 'fgrain' matches the coefficient of 'grain' in the regression for females only. This multiple regression therefore effectively combines the two separate regressions.

We can now test the null hypothesis that the coefficient of 'fgrain' is zero (ie, that the effect of grain is the same for males and females). Since the (two-sided) p-value is 0.652, the data give us no reason to doubt this null hypothesis - ie, we have no reason to think that there is any difference in the effect of grain on weight gain for males versus females.

Finally, I did a regression of the final weight ('ewt') on 'sex', 'grain', 'fgrain', 'swt', and 'age'. Since the starting weight ('swt') is included as an explanatory variable, it is no longer necessary to look at the change in weight rather than the final weight - the effect of random variation in 'swt' will not show up in the residual when 'swt' is an explanatory variable. (The previous technique of looking at 'ewt'-'swt' rather than 'ewt' is in fact equivalent to doing a regression for 'ewt' with 'swt' included as an explanatory variable, but with its coefficient fixed at one.) By including 'age' as an explanatory variable, variation in this variable resulting from random assignment to groups will also be removed from the residual.

Here is the result:

The regression equation is
ewt-alive = 177 - 5.40 sex-alive + 22.2 grain-alive + 3.61 fgrain
           + 1.05 swt-alive - 0.318 age-alive

33 cases used 2 cases contain missing values

Predictor        Coef       StDev          T        P
Constant       177.19       62.50       2.84    0.009
sex-aliv       -5.396       7.731      -0.70    0.491
grain-al       22.160       3.797       5.84    0.000
fgrain          3.613       5.961       0.61    0.550
swt-aliv       1.0524      0.1484       7.09    0.000
age-aliv      -0.3181      0.2044      -1.56    0.131

S = 10.70       R-Sq = 87.1%     R-Sq(adj) = 84.7%

Analysis of Variance

Source            DF          SS          MS         F        P
Regression         5     20921.0      4184.2     36.55    0.000
Residual Error    27      3091.2       114.5
Total             32     24012.2

Source       DF      Seq SS
sex-aliv      1      4937.1
grain-al      1      8884.6
fgrain        1       137.8
swt-aliv      1      6684.3
age-aliv      1       277.3
Before interpreting the results, we might ask whether the assumptions behind the p-values shown above are satisfied. One assumption is that the residuals are independent. Since the animals were assigned to groups randomly, no dependencies were introduced from this assignment. It is possible that there are dependencies arising from common factors such as the weather. The degree to which this is a worry would have to be assessed by the experimenters. The other assumption behind the computation of the p-value is that the residuals are approximately normally distributed. We can check this using a normal quantile plot. I asked Minitab to store the residuals from the above regression in a new column ('RESI1'), and then produced a normal quantile plot as follows:
MTB > nscores 'RESI1' C34
MTB > plot C34*'RESI1'
The resulting plot (Postscript, PDF) shows a good match to a normal distribution.

Looking now at the results, we see that the only variables that are clearly useful in predicting 'ewt' (assuming the other variables are available) are 'grain' and 'swt'. It is possible that other variables such as 'age' are useful, but we have no evidence of this. The p-value for testing whether the coefficient of 'age' is zero is 0.131, not enough to convince us that this coefficient isn't zero. Indeed, the negative estimate for this coefficient seems implausible, since it would imply that animals that are older at the end of the summer are likely to weight less than those that are younger. It seems more plausible that the true coefficient is zero or positive.