Scenario #1: Fitness has been associated with cardiovascular and mortality risk in adults. Thus, researchers are interested in investigating secular trends in fitness to determine if cardiovascular disease risk has changed over the last 20 years. Historical data from 1995 indicated that the typical adult (18 to 49) had a VO2 max of 42 ml/kg/min. In 2015, researchers took a random sample of 529 adults aged 18 to 49 and measured their VO2 max using the same submax test that was used in 1995. Is the fitness level, measured by V02 max, of adults in this sample (aged 18 to 49 years) similar to the fitness level of adults aged 18 to 49 years in 1995?

1. Set hypothesis (one-sided or two-sided)

Null Hypothesis: μ2015 = μ1995 ; μ2015 = 42 ml/kg/min

Two-sided Alternative Hypothesis: μ2015 ≠ μ1995 ; μ2015 ≠ 42 ml/kg/min

2. What type of test statistic is appropriate for addressing this question?

Since we are comparing the mean in one sample to a historical reference value, a one-sample t-test is appropriate for addressing this question.

3. What are the assumptions/conditions for using this test statistic?

In order to conduct a one sample t-test, we must assume 1) independence of observations and an 2) approximately normal distribution of V02 max.

4. Have the assumptions been violated?

A random sample of only 529 people were used, thus independence of observations is assumed. Plotting a histogram will indicate whether V02 max is approximately normally distributed.

Fitness <- read.csv("~/Desktop/Fitness.csv")
attach(Fitness)
hist(vo2, ylab="ml/kg/min", main="Distribution of V02 Max", col="blue", breaks=20)

There are a few outliers creating a bit of a skew. We could consider non-parametic procedures but we will stick with a t-test in this example.

5. Regardless of your answer in question 4, conduct the appropriate test statistic and report the p-value associated with your hypothesis.

t.test(vo2, mu=42, alternative="two.sided")
## 
##  One Sample t-test
## 
## data:  vo2
## t = -5.2017, df = 528, p-value = 2.83e-07
## alternative hypothesis: true mean is not equal to 42
## 95 percent confidence interval:
##  38.96926 40.63089
## sample estimates:
## mean of x 
##  39.80008

6. Based on the p-value calculated above, do you have sufficient evidence to reject the null hypothesis? What are the implications of your findings?

the p-value is very small, thus we have sufficient evidence to reject the null. This means that in 2015, fitness levels, measured via VO2 Max, in adults aged 18 to 49 years are not equal to fitness levels of adults aged 18 to 49 in 1995. At least from this study, there is evidence that fitness levels have changed.

Scenario #2: Using the same sample used in Scenario #1, we now want to determine if fitness level, measured by VO2 max, is similar in men and women.

1. Set hypothesis (one-sided or two-sided)

Null Hypothesis: μmen - μwomen = 0

Two-sided Alternative Hypothesis: μmen - μmen ≠ 0

2. What type of test statistic is appropriate for addressing this question?

Since we are comparing the means of two samples, men and women, a two-sample test of mean is appropriate for addressing this question

3. What are the assumptions/conditions for using this test statistic?

In order to use a two sample t-test, we must have 1) within group independence, 2) between group independence, and the 3) data distribution of V02 Max for both men and women should be approximately normal.

4. Have the assumptions been violated?

Since a random sample was used and there are only 529 observations, thus can assume independence within group. Since gender is mutually exclusive there is independence between groups. We can now create a graph to determine if the distribution of VO2 max is appropriately normally distributed.

boxplot(vo2~gender, main="Distribution of VO2 Max by Gender", ylab="ml/kg/min")

There are a few outliers but overall the distribution looks normal

5. Regardless of your answer in question 4, conduct the appropriate test statistic and report the p-value associated with your hypothesis.

We first want to check equality of variances

#Checking equality of variances
var.test(vo2~gender, alternative="two.sided")
## 
##  F test to compare two variances
## 
## data:  vo2 by gender
## F = 0.9196, num df = 268, denom df = 259, p-value = 0.4963
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##  0.7217242 1.1711344
## sample estimates:
## ratio of variances 
##          0.9196002

Based on p=0.4963 > significance level of 0.05, we fail to reject the null hypothesis that the variances are equal. We can perform a t-test assuming equal variances

t.test(vo2~gender, alternative="two.sided", var.equal=TRUE)
## 
##  Two Sample t-test
## 
## data:  vo2 by gender
## t = -9.2766, df = 527, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -8.825234 -5.740651
## sample estimates:
## mean in group Female   mean in group Male 
##             36.22056             43.50350

6. Based on the p-value calculated above, do you have sufficient evidence to reject the null hypothesis? What are the implications of your findings?

Since the p-value is very small we have sufficient evidence to reject the null hypothesis. In other words, fitness levels measured via VO2 Max is different in men and women.

Scenario #3: Again using the same sample used in Scenario #1, we now want to determine if fitness level, measured by VO2 max, is similar in normal weight, overweight, and obese adults.

1. Set hypothesis (one-sided or two-sided)

Null Hypothesis: μnormal = μoverweight = μobese

Alternative Hypothesis: Means are not all equal

2. What type of test statistic is appropriate for addressing this question?

To determine if the means are similar between the three groups, an ANOVA is the most appropriate test statistic.

3. What are the assumptions/conditions for using this test statistic?

In order to use an ANOVA, we must have 1) within group independence, 2) between group independence, 3) the data distribution of V02 Max for each group should be approximately normal, and we must have 4) homogeneity of variance.

4. Have the assumptions been violated?

Since a random sample was used and there are only 529 observations, we can assume independence within group. Since normal weight, overweight, and obese are mutually exclusive there is independence between groups. We can now create a graph to determine if the distribution of VO2 max is appropriately normally distributed and check equality of variance.

boxplot(vo2~bmigrp, main="Distribution of VO2 Max by BMI Group", ylab="ml/kg/min")

There are outliers, especially in the normal weight group. Because of the outliers, it looks likethe variances are not equal between the groups. Outside of the outliers, the distributions look pretty normal.

Now we check equality of variances

#Checking equality of variances
bartlett.test(vo2~bmigrp)
## 
##  Bartlett test of homogeneity of variances
## 
## data:  vo2 by bmigrp
## Bartlett's K-squared = 14.7925, df = 2, p-value = 0.0006136

In this example, the variances are unequal since the p=0.0006. Ordinally we would not conduct an analysis of variance test. We would consider a non-parametric procedure or some other option. TSince I stated that we wanted to produce a test statistic regardless, we will perform an ANOVA just for practice

5. Regardless of your answer in question 4, conduct the appropriate test statistic and report the p-value associated with your hypothesis.

anova <-aov(vo2~bmigrp)
summary(anova)
##              Df Sum Sq Mean Sq F value   Pr(>F)    
## bmigrp        2   2335  1167.3   12.89 3.42e-06 ***
## Residuals   526  47624    90.5                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

6. Based on the p-value calculated above, do you have sufficient evidence to reject the null hypothesis? What are the implications of your findings?

Based on the very small p-value, we have sufficient evidence to reject the null of equal means between the three BMI groups. However, we must interpret our results with caution since variances are unequal between the groups. This could lead to inaccurate results.

Exploratory Analysis After visually inspecting the graph for VO2 max by BMI group, there are potential outliers among normal weight individuals. I will create a subset, removing the outliers, observations with VO2 max values >60 ml/kg/min. Then I will determine if variances are equal with outliers removed.

Fitness2 <-Fitness[which(vo2 < 60),]

Now that we have created a subset I will plot another graph and check for equality of varainces

attach(Fitness2)
## The following objects are masked from Fitness:
## 
##     age, bmigrp, bmxbmi, cs, fitlevel, gender, mvpa, sedmin, tpa,
##     vo2
boxplot(vo2~bmigrp, main="Distribution of VO2 Max by BMI Group", ylab="ml/kg/min")

bartlett.test(vo2~bmigrp)
## 
##  Bartlett test of homogeneity of variances
## 
## data:  vo2 by bmigrp
## Bartlett's K-squared = 1.475, df = 2, p-value = 0.4783

After eliminating outliers, the distributions appear approximately normal and the variances are equal. Once again we will perform ANOVA

anova <-aov(vo2~bmigrp)
summary(anova)
##              Df Sum Sq Mean Sq F value   Pr(>F)    
## bmigrp        2   1375   687.6   11.06 1.98e-05 ***
## Residuals   512  31825    62.2                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

The very small p-value indicates that the means are not all equal between the three groups.

We will now perform exploratory analysis to see which groups differed

pairwise.t.test(vo2, bmigrp, p.adj = "bonf")
## 
##  Pairwise comparisons using t tests with pooled SD 
## 
## data:  vo2 and bmigrp 
## 
##            Normal  Obese
## Obese      1.5e-05 -    
## Overweight 0.026   0.144
## 
## P value adjustment method: bonferroni

Using the bonferroni correction method, the p-values were adjusted. We will now compare them to alpha = 0.05. Based on the p-values, VO2 in normal weight individuals is different than both obese and overwight individuals. VO2 max in overweight individuals is not than than VO2 max in obese individuals