2024-03-22

## Loading required package: ggplot2
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union

Hypothesis Testing

  • Hypothesis Testing is a method of statistical analysis that is used to make inferences about a population using sample data
  • Hypothesis Testing uses null and alternative hypotheses, as well as statistical tests, to compare evidence against the null hypothesis.
  • A p-value represents the measure of the strength of evidence against the null hypothesis
  • A small p-value indicates strong evidence against the null hypothesis, therefore allowing for its rejection
  • A large p-value indicates weak evidence against the null and therefore the null cannot be rejected.

Hypotheses

  • Null (H0): There is no difference in male vs female suicide rates
  • Alternate (H1): There is a difference in male vs female suicide rates

Dataset Summary

   country               year          sex                age           
 Length:36060       Min.   :1979   Length:36060       Length:36060      
 Class :character   1st Qu.:1991   Class :character   Class :character  
 Mode  :character   Median :2000   Mode  :character   Mode  :character  
                    Mean   :1999                                        
                    3rd Qu.:2008                                        
                    Max.   :2016                                        
  suicides_no        population      
 Min.   :    0.0   Min.   :     259  
 1st Qu.:    2.0   1st Qu.:   80566  
 Median :   21.0   Median :  375765  
 Mean   :  221.8   Mean   : 1699996  
 3rd Qu.:  116.0   3rd Qu.: 1344900  
 Max.   :22338.0   Max.   :43805214  

Statistical Tests

  • Test Statistic: Two sample t-test to compare average male vs female suicide rates
  • P-value Calculation: Determine the probability of the observing the null hypothesis
  • Interpretation:
  • If the p-value is less than 0.05, the null hypothesis will be rejected
  • If the p-value is equal to or greater than 0.05, the null hypothesis cannot be rejected

Barplot of Suicides by Gender

Temporal Distribution of Suicides within the Dataset’s Time Span

Mathematical Representations of Hypothesis Tests

Null Hypothesis (H₀): \[ H_0: \mu_{\text{male}} = \mu_{\text{female}} \]

Alternative Hypothesis (H₁): \[ H_1: \mu_{\text{male}} \neq \mu_{\text{female}} \]

Two-sample t-test: \[ t = \frac{{\bar{x}_1-\bar{x}_2}}{\sqrt{\frac{{s_1^2}}{{n_1}}+\frac{{s_2^2}}{{n_2}}}} \]

Plot of Sex vs Suicide Rates including the additional factor of Nation

Mathematical Tests

t_test_result <- t.test(suicides_no ~ sex, data = suicidestats)
p_value <- t_test_result$p.value 
p_value
[1] 1.867163e-148
  • This p-value is less than 0.05 by a significant margin therefore the null hypothesis can be rejected and there is strong evidence to support the conclusion that there is a significant difference in suicide rates between males and females in the provided data set.