(Old) R — Biostatistics 2020

R6 — Two-sample t test (two-sided)

By


Goals of this lesson:

Conduct a two-sided t test for comparing two population means

t.test()

 

Instructions

  • Watch the following video:

R6 Two-sample t test (two-sided)

 

  • Practice the following problem:

Is there a difference (\(\mu_1 – \mu_2\))  in plasma cholesterol levels (mmol/L) of individuals in population 1 and population 2? Below are data collected from each population.  Assume that the significance level is 5%.

Sample 1 (selected from population 1):

     6.0,  6.4,  7.0,  5.8,  6.0,  5.8,  5.9,  6.7,  6.1,  6.5,  6.3,  5.8

Sample 2 (selected from population 2):

   6.4,  5.4,  5.6,  5.0,  5.0,  4.5,  6.0

 

Here is the result from the R Console:

R6_cholesterol_screenshot

                     (Source of data:  See p271 in [1]).

Remarks:

  • We will use the t.test () command to run two-sided tests only.
  • Even though we only want to find the P-value, we need to provide R will the information on confidence interval because every time we run t.test(), R will automatically generate BOTH the P-value and the confidence interval.
  • The relationship between a confidence interval and a two-sided hypothesis test will NOT be covered in the final exam.

 

Reference

[1] Gerstman B. 2015. Basic Biostatistics: Statistics for Public Health Practice. Jones & Bartlett Learning.

-END-



Content is copyright the author. Layout is copyright Mark Ciotola. See Corsbook.com for further notices.