Note:
- The means in the hypotheses should be ordered alphabetically (to best match what R does by default).
- Note all HA are “not equals” for a 2-sample t-test (and these exercises were examples of that). In this exercise the goal was to determine if the homemade compost had less germinated flowers. As the label for homemade was alphabetically second the HA is a “greater than” (i.e., bought-homemade would be positive numbers if homemade was smaller).
- Make sure to define your parameters in Step 2.
- Make sure to describe your evidence in Step 3 for why you are performing a 2-sample t-test. It is not adequate to simply say “because there is a quantitative response variable, two groups are being tested, and the groups are independent.” At least say what the response variable is and what the two groups are and provide some discussion for why you think the groups are independent.
- Also make sure to describe your evidence in Step 5 for why the assumptions are met. It is not adequate to simply say “n1+n2≥40” or “n1+n2≥15 and the sample distributions are not strongly skewed.” You should state the actual n1+n2 value and direct the reader to how you know the distributions are not strongly skewed (i.e., likely to histograms).
- In hand calculations, note that the test statistic (t in Step 7) is NOT the critical value (i.e., t*) needed for the confidence region (in Step 11).
-
If your p-value is greater that about 0.7, especially if it is very close to 1, then it very likely is NOT correct. The most common reason for this is that you shaded the wrong way (e.g., you included
lower.tail=FALSE
when you should not have, or vice versa). The only exception to this general rule is for Levene’s Test, which often has fairly large p-values. - Note the use of “mean” in both Steps 10 and 11. The test is for mean number of plants that germinated, not number of plants that germinated.
- You values may differ slightly from mine as I calculate everything in R which holds many decimal places on intermediate values.
Compost Type and Germination Rates
- α = 0.01.
- HA: μb-μh > 0 and H0: μb-μh = 0, where μ is the mean number of germinated plants, b is the bought compost, and h is the homemade compost.
- 2-sample t-test because (i) two groups/populations are considered (bought and homemade compost), (ii) a quantitative variable (number germinated) was recorded, and (iii) individuals in the groups are independent (there is no known connection between all pairs of containers with bought and homemade compost).
- An experimental study was conducted without obvious random selection of the containers with soil, but with random allocation (placement of containers in the greenhouse).
- The assumptions are met because (i) the samples are independent (as described above), (ii) nb+nh = 18+10 = 28 > 15 and the two sample distributions (shown on the handout) are not obviously strongly skewed, and (iii) the variances appear to be equal (Levene’s p-value = 0.2414 > α).
- x̄b-x̄h = 42.67-28.9 = 13.77. The pooled sample variance is, \[s_{p}^{2}=\frac{(18-1)4.33^{2}+(10-1)3.21^{2}}{18+10-2} = 15.826 \] The standard error of the statistic is, \[ SE_{\bar{x}_{did}-\bar{x}_{didnot}}=\sqrt{15.826\left(\frac{1}{18}+\frac{1}{10} \right)} = 1.569 \]
- t = \(\frac{13.77}{1.569}\)=8.776 with 26 df.
- p-value<0.00005 (more specifically 1.492e-09).
- Reject H0 because the p-value < α.
- It appears that the the mean number of plants that germinate is significantly lower for the homemade than the bought compost. Thus, the homemade compost “performs” worse than the store bought compost and may lead to increased costs for the greenhouse.
- I am 99% confident that the mean number of plants that germinated with the bought compost is at least 13.77-2.479*1.569=9.88 plants greater than the mean number of plants that germinated with the homemade compost. This further supports that the mean number of plants that germinated is greater in the store bought compost.
R Appendix.
xbar1 <- 42.67; s1 <- 4.33; n1 <- 18
xbar2 <- 28.90; s2 <- 3.21; n2 <- 10
df <- n1+n2-2
( sp2 <- ((n1-1)*(s1^2)+(n2-1)*(s2^2))/df )
( se <- sqrt(sp2*(1/n1+1/n2)) )
( stat <- xbar1-xbar2 )
( t <- stat/se )
( pv <- distrib(t,distrib="t",df=df,lower.tail=FALSE) )
( tstar <- distrib(0.99,type="q",distrib="t",df=df,lower.tail=FALSE) )
( lcb <- stat+tstar*se )
Commitment to Animals
- α=0.01.
- H0:μdid=μdidnot (or μdid-μdidnot=0) and HA is μdid>μdidnot (or μdid-μdidnot>0), where μ is the mean commitment level, “did” corresponds to the “did evacuate” group, and “didnot” corresponds to the “did not evacuate” group.
- A two-sample t-test is required because a quantitative response variable (commitment level score) was measured on two groups (“did evacuate” and “did not evacuate”) that were independent (no connection between individuals that did and those that did not evacuate their pets).
- The data appear to be part of a voluntary response observational study without clear randomization.
- The assumptions are met because the two groups appear to be independent (as stated above), the sample size (ndid+ndidnot=241) is ≥40 and the variances between groups appears to be equal (Levene’s test p-value of 0.678 is greater than α=0.01). Therefore, the test statistic computed below should reasonably follow a t-distribution with ndid+ndidnot-2=239 df.
- The statistic is x̄did-x̄didnot = 7.694-6.640 = 1.054. The pooled sample variance is, \[s_{p}^{2}=\frac{(116-1)3.410^{2}+(125-1)3.102^{2}}{116+125-2} = 10.58749 \] The standard error of the statistic is, \[ SE_{\bar{x}_{did}-\bar{x}_{didnot}}=\sqrt{10.58749\left(\frac{1}{116}+\frac{1}{125} \right)} = 0.4194894 \]
- The t test statistic is \(\frac{1.054-0}{0.4194894}\)=2.513 with 116+125-2=239 df.
- The p-value is 0.0063.
- The H0 is rejected because the p-value < α.
- The average commitment to animals was significantly greater for those people that did evacuate their pets as compared to those people that did not evacuate their pets.
- One is 99% confident that the mean level of commitment for those that evacuated their pets is at least 1.054-2.342*0.419=0.072 greater than those that did not evacuate their pets. This further supports that average commitment to animals was significantly greater for those people that did evacuate their pets as compared to those people that did not evacuate their pets.
R Appendix.
xbar1 <- 7.694; s1 <- 3.410; n1 <- 116
xbar2 <- 6.640; s2 <- 3.102; n2 <- 125
df <- n1+n2-2
( sp2 <- ((n1-1)*(s1^2)+(n2-1)*(s2^2))/df )
( se <- sqrt(sp2*(1/n1+1/n2)) )
( stat <- xbar1-xbar2 )
( t <- stat/se )
( pv <- distrib(t,distrib="t",df=df,lower.tail=FALSE) )
( tstar <- distrib(0.99,type="q",distrib="t",df=df,lower.tail=FALSE) )
( lcb <- stat+tstar*se )