Question #1:
-H0: There is no difference between male and female body temperatures.
-HA: There is a difference between male and female body temperatures.

getwd()
## [1] "/Users/serenamadsen/Documents/geog6000/lab02"
normtemp <- read.csv("../datafiles/normtemp.csv")
normtemp$fsex <- factor(normtemp$sex, 
                    levels = c(1, 2),
                    labels = c("male", "female"))
maletemp <- normtemp[1:65, 1:5]
femaletemp <- normtemp[66:130, 1:5]
t.test(maletemp$temp, femaletemp$temp, alternative = 'two.sided')
## 
##  Welch Two Sample t-test
## 
## data:  maletemp$temp and femaletemp$temp
## t = -2.2854, df = 127.51, p-value = 0.02394
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.53964856 -0.03881298
## sample estimates:
## mean of x mean of y 
##  98.10462  98.39385

-The p-value is below 0.05 so I have sufficient evidence to reject the null and accept the alternative hypothesis. (There is evidence for a difference in body temperature between men and women.)

Question #2:
-H0:There is not difference of life expectancy based on region.
-HA:There is a difference of life expectancy based on region.

gapc <- read.csv("../datafiles/gapc.csv")
boxplot(gapc$lifeexpectancy ~ gapc$continent, ylab = 'Life Expectancy (years)', xlab = 'Continent')

aov(lifeexpectancy ~ continent, data = gapc)
## Call:
##    aov(formula = lifeexpectancy ~ continent, data = gapc)
## 
## Terms:
##                 continent Residuals
## Sum of Squares   9757.236  7141.470
## Deg. of Freedom         6       165
## 
## Residual standard error: 6.578878
## Estimated effects may be unbalanced
## 1 observation deleted due to missingness
summary(aov(lifeexpectancy ~ continent, data = gapc))
##              Df Sum Sq Mean Sq F value Pr(>F)    
## continent     6   9757  1626.2   37.57 <2e-16 ***
## Residuals   165   7141    43.3                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 1 observation deleted due to missingness

-Life expectancy does vary significantly across continenents, as our p-value is far less than 0.05.