This is an analysis of the ToothGrowth dataset on guinea pigs available in the R standard installation. We first do a summary and exploratory analysis to see what the data includes. We then perform some statistical inference with confidence intervals and hypothesis testing to see which dose and supplement of vitamin C is more efficient in tooth growth. Assumptions are made to state our conclusions. We can state that orange juice is the better supplement for tooth growth in two of the three dosages. However for the highest dose, we cannot see any advantage of orange juice over ascorbic acid. In general, tooth growth increases with dose.
We first look at the structure of the dataset.
## data.table 1.9.4 For help type: ?data.table ## *** NB: by=.EACHI is now explicit. See README to restore previous behaviour.
## 'data.frame': 60 obs. of 3 variables: ## $ len : num 4.2 11.5 7.3 5.8 6.4 10 11.2 11.2 5.2 7 ... ## $ supp: Factor w/ 2 levels "OJ","VC": 2 2 2 2 2 2 2 2 2 2 ... ## $ dose: num 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 ...
As can be seen, there are 60 observations of guinea pigs (6 groups of 10 each) with the following attributes:
len: tooth length
supp: supplement type (OJ=orange juice, VC=ascorbic acid)
dose: dose in milligrams of 0.5, 1.0 or 2.0
We then look at a summary of various model fitting functions.
## len supp dose ## Min. : 4.20 OJ:30 Min. :0.500 ## 1st Qu.:13.07 VC:30 1st Qu.:0.500 ## Median :19.25 Median :1.000 ## Mean :18.81 Mean :1.167 ## 3rd Qu.:25.27 3rd Qu.:2.000 ## Max. :33.90 Max. :2.000
The dataset is split equally with the supplement type (30 observations each) and dose (20 observations each). Therefore, for each dose, 10 guinea pigs were given orange juice and another 10 guinea pigs were given ascorbic acid.
Exploratory Data Analysis
A visual representation of the data helps us understand the efficacy of each dose and supplement type before doing the testing.
For doses of 0.5mg and 1.0mg, orange juice appears to help tooth growth more than ascorbic acid. However in the case of a dose of 2.0mg, there does not appear to be one supplement that is better than the other. Also, for either supplement type, we see that tooth growth increases with dose.
Hypothesis Testing and Confidence Intervals
Some basic statistical inference is performed to determine the 95% confidence intervals and test our hypothesis. We perform Welch two sample t-tests for each of the three doses to retrieve relevant inference data.
We state our hypotheses below.
Null Hypothesis (\(H_0\)): There is no difference in the mean for each supplement type and therefore orange juice and ascorbic acid have the same effect on tooth growth.
Alternative Hypothesis (\(H_a\)): There is a difference in the mean for each supplement type and therefore orange juice and ascorbic acid do not have the same effect on tooth growth.
Below are the results. We test our null hypothesis for each dose. Also, we calculate the lower and upper endpoints of the 95% confidence intervals.
|Dosage (Orange Juice – Ascorbic Acid)||Lower Endpoint||Upper Endpoint||P-Value||\(H_0\)|
We use a p-value cutoff of 0.05 or 5% to determine whether our null hypothesis (\(H_0\)) is rejected or not. If \(p<0.05\), we reject our null hypothesis. Our hypothesis test results agree with the exploratory plot shown earlier. For doses of 0.5mg and 1.0mg, there was a difference in the tooth growth for each supplement type (reject \(H_0\)) and at 2.0mg it was not noticeable and no decision can be made on which supplement is more effective (don't reject \(H_0\)).
The 95% confidence intervals give us an idea of how the difference in the population means of tooth growth for each supplement type by dose will vary from the samples. Notice that when performing the t-tests we subtracted the means in the order of orange juice – ascorbic acid. For doses of 0.5mg and 1.0mg, we can see the intervals are positive, indicating that orange juice is more effective in tooth growth. For the dose of 2.0mg, the lower and upper endpoints are very similar symmetrically, indicating the effective difference between each supplement on tooth growth is negligible.
Conclusions and Assumptions
The assumptions made are that the samples were unpaired and the variances were not equal. Our results of both the null hypothesis tests and confidence intervals agree with our exploratory data analysis plot. For doses of 0.5mg and 1.0mg, orange juice is more effective in tooth growth. For the dose of 2.0mg, neither supplement type is significantly more effective over the other on tooth growth. Supplement type aside, we can also conclude that tooth growth increases with dose.