l11- One-Sample T-Tests and Distribution Functions in R
BIOL 209 Secrets to Success
Importance of Lecture/Lab Integration: Class labs are structured to build off the lectures from the previous week. Understanding the fundamentals taught in lectures is critical for following along in labs.
Stay Updated: Students are encouraged to use the "Mark as Completed" option on LEARN to track progress.
Time Management During Busy Periods:
Put quiz due dates in calendars with reminders.
Quizzes can be started as soon as a lab is completed; students do not need to upload a lab document.
Collaboration and Note-taking: Success is facilitated by chatting with classmates and taking thorough notes during both labs and lectures.
Interdisciplinary Connections: Students should look for links between BIOL 209 and other courses, particularly those involving field trips where these statistical applications are frequently used.
Grading Caveats: The course automatically drops the lowest quiz grade. If a student misses one week of quizzes, it will not negatively impact their final grade.
Learning Objectives: Hypothesis testing and Distribution Functions
Core Goals:
Continue practicing the comparison of observed sample values against expected values via one-sample t-tests.
Developing familiarity with R functions
pt()andqt()to navigate the t-distribution.Identifying null and alternative hypotheses, identifying the null distribution, and calculating test statistics and critical values.
Review of the One-Sample T-Test (Pipefish Example)
Scenario Recap: Samples of female pipefish from Sweden were measured to see if they were larger than a previously observed mean of .
Seven Steps of T-Testing:
Determine the Null Hypothesis ().
Determine the Alternative Hypothesis ().
Identify the Null Distribution.
Choose the Test Statistic.
Calculate the Critical Value.
Calculate the P-value.
Evaluate the statistical test.
Specific Data Provided:
Sample Mean ():
Expected Value ():
Standard Deviation ():
Sample Size ():
Manual Calculation Formulas and Procedures
Essential Formulas:
Test Statistic ():
Standard Error of the Mean (): or
Step-by-Step Calculation for the Pipefish Example:
Step 1: Calculate SEM. (Note: )
Step 2: Calculate the T-Statistic. (Round to )
Navigating the T-Distribution in R
Quantiles (qt): The
qt()function returns the value of for a given specific cumulative probability (area under the curve) and degrees of freedom ().Example:
qt(0.95, df = 26)finds the value where of the distribution lies to the left.
Probabilities (pt): The
pt()function returns the cumulative probability assigned to a specific test statistic.Critique of Quantile Selection (Pipefish Example):
Provided Quantiles ():
qt(0.95)=qt(0.975)=qt(0.05)=qt(0.025)=
Selection Logic: Since the test was one-tailed (larger than ) and the calculated () is positive, we compare it to the positive upper tail. Choosing ( quantile) allows for a significance level.
Conclusion: Since , the observed statistic is in the extreme tail, leading to the rejection of the null hypothesis.
Test Your Understanding: Code Logic and Tails
Question 1: Value of t at a dashed line where is to the left.
Answer:
qt(0.95, df). This is correct becauseqt()yields quantiles;pt()yields probabilities.
Question 2: Finding the shaded area in the upper tail for a given test statistic.
Answer:
1 - pt(test_statistic, df). Sincept()default islower.tail = TRUE(area to the left), subtracting from provides the area to the right (the upper tail).
Question 3: Critical value for a two-tailed test.
Answer:
qt(0.975, df, lower.tail = TRUE). For a two-tailed test at , we split the alpha into two tails ( each), requiring the quantile for the upper bound.
Question 4: P-value for a two-tailed test.
Answer:
(1 - pt(t_stat, df)) * 2. Because the distribution is symmetrical, we find the area in one tail and multiply by to account for both potential extreme ends.
Case Study: Fath the Golden Retriever
Observation: Fath (Golden Retriever) weighs . The researcher wants to know if he weighs more than other adult male Golden Retrievers.
Gathered Data:
Dog count () =
Sample Mean () =
Variance () =
Theta () =
Hypotheses:
: Sample mean is not different from Fath's weight ().
: Sample mean is less than Fath's weight ().
Calculations:
Evaluating Significance:
Degrees of Freedom (): .
Critical Value (One-tailed, lower tail, ):
qt(0.05, 63)= .Comparison: The test statistic () is much more extreme than the critical value ().
P-value Result:
pt(-26.42, 63)returns approximately . This is effectively zero, providing significant evidence to reject .Implementation in R:
Built-in function:
t.test(golden_retrievers, mu = 40, alternative = "less").
Questions & Discussion
Question (Student): Regarding rounding, how many decimal places should we keep in calculations?
Response (Instructor): A good default is two or three decimal places, depending on the magnitude of the value and the precision of the actual measurement tool (e.g., scale precision). However, when performing calculations, it is best to carry as many digits as possible through the steps to avoid propagation of rounding errors.
Question (Student): Concern about missing lab attendance marks.
Response (Instructor): You can miss up to two attendance marks without any deduction in the grade. However, students are still expected to catch up on the material and talk to their groups for any missed content. Missing more than two will lead to a deduction in the attendance portion of the grade.