ASSIGNMENT - 3

Analysis to Compare Age Adjusted Death Rate in Male and Female

Tenzing Sangay Bhutia (s3680446), Qianwei Yang(s3716296)

Last updated: 28 October, 2018

Introduction

Problem Statement

Data

Data Cont.

Descriptive Statistics and Visualisation

boxplot(CauseOfDeath$`Age Adjusted Death Rate`~ CauseOfDeath$Sex,
        main="Boxplot of Age Adjusted Death Rate After Handling Outlier", 
        ylab="Age Adjusted Death",xlab="Sex")

CauseOfDeath$`Age Adjusted Death Rate`[is.na(CauseOfDeath$`Age Adjusted Death Rate`)]<-0

Descriptive Statistics and Visualisation Cont..

cap <- function(x){
  quantiles <- quantile(x, c(.05, .25, .75, .95), na.rm = TRUE)
  x[ x< quantiles[2] - 1.5 * IQR(x) ] <- quantiles[1]
  x[ x> quantiles[3] + 1.5 * IQR(x) ] <- quantiles[4]
  x}
CauseOfDeath$`Age Adjusted Death Rate` <- CauseOfDeath$`Age Adjusted Death Rate` %>% cap()
boxplot(CauseOfDeath$`Age Adjusted Death Rate`~CauseOfDeath$Sex,
        main="Boxplot of Age Adjusted Death Rate After Handling Outlier",
        ylab="Age Adjusted Death Rate",xlab="Sex")

Decsriptive Statistics Cont.

CauseOfDeath %>% group_by(Sex) %>% summarise(Min = min(`Age Adjusted Death Rate`,na.rm = TRUE),
                                           Q1 = quantile(`Age Adjusted Death Rate`,probs = .25,na.rm = TRUE),
                                           Median = median(`Age Adjusted Death Rate`, na.rm = TRUE),
                                           Q3 = quantile(`Age Adjusted Death Rate`,probs = .75,na.rm = TRUE),
                                           Max = max(`Age Adjusted Death Rate`,na.rm = TRUE),
                                           Mean = mean(`Age Adjusted Death Rate`, na.rm = TRUE),
                                           SD = sd(`Age Adjusted Death Rate`, na.rm = TRUE),
                                           Missing = sum(is.na(`Age Adjusted Death Rate`)))->table1




knitr::kable(table1)
Sex Min Q1 Median Q3 Max Mean SD Missing
Female 0 0 7.45 21.225 173.18 34.57639 61.40258 0
Male 0 0 16.20 31.350 173.18 40.15967 62.19943 0

Levene Test

leveneTest(`Age Adjusted Death Rate` ~ Sex, data = CauseOfDeath,na.rm=TRUE)

Hypothesis Testing

t.test(
  `Age Adjusted Death Rate` ~ Sex,
  data = CauseOfDeath,
  var.equal = FALSE,
  alternative = "two.sided")
## 
##  Welch Two Sample t-test
## 
## data:  Age Adjusted Death Rate by Sex
## t = -1.4938, df = 1090.4, p-value = 0.1355
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -12.91705   1.75050
## sample estimates:
## mean in group Female   mean in group Male 
##             34.57639             40.15967

\[H_0: \mu_1 = \mu_2 \] - The Null hypothesis states that the Age adjusted Death Rate is equal in the case of Male and Female \[H_A: \mu_1 \ne \mu_2\] - The Alternate hypothesis states that the age adjusted death rate is not equal in the case of Male and Female.

Discussion

References