library("tidyverse")
## ── Attaching packages ───────────────────────────────────────────────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 3.2.0     ✔ purrr   0.3.2
## ✔ tibble  2.1.3     ✔ dplyr   0.8.3
## ✔ tidyr   0.8.3     ✔ stringr 1.4.0
## ✔ readr   1.3.1     ✔ forcats 0.4.0
## ── Conflicts ──────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
library("ggplot2")
library("plotly")
## 
## 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
# Read Data
# Data source: https://ourworldindata.org/hiv-aids#education-and-hiv-aids
hiv_cases <- read_csv("knowledge-hiv-prevention-in-males-vs-females.csv")
## Parsed with column specification:
## cols(
##   Country = col_character(),
##   Code = col_character(),
##   Year = col_double(),
##   Knowledge_Prevention_Male = col_double(),
##   Knowledge_Prevention_Female = col_double(),
##   Total_Population = col_double(),
##   Region = col_character()
## )
str(hiv_cases)
## Classes 'spec_tbl_df', 'tbl_df', 'tbl' and 'data.frame': 20163 obs. of  7 variables:
##  $ Country                    : chr  "Afghanistan" "Afghanistan" "Afghanistan" "Afghanistan" ...
##  $ Code                       : chr  "AFG" "AFG" "AFG" "AFG" ...
##  $ Year                       : num  1800 1820 1870 1913 1950 ...
##  $ Knowledge_Prevention_Male  : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ Knowledge_Prevention_Female: num  NA NA NA NA NA NA NA NA NA NA ...
##  $ Total_Population           : num  3280000 3280000 4207000 5730000 8151455 ...
##  $ Region                     : chr  NA NA NA NA ...
##  - attr(*, "spec")=
##   .. cols(
##   ..   Country = col_character(),
##   ..   Code = col_character(),
##   ..   Year = col_double(),
##   ..   Knowledge_Prevention_Male = col_double(),
##   ..   Knowledge_Prevention_Female = col_double(),
##   ..   Total_Population = col_double(),
##   ..   Region = col_character()
##   .. )
dim(hiv_cases)
## [1] 20163     7
#Filter African Countries
hiv_cases1 <- hiv_cases %>%
  mutate(pop_country = Total_Population/100000, na.rm = TRUE) %>%
  filter(Region =="Africa")

  
#Plot a knowlege about HIV Prevention between Male and Female
p1 <- ggplot(hiv_cases1, aes(x = Knowledge_Prevention_Male, y = Knowledge_Prevention_Female,
                             #size = pop_country,
                             color = Country)) +
  xlab("Knowledge about HIV prevention in males (aged 15-24)") + 
  ylab("Knowledge about HIV prevention in females (aged 15-24)") +
  ggtitle("Knowledge about HIV prevention")

p <- p1 + geom_point()
p
## Warning: Removed 3642 rows containing missing values (geom_point).

# Correlation Linear Regression
p2 <- p1 + geom_point() + geom_smooth(color = "red")
p2
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
## Warning: Removed 3642 rows containing non-finite values (stat_smooth).
## Warning: Removed 3642 rows containing missing values (geom_point).

#Interactive Plot
p <- ggplotly(p)
p

Education and HIV/AIDS

The data was acquired from https://ourworldindata.org/hiv-aids#education-and-hiv-aids. No new variables were created. The visualization using scatterplots compares the knowledge about HIV between males and females between the ages of 15 - 24 for the year 2016. This worked with countries in Africa; two fields were added to the African countries: Region and Income. The data was relatively clean.

Education about HIV/AIDS is a vital factor to prevent the disease’s spread. Unfortunately, often knowledge about HIV/AIDS is much lower for students of low socioeconomic status than students with high status. Increases in education lead to safer behaviors. With education, the traditional stigma is also reduced significantly.

In recent years, the education sector has come to play an increasingly important role in preventing HIV. Children of school-age have the lowest HIV infection rates of any population sector. Even in the worst affected countries, most schoolchildren are not infected. For these children, there is a window of hope, a chance to live a life free from AIDS, if they can acquire knowledge, skills, and values that will help protect them as they grow up.

For example, in Kenya, Cameroon, and Malawi, higher education level is correlated with higher condom usage. Even having only part of a primary education leads to a massive increase in the percentage of people who know that condoms prevent the spread of HIV.

Providing young people, especially girls, with the ‘social vaccine’ of education offers them a real chance at a productive life. Not only is education important for preventing HIV; preventing HIV is also essential for education. In addition, the more education pregnant women have received, the more likely they are to seek HIV testing during their antenatal care visits. Percentage of pregnant women who, when it was offered during an antenatal care visit, sought HIV testing and received their results, by education, selected sub-Saharan African countries, 2004-2007 – UNESCO (2011)

The impact of the epidemic means some countries are beginning to experience a reversal of hard-won educational gains; affecting supply, demand, and quality of education, HIV and AIDS limits the capacity of education sectors to achieve Education for All (EFA), and of countries to achieve their targets towards the Millennium Development Goals (MDGs).

While the Education Sector plays a key ‘external’ role in HIV prevention and in reducing stigma, it also plays an important ‘internal’ role in providing access to care, treatment and support for teachers and staff, a group that in many countries represents more than 60 per cent of the public sector workforce.

Over the past five years, 4 Networks for HIV/AIDS Focal Points have been formed throughout Africa. These networks have successfully taken on responsibility and ownership of “Accelerate” activities (Acceleration of the Education Sector Response to HIV and AIDS) at regional and national levels. The groups meet and communicate regularly to discuss how best to work together to develop more effective regional, sub-regional and national education sector responses to HIV and AIDS. Their ultimate aim is to enable stronger and better quality actions at the school level.