STA 250 - Solution to assignment 2 on "s99testh" data

This is a solution to the second STA 250 assignment for Fall 2000 (PS, PDF) on the "s99testh" data set. This assignment is a continuation using formal statistical inference of the exploratory analysis done for the first assignment (PS, PDF). Note: Links like the ones in the previous sentences are to two version, one in Postscript format, the other in PDF format.

The analysis below is a bit more elaborate than I was expecting students to submit.

I began, as explained in the solution to the first assignment for this dataset, by reading in the original data, and giving names to all the variables. A stemplot for food-amount showed that the mouse with ID 201 supposedly ate an average of 11.17 grams of food per day. Since this mouse was only allowed 8 grams of food per day, this must be an error. I changed this value to "*" to indicate that its correct value is unknown.

Analysis of observations on mice allowed exercise and lots of food

I first looked only at the 20 mice that were allowed to exercise and to eat the maximum amount of food per day (10 grams), to see if in this observational data lifespan seems to be related to amount of food eaten or amount of exercise done.

The regressions of lifespan on food-amount and on ex-amount (separately) were as follows:

The regression equation is
lifespan = 688 - 40.8 food-amount

Predictor        Coef       StDev          T        P
Constant        687.6       265.2       2.59    0.018
food-amo       -40.80       53.98      -0.76    0.459

S = 223.8       R-Sq = 3.1%      R-Sq(adj) = 0.0%


The regression equation is
lifespan = 558 - 0.127 ex-amount

Predictor        Coef       StDev          T        P
Constant        557.9       102.7       5.43    0.000
ex-amoun      -0.1274      0.1701      -0.75    0.463

S = 223.9       R-Sq = 3.0%      R-Sq(adj) = 0.0%
Clearly, there is no indication of any relationship of lifespan to these variables, looked at singly, since the p-values for the tests of the null hypotheses of no relationship are quite large.

I next did a multiple regression of lifespan on both food-amount and ex-amount. The results were as follows:

The regression equation is
lifespan = 670 - 27.8 food-amount - 0.086 ex-amount

Predictor        Coef       StDev          T        P
Constant        670.2       274.4       2.44    0.026
food-amo       -27.84       62.86      -0.44    0.663
ex-amoun      -0.0856      0.1980      -0.43    0.671

S = 229.0       R-Sq = 4.1%      R-Sq(adj) = 0.0%

Analysis of Variance

Source            DF          SS          MS         F        P
Regression         2       38421       19211      0.37    0.699
Residual Error    17      891882       52464
Total             19      930304
There is no evidence of a relationship of lifespan to either food-amount, or ex-amount, or some combination of them, since the p-value of 0.699 for the F test is not significant.

The non-significant p-values for these regressions confirm the tentative conclusions from the first assignment that there is no evidence for a relationship of lifespan to food-amount or ex-amount. Since the regressions are very weak (low R-squared), the distribution of the residuals will be approximately the same as that of lifespan itself. Although lifespan does not have an exactly normal distribution, there are no extreme data points, so with 20 mice, the Central Limit Theorem should ensure that the results are close to being valid even though the residuals aren't exactly normal. (Considering whether the test is valid would in any case be more of a concern if we had found what seemed to be a statistically significant relationship.)

For the first assignment, I had concluded that there was a relationship of weight at age 200 days to food-amount, but had not seen any clear relationship to ex-amount. I checked these conclusions by doing regressions of weight200 on these variables singly, and at the same time, with the following results:

The regression equation is
weight200 = 1.55 + 4.89 food-amount

17 cases used 3 cases contain missing values

Predictor        Coef       StDev          T        P
Constant        1.551       4.598       0.34    0.741
food-amo       4.8882      0.9630       5.08    0.000

S = 3.611       R-Sq = 63.2%     R-Sq(adj) = 60.8%


The regression equation is
weight200 = 26.9 - 0.00482 ex-amount

17 cases used 3 cases contain missing values

Predictor        Coef       StDev          T        P
Constant       26.890       3.259       8.25    0.000
ex-amoun    -0.004825    0.005843      -0.83    0.422

S = 5.822       R-Sq = 4.3%      R-Sq(adj) = 0.0%


The regression equation is
weight200 = 1.53 + 6.46 food-amount - 0.0147 ex-amount

17 cases used 3 cases contain missing values

Predictor        Coef       StDev          T        P
Constant        1.534       1.406       1.09    0.294
food-amo       6.4639      0.3219      20.08    0.000
ex-amoun    -0.014663    0.001212     -12.10    0.000

S = 1.104       R-Sq = 96.8%     R-Sq(adj) = 96.3%

Analysis of Variance

Source            DF          SS          MS         F        P
Regression         2      514.40      257.20    211.07    0.000
Residual Error    14       17.06        1.22
Total             16      531.46
These results confirm that there is a relationship of weight200 to food-amount, and that there is no clear relationship of weight200 to ex-amount on its own (p-value = 0.422). However, the multiple regression shows that ex-amount does help predict lifespan when food-amount is also used as an explanatory variable. The positive coefficient for food-amount and negative coefficient for ex-amount in this regression is consistent with the idea that weight at age 200 days is influenced by whether the mouse eats more than necessary for the amount of exercise done. However, with this observational data, we cannot rule out the reverse causation - that the weight of the mouse influences how much it eats and exercises.

In the first assignment, I saw no clear relationship of lifespan to weight at age 200 days, and indeed a regression of lifespan on weight200 produces a non-significant p-value of 0.504. Perhaps the ratio of weight200/weight100 is a better indicator of whether a mouse's weight is healthy, however. I tried a regression of lifespan on weight200/weight100, and found no linear relationship. However, a quadratic regression (on both weight200/weight100 and on the square of this value) resulted in an overall p-value of 0.0578, which provides some evidence of a relationship. From the plot of the data and the fitted curve (PS, PDF), it would appear that if this relationship is indeed real, both gaining and losing a lot of weight is associated with a shorter lifespan. Since we have seen that weight may be influenced by food-amount and ex-amount, it is possible that food-amount and ex-amount do have an indirect influence on lifespan, even though we can't see such an influence with this small sample of 20 mice.

Finally, as I noted for the first assignment, the mean weight at age 100 days of the mice is clearly different for males and females, as seen from the following two-sample t-test:

Two sample T for weight100

sex          N      Mean     StDev   SE Mean
0           10     23.14      3.15       1.0
1           10     29.34      3.45       1.1

95% CI for mu (0) - mu (1): ( -9.3,  -3.1)
T-Test mu (0) = mu (1) (vs not =): T = -4.19  P = 0.0006  DF = 17
The p-value of 0.0006 is very small, indicating that we have strong evidence that the means differ, provided the assumptions underlying the test are satisfied to an adequate extent. With only 10 mice per group, it is necessary that the distribution within each group be fairly close to normal. Stemplots do not indicate any problem in this regard, and on the basis of common sense, we would not expect weight at age 100 days to have a drastically non-normal distribution.

Analysis of the full experimental data set

I began examining the full experimental data set by creating two subset worksheets, one with the 100 mice allowed exercise, the other with the 100 mice not allowed exercise. I then did a one-way ANOVA for lifespan with respect to food-allowed for each of these groups.

For the mice that were allowed exercise, the results of the ANOVA were as follows:

Current worksheet: Mice allowed exercise

One-way Analysis of Variance 

Analysis of Variance for lifespan
Source     DF        SS        MS        F        P
food-all    4     25065      6266     0.13    0.970
Error      95   4465182     47002
Total      99   4490247
                                   Individual 95% CIs For Mean
                                   Based on Pooled StDev
Level       N      Mean     StDev  -+---------+---------+---------+-----
 4         20     443.5     231.3   (------------*-------------) 
 5         20     456.0     220.8    (-------------*-------------) 
 6         20     456.0     210.5    (-------------*-------------) 
 8         20     457.7     198.8     (------------*-------------) 
10         20     490.8     221.3         (-------------*-------------) 
                                   -+---------+---------+---------+-----
Pooled StDev =    216.8           350       420       490       560
The p-value of 0.970 provides us with no reason to think that lifespan is affected by food-allowed when the mice are allowed to exercise. The sample means for the group seem to show a slight linear trend, which might show up more clearly in a regression on food-allowed than with ANOVA, since ANOVA does not regard the groups as being ordered from small to large amounts of food. However, a regression of lifespan on food-allowed also shows no evidence of a relationship (p-value = 0.507).

For the mice not allowed exercise, the results of ANOVA for lifespan with respect to food-allowed were as follows:

Current worksheet: Mice not allowed exercise

One-way Analysis of Variance

Analysis of Variance for lifespan
Source     DF        SS        MS        F        P
food-all    4    434710    108678     3.11    0.019
Error      95   3314568     34890
Total      99   3749278
                                   Individual 95% CIs For Mean
                                   Based on Pooled StDev
Level       N      Mean     StDev  ---+---------+---------+---------+---
 4         20     414.7     210.3                  (-------*--------) 
 5         20     401.3     252.7                 (-------*-------) 
 6         20     256.0     113.9  (--------*-------) 
 8         20     270.1     156.4    (-------*-------) 
10         20     309.5     170.2        (-------*-------) 
                                   ---+---------+---------+---------+---
Pooled StDev =    186.8             200       300       400       500
The p-value of 0.019 indicates that we have pretty strong reason to think that the mean lifespan for mice not allowed exercise depends on the amount of food they are allowed to eat (ie, that the means are not the same for all the groups), provided the assumptions behind ANOVA are satisfied. However, the within-group sample standard deviations vary from 113.0 to 252.7, which leads us to doubt that the ANOVA assumption that the standard deviation is the same for all groups is actually true. The violation of this assumption isn't drastic, however, so although the p-value may be a bit wrong, we can perhaps still consider that we have fairly good evidence that lifespan is related to food-allowed for mice not allowed exercise.

The difference in standard deviation between the groups might be just the result of the means differing. An equal amount of variation in percentage terms will produce more variation in absolute terms when the mean is higher. We might therefore expect the problem of unequal standard deviations to be less if we look at the logarithm of lifespan, rather than lifespan itself, since taking the logarithm makes equal percentage changes look equal regardless of the overall level. I therefore created a new column called log-lifespan, and did an ANOVA for it, with the following results:

Current worksheet: Mice not allowed exercise

One-way Analysis of Variance

Analysis of Variance for log-life
Source     DF        SS        MS        F        P
food-all    4     2.871     0.718     2.18    0.077
Error      95    31.329     0.330
Total      99    34.200
                                   Individual 95% CIs For Mean
                                   Based on Pooled StDev
Level       N      Mean     StDev  ---+---------+---------+---------+---
 4         20    5.8616    0.6390                   (---------*----------) 
 5         20    5.7884    0.6797                (----------*---------) 
 6         20    5.4479    0.4608   (---------*---------) 
 8         20    5.4540    0.5432   (---------*---------) 
10         20    5.6033    0.5208         (---------*---------) 
                                   ---+---------+---------+---------+---
Pooled StDev =   0.5743             5.25      5.50      5.75      6.00
The standard deviations for the groups are now much closer to being the same, so we can be more confident of the validity of the results. As suspected, the p-value of 0.077 is greater than before, but it is still small enough that we can take the results as providing some evidence that the means are different in different groups.

The relationship of lifespan (or log-lifespan) to food-allowed seems to be negative, but not necessarily linear. If we do a linear regression of lifespan on food-allowed anyway, we get the following result:

The regression equation is
lifespan = 456 - 19.1 food-allowed

Predictor        Coef       StDev          T        P
Constant       456.47       61.60       7.41    0.000
food-all      -19.112       8.873      -2.15    0.034

S = 191.1       R-Sq = 4.5%      R-Sq(adj) = 3.5%
Boxplots of the residuals from this regression versus food-allowed (PS, PDF) show that the residuals are more variable when food-allowed is 4 or 5 grams, and also show some indication that the relationship is not linear. Because the unequal variability of the residuals violates one of the assumptions used to arrive at the p-value of 0.034 shown above, we must be cautious about interpreting this p-value as evidence that there is a real relationship. If we do a regression of log-lifespan on food-allowed we get the following results:
The regression equation is
log-lifespan = 5.94 - 0.0467 food-allowed

Predictor        Coef       StDev          T        P
Constant       5.9392      0.1876      31.67    0.000
food-all     -0.04670     0.02702      -1.73    0.087

S = 0.5819      R-Sq = 3.0%      R-Sq(adj) = 2.0%
Boxplots of the residuals from this regression versus food-allowed (PS, PDF) show less differences in how variable the residuals are, though there is still some indication that the relationship is not linear. The p-value of 0.087 is similar to that from the ANOVA done on log-lifespan, and indicates that the evidence for a relationship is not very strong, though it is at least suggestive.

Since food-allowed was set in a randomized experiment, we can be sure that if this apparent relationship of lifespan to food-allowed is real, it is due to an actual effect of food-allowed on lifespan. In particular, it seems that lifespan may be increased in mice not allowed exercise by restricting them to only 4 or 5 grams of food per day. Clearly, however, there are many other factors that influence lifespan as well, since the fraction of the variance in lifespan explained by food-allowed is quite small.

In order to investigate the effect of allowing exercise on lifespan, I created subset worksheets for mice allowed only 4 grams of food per day, and for mice allowed 10 grams of food per day, and then did two-sample t-tests for each of these groups of mice, to see whether mean lifespan differed depending on whether exercise was allowed. I used two-sample t-tests with variances not assumed to be equal, because it seems plausible that allowing exercise increases the variance, since the actual amount of exercise will depend on each mouse's preference.

Here are the results for the mice allowed only 4 grams of food per day:

Current worksheet: Mice allowed 4g of food

Two Sample T-Test and Confidence Interval

Two sample T for lifespan

ex-allow     N      Mean     StDev   SE Mean
0           20       415       210        47
1           20       443       231        52

95% CI for mu (0) - mu (1): ( -170,  113)
T-Test mu (0) = mu (1) (vs not =): T = -0.41  P = 0.68  DF = 37
The p-value of 0.68 provides us with no reason to think that allowing exercise has any effect on lifespan for these mice.

For the mice allowed 10 grams of food per day, the results are quite different:

Current worksheet: Mice allowed 10g of food

Two Sample T-Test and Confidence Interval

Two sample T for lifespan

ex-allow     N      Mean     StDev   SE Mean
0           20       310       170        38
1           20       491       221        49

95% CI for mu (0) - mu (1): ( -308,  -55)
T-Test mu (0) = mu (1) (vs not =): T = -2.90  P = 0.0063  DF = 35
The p-value of 0.0063 is quite strong evidence that the mean lifetime is greater when exercise is allowed. The distribution of lifespan within each group is not very close to normal, but there are no really extreme values for lifespan, and with 20 mice per group, a moderate departure from normality is not crucial. Even if the p-value is slightly wrong, the evidence for a difference would still be strong.

We can therefore conclude that allowing exercise increases lifespan when mice are allowed to eat 10 grams of food, but that it has little or no effect when mice are allowed only 4 grams of food. Part of the explanation for this difference may be that mice seem to exercise less when allowed only 4 grams of food, as seen from the following two-sample t-test:

Two sample T for ex-amount

food-all     N      Mean     StDev   SE Mean
 4          20       377       199        44
10          20       527       302        68

95% CI for mu ( 4) - mu (10): ( -315,  14)
T-Test mu ( 4) = mu (10) (vs not =): T = -1.86  P = 0.072  DF = 32
The p-value of 0.072 is far from conclusive evidence for a real difference, but it does provide some evidence.

For the first assignment, I had tentatively concluded that the reason the amount of food allowed affects lifespan when the mice aren't allowed to exercise may be that the amount of food allowed affects weight, which in turn affects lifespan. The ratio of weight at age 200 days to weight at age 100 days seemed to be related to lifespan for mice not allowed exercise. A regression on a variable w200/w100 set to this ratio confirms that there is a relationship:

The regression equation is
lifespan = 1089 - 552 w200/w100

66 cases used 34 cases contain missing values

Predictor        Coef       StDev          T        P
Constant       1088.9       165.1       6.60    0.000
w200/w10       -552.2       136.2      -4.05    0.000

S = 157.9       R-Sq = 20.4%     R-Sq(adj) = 19.2%
Note that the 34 mice in the non-exercise group who died before age 200 are omitted from this regression.

I next did a multiple regression of lifespan on w200/w100 along with food-amount, food-allowed, and sex, to see if these other variables help predict lifespan once w200/w100 is known. The results were as follows:

The regression equation is
lifespan = 1090 - 709 w200/w100 + 77.2 food-amount - 12.2 food-allowed - 107 sex

65 cases used 35 cases contain missing values

Predictor        Coef       StDev          T        P
Constant       1090.3       188.7       5.78    0.000
w200/w10       -708.8       203.3      -3.49    0.001
food-amo        77.21       60.54       1.28    0.207
food-all      -12.244       9.533      -1.28    0.204
sex           -106.53       51.17      -2.08    0.042

S = 154.8       R-Sq = 27.1%     R-Sq(adj) = 22.2%

Analysis of Variance

Source            DF          SS          MS         F        P
Regression         4      534241      133560      5.57    0.001
Residual Error    60     1437900       23965
Total             64     1972141
There is no evidence that food-allowed or food-amount are useful once w200/w100 is known, even though regressions on these variables singly show some evidence of a relationship with lifespan. The sex of the mice seems like it may help predict lifespan, however, since the p-value for the test of the null hypothesis that its regression coefficient is zero is 0.042. To check this, I did another regression for lifespan on just w200/w100 and sex:
The regression equation is
lifespan = 1196 - 616 w200/w100 - 63.6 sex

66 cases used 34 cases contain missing values

Predictor        Coef       StDev          T        P
Constant       1196.0       176.7       6.77    0.000
w200/w10       -616.4       140.6      -4.38    0.000
sex            -63.58       40.21      -1.58    0.119

S = 156.1       R-Sq = 23.5%     R-Sq(adj) = 21.0%

Analysis of Variance

Source            DF          SS          MS         F        P
Regression         2      470594      235297      9.66    0.000
Residual Error    63     1534952       24364
Total             65     2005546
The p-value of 0.119 fails to confirm that sex is helpful in predicting lifespan when w200/w100 is known. Perhaps there is a weak relationship, but we don't have clear evidence of it. There is no evidence that sex on its own is related to lifespan for mice not allowed exercise (the p-value for a two-sample t-test is 0.46).

Since w200/w100 is related to lifespan, it is of interest to see if w200/w100 is influenced by food-allowed, for these mice that weren't allowed exercise. Here is an ANOVA for w200/w100 with respect to food-allowed:

Analysis of Variance for w200/w10
Source     DF        SS        MS        F        P
food-all    4    0.5526    0.1381    10.66    0.000
Error      61    0.7908    0.0130
Total      65    1.3434
                                   Individual 95% CIs For Mean
                                   Based on Pooled StDev
Level       N      Mean     StDev  ----+---------+---------+---------+--
 4         14    1.0276    0.1375   (-----*-----) 
 5         14    1.2377    0.1104                        (-----*-----) 
 6         13    1.2577    0.1036                         (------*-----) 
 8         11    1.2552    0.0953                         (------*-----) 
10         14    1.2537    0.1132                         (-----*-----) 
                                   ----+---------+---------+---------+--
Pooled StDev =   0.1139              1.00      1.10      1.20      1.30
There is very strong evidence that food-allowed has an effect on w200/w100, though it may be that the only difference is between the group allowed only 4 grams of food per day and the groups allowed 5 grams or more.

For mice not allowed exercise, we have seen that we have fairly good evidence that food-allowed affects lifespan, and the relationships of food-allowed to weight200/weight100 and of weight200/weight100 to lifespan suggest that the reason for the relationship of food-allowed to lifespan is that food-allowed affects the weight of the mice.

An ANOVA for w200/w100 with respect to food-allowed for mice that were allowed to exercise shows that food-allowed affects weight for these mice too:

Analysis of Variance for w200/w10
Source     DF        SS        MS        F        P
food-all    4    0.6447    0.1612    10.65    0.000
Error      81    1.2258    0.0151
Total      85    1.8705
                                   Individual 95% CIs For Mean
                                   Based on Pooled StDev
Level       N      Mean     StDev  ---------+---------+---------+-------
 4         16    0.7934    0.0749  (----*----) 
 5         16    0.8955    0.0906           (----*----) 
 6         18    1.0633    0.1504                         (----*---) 
 8         19    0.9480    0.1467               (----*----) 
10         17    0.9391    0.1243              (----*----) 
                                   ---------+---------+---------+-------
Pooled StDev =   0.1230                   0.84      0.96      1.08
The standard deviations for the groups vary by up to a factor of two, but the p-value for the F test is so small that even if it is off by a bit because the assumption of equal variances isn't satisfied, the evidence for a relationship would still be strong. It is not clear, however, whether the apparent maximum for 6 grams of food per day is real, or might just be chance variation. It does seem clear than restricting food to only 4 grams per day reduces weight. Note that the confidence intervals for the mean of weight200/weight100 for the mice allowed exercise are all substantially below the corresponding intervals for mice not allowed exercise.

For the first assignment, I had not seen any clear relationship of lifespan to weight200/weight100 for the mice allowed exercise, when judging just by eye. A quadratic regression (of lifespan on both weight200/weight100 and its square) does show a relationship, however:

Polynomial Regression

Y = -1564.14 + 4207.98X - 2070.09X**2
R-Sq = 9.2 %                         

Analysis of Variance

SOURCE            DF        SS        MS         F         P
Regression         2    250423    125211   4.22928  1.78E-02
Error             83   2457281     29606                    
Total             85   2707703                              

SOURCE      DF    Seq SS         F         P
Linear       1     27304  0.855671  0.357603
Quadratic    1    223119   7.53631  7.41E-03
The p-value for the F test is 0.0178, showing good evidence that there is a relationship, and the p-value of 0.00741 for the t-test of the null hypothesis that the coefficient of the quadratic term is zero shows that this relationship does not follow a straight line. The scatterplot and plot of the regression curve (PS, PDF) show that lifespan appears to be less for mice that either gain or lose a lot of weight, which is what one might have expected.

A similar quadratic regression of lifespan on weight200/weight100 for all mice (except those who died before age 200 days) produces a similar plot (PS, PDF), and similar coefficients:

Polynomial Regression

Y = -1198.46 + 3541.67X - 1791.07X**2
R-Sq = 17.3 %                        

Analysis of Variance

SOURCE            DF        SS        MS         F         P
Regression         2    867258    433629   15.5718  7.22E-07
Error            149   4149199     27847                    
Total            151   5016457                              


SOURCE      DF    Seq SS         F         P
Linear       1    342493   10.9915  1.15E-03
Quadratic    1    524764   18.8446  2.61E-05
The standard deviation of the residuals for this regression is 166.9 (the square root of the MS for Error), which is similar to the values obtained for the other regressions for lifespan above. It seems possible that the only effect on lifespan of food-allowed and of ex-allowed is through their effects on weight.

Conclusions

In the experimental data, there is some evidence, though it is not very strong, that the amount of food allowed affects lifespan when exercise is not allowed. Specifically, there is some evidence that restricting food to only 4 or 5 grams per day increases lifespan. For mice that were allowed to exercise, there is no direct evidence of an effect of food-allowed on lifespan.

There is strong evidence that allowing mice to exercise increases their lifespan when they are allowed to eat 10 grams of food per day, but no effect was seen for mice allowed only 4 grams of food per day.

These conclusions differ from those reached when looking at only the 20 mice that were allowed to exercise and given 10 grams of food per day. For that observational data, no evidence was seen of a relationship of lifespan to food-amount or exercise amount. However, there was strong evidence of a relationship of weight at age 200 days to food-amount and ex-amount, and there there was fairly strong evidence of a relationship of the ratio of weight at age 200 to weight at age 100 to lifespan. One might on this basis have suspected that food-amount and ex-amount affect lifespan through their effect on weight, even though this indirect effect isn't strong enough to see with a sample of only 20 mice.

Further analysis of the experimental data confirmed that the amount of food allowed and whether exercise was allowed influence the ratio of weight at 200 days to weight at 100 days. This ratio is in turn related to lifespan, but not linearly - lifespan is greatest when this ratio is around one (ie, for mice that neither gained nor lost weight). It may be that the only way that diet and exercise influence lifespan is through their influence on weight, since there was no evidence that these or other variables helped predict lifespan when they were added to a regression model that included weight200/weight100. Note, however, that many other factors must influence lifespan, since the regression of lifespan on weight200/weight100 explains only 17% of the total variance in lifespan.