---
title: "Using the genderstat Package for Gender Inequality Analysis"
author: "S M Mashrur Arafin Ayon"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Using the genderstat Package for Gender Inequality Analysis}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

# Introduction

The `genderstat` package provides tools for quantitative analysis in gender studies, allowing researchers to calculate various gender inequality metrics such as the Gender Pay Gap (GPG), Gender Inequality Index (GII), Gender Development Index (GDI), and Gender Empowerment Measure (GEM). This vignette will guide you through the installation, data description, and usage of the functions included in the package.

# Installation

You can install the `genderstat` package from CRAN using the following command:

```r
install.packages("genderstat")
```
# Data Description
The package includes several datasets used for calculating gender inequality metrics. Below are the descriptions of each dataset:

## Gender Pay Gap (GPG)
This dataset contains observed values for analyzing the gender pay gap across different countries.

```r
data(real_data_GPG)
head(real_data_GPG)
```
## Gender Inequality Index (GII)
This dataset includes metrics for evaluating gender disparities in reproductive health, empowerment, and labor market participation.

```r
data(real_data_GII)
head(real_data_GII)
```

## Gender Development Index (GDI)
This dataset contains values for the Gender Development Index, focusing on health, education, and economic resources.

```r
data(real_data_GDI)
head(real_data_GDI)
```

## Gender Empowerment Measure (GEM)
This dataset includes metrics for the Gender Empowerment Measure, assessing political representation, professional positions, and income distribution.

```r
data(real_data_GEM)
head(real_data_GEM)
```

# Function Descriptions and Examples
## Gender Pay Gap (GPG)

The `gender_pay_gap` function calculates the Gender Pay Gap based on the provided dataset.

```r
data(real_data_GPG)
gpg_results <- gender_pay_gap(real_data_GPG)
print(gpg_results)
```

## Gender Inequality Index (GII)
The `gender_inequality_index` function computes the Gender Inequality Index.

```r
data(real_data_GII)
gii_results <- gender_inequality_index(real_data_GII)
print(gii_results)
```

## Gender Development Index (GDI)
The `gender_development_index` function calculates the Gender Development Index.

```r
data(real_data_GDI)
gdi_results <- gender_development_index(real_data_GDI)
print(gdi_results)
```

## Gender Empowerment Measure (GEM)
The `gender_empowerment_measure` function computes the Gender Empowerment Measure.

```r
data(real_data_GEM)
gem_results <- gender_empowerment_measure(real_data_GEM)
print(gem_results)
```

# Case Studies
## Case Study 1: Analyzing Gender Pay Gap
In this case study, we analyze the gender pay gap across different countries using the `genderstat` package.

```r
data(real_data_GPG)
gpg_results <- gender_pay_gap(real_data_GPG)
# Select top 5 countries with the highest Gender Pay Gap
top_5_gpg <- gpg_results[order(-gpg_results$gpg), ][1:5, ]

# Visualize the results
library(ggplot2)
ggplot(top_5_gpg, aes(x = reorder(country, gpg), y = gpg)) +
  geom_bar(stat = "identity") +
  coord_flip() +
  labs(title = "Top 5 Countries with Highest Gender Pay Gap", x = "Country", y = "GPG (%)")
```

## Case Study 2: Evaluating Gender Inequality Index
This case study evaluates the Gender Inequality Index for various countries.

```r
data(real_data_GII)
gii_results <- gender_inequality_index(real_data_GII)
# Select bottom 5 countries with the lowest Gender Inequality Index
bottom_5_gii <- gii_results[order(gii_results$GII), ][1:5, ]

# Visualize the results
ggplot(bottom_5_gii, aes(x = reorder(country, GII), y = GII)) +
  geom_bar(stat = "identity") +
  coord_flip() +
  labs(title = "Bottom 5 Countries with Lowest Gender Inequality Index", x = "Country", y = "GII")

```

# Conclusion
The genderstat package provides a comprehensive set of tools for analyzing gender inequality metrics, making it easier for researchers to conduct gender-centric studies. By leveraging these tools, researchers can gain deeper insights into gender disparities and contribute to informed policy-making and advocacy efforts.



