Visualizing Femicide Rates in Spain: Time Series

Shota Hasui

2023-01-28

For this project, I looked at time series data of femicides (intimate partner violence) from 2003 to 2017. The below graph describes the rate of femicides by taking into account and stratifying for the trend, the season, and irregularities for each time period.

All credit for the instructions and data go to Crime Mapping and Spatial Data Analysis using R by Juanjo Medina and Reka Solymosi.

Code can be found below.

library(readr)
library(dplyr)
library(lubridate)
library(ggeasy)
library(sf)
library(spacetime)
library(ggplot2)
library(ggfortify)
library(ggTimeSeries)
library(ggseas)
library(gganimate)
library(tmap)
library(ggthemr)
ggthemr('pale')
femicidios <- read_csv('https://raw.githubusercontent.com/maczokni/crime_mapping/master/data/femicidos.csv')
fem_timeseries <- ts(femicidios %>% 
                       select(femicidios), 
                     frequency=12, 
                     start=c(2003,1)) 
fem_df = tsdf(fem_timeseries)
ggsdc(fem_df, aes(x = x,y = y),  method = "decompose") +
  geom_line(size=2) +
  ggtitle("Intimate Partner Femicides in Spain") +
  easy_center_title() +
  easy_text_size(size=20) +
  theme(axis.title.x = element_blank(),
        axis.title.y = element_blank(),
        axis.text = element_text(size=12))