Furness and Bryant (1996) measured the metabolic rates of eight male and six female breeding northern fulmars and were interested in testing the null hypothesis that there was no difference in metabolic rate between the sexes (Box 3.2 of Quinn and Keough(2002)).
To start this activity, I reset first the R’s memory using the code below:
rm(list=ls())
Step 1
I import the Furness and Bryant (1996) data set that will be used in this activity using the codes below.
setwd("C://Users/April Mae Tabonda//Documents//MS Marine Science//Biostat//PLP//RMDs//PLP_7 T-Test")
getwd()
## [1] "C:/Users/April Mae Tabonda/Documents/MS Marine Science/Biostat/PLP/RMDs/PLP_7 T-Test"
furness <-read.csv('furness.csv', header = T, sep=',')
head(furness)
## SEX METRATE BODYMASS
## 1 Male 2950.0 875
## 2 Female 1956.1 635
## 3 Male 2308.7 765
## 4 Male 2135.6 780
## 5 Male 1945.6 790
## 6 Female 1490.5 635
tail(furness)
## SEX METRATE BODYMASS
## 9 Female 1091.0 645
## 10 Male 1195.5 788
## 11 Female 727.7 635
## 12 Male 843.3 855
## 13 Male 525.8 860
## 14 Male 605.7 1005
str(furness)
## 'data.frame': 14 obs. of 3 variables:
## $ SEX : Factor w/ 2 levels "Female ",..: 2 1 2 2 2 1 1 1 1 2 ...
## $ METRATE : num 2950 1956 2309 2136 1946 ...
## $ BODYMASS: int 875 635 765 780 790 635 668 640 645 788 ...
Step 2
In this activity, I assessed assumptions of normality and homogeneity of variance for the null hypothesis that the population mean metabolic rate is the same for male and female breeding northern fulmars.
boxplot(METRATE~SEX, furness)
with(furness, rbind(MEAN=tapply(METRATE, SEX, mean),
VAR=tapply(METRATE, SEX, var),
SD=tapply(METRATE, SEX, sd)))
## Female Male
## MEAN 1285.5167 1563.7750
## VAR 177209.4177 799902.5250
## SD 420.9625 894.3727
In order to visually check normality, I used qqplot by running the codes below.
qqnorm(furness$METRATE)
qqline(furness$METRATE)
We were instructed to used qqplot to produce both boxplot and quantile-quantile to visually checked normality.
In this activity, we used Shapiro Wilks to test for normality.
shapiro.test(furness$METRATE)
##
## Shapiro-Wilk normality test
##
## data: furness$METRATE
## W = 0.94392, p-value = 0.4709
Step2b
Levene’s test can be used to answer the following question:
Is the assumption of equal variances valid?
We used the package
pacman::p_load(car)
leveneTest(furness$METRATE,furness$SEX)
## Levene's Test for Homogeneity of Variance (center = median)
## Df F value Pr(>F)
## group 1 7.4057 0.01856 *
## 12
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Conclusion While there is no evidence of non-normality (boxplots not grossly asymmetrical), variances are a little unequal (although perhaps not grossly unequal- one of the boxplots is not more than three times smaller than the other). Hence, a separate variances t-test is more appropriate than a pooled variances t-test.
Step 3
Welch’s T-test
We were instructed to perform a separate variances (Welch’s) t-test to test the null hypothesis that the population mean metabolic rate is the same for both male and female breeding northern fulmars.
t.test(METRATE~SEX, furness, var.equal=FALSE)
##
## Welch Two Sample t-test
##
## data: METRATE by SEX
## t = -0.77317, df = 10.468, p-value = 0.4565
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -1075.3208 518.8042
## sample estimates:
## mean in group Female mean in group Male
## 1285.517 1563.775
Conclusion
Do not reject the null hypothesis. Metabolic rate of male breeding northern fulmars was not found differ significantly (t= -0.773, df= 10.468, P= 0.457) from that of females.