Fariss Human Rights Data with Animation

Fariss Data

Is neat and complete.

load("FarissHRData.RData")
skimr::skim(HR.Data)
Table 1: Data summary
Name HR.Data
Number of rows 11717
Number of columns 27
_______________________
Column type frequency:
factor 1
numeric 26
________________________
Group variables None

Variable type: factor

skim_variable n_missing complete_rate ordered n_unique top_counts
COW_YEAR 0 1 FALSE 11717 100: 1, 100: 1, 100: 1, 100: 1

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
X 0 1.00 5859.72 3382.90 1.00 2930.00 5860.00 8789.00 11718.00 ▇▇▇▇▇
YEAR 0 1.00 1984.78 20.44 1946.00 1968.00 1987.00 2002.00 2017.00 ▅▆▆▇▇
CIRI 6787 0.42 390.52 170.85 101.00 242.00 380.00 530.00 698.00 ▇▇▇▇▇
COW 0 1.00 461.21 254.40 2.00 255.00 461.00 663.00 990.00 ▆▆▇▆▃
DISAP 6798 0.42 1.68 0.62 0.00 2.00 2.00 2.00 2.00 ▁▁▂▁▇
KILL 6800 0.42 1.33 0.76 0.00 1.00 2.00 2.00 2.00 ▃▁▅▁▇
POLPRIS 6793 0.42 1.13 0.84 0.00 0.00 1.00 2.00 2.00 ▆▁▅▁▇
TORT 6794 0.42 0.79 0.75 0.00 0.00 1.00 1.00 2.00 ▇▁▇▁▃
Amnesty 6140 0.48 2.70 1.12 1.00 2.00 3.00 3.00 5.00 ▃▇▇▅▂
State 4802 0.59 2.39 1.16 1.00 1.00 2.00 3.00 5.00 ▇▇▇▃▂
HRW 11271 0.04 3.03 1.11 1.00 2.00 3.00 4.00 5.00 ▂▅▇▅▂
hathaway 9484 0.19 2.74 1.15 1.00 2.00 3.00 3.00 5.00 ▃▆▇▅▂
ITT 10258 0.12 3.51 2.03 1.00 1.00 4.00 6.00 6.00 ▇▃▃▃▆
genocide 1261 0.89 0.03 0.16 0.00 0.00 0.00 0.00 1.00 ▇▁▁▁▁
rummel 6077 0.48 0.20 0.40 0.00 0.00 0.00 0.00 1.00 ▇▁▁▁▂
massive_repression 5541 0.53 0.05 0.21 0.00 0.00 0.00 0.00 1.00 ▇▁▁▁▁
executions 7613 0.35 0.10 0.30 0.00 0.00 0.00 0.00 1.00 ▇▁▁▁▁
negative_sanctions 7613 0.35 0.69 0.46 0.00 0.00 1.00 1.00 1.00 ▃▁▁▁▇
mass_killing 0 1.00 0.13 0.34 0.00 0.00 0.00 0.00 1.00 ▇▁▁▁▁
killing_low 6176 0.47 45.34 2306.65 0.00 0.00 0.00 0.00 171441.00 ▇▁▁▁▁
killing_best 11397 0.03 1855.35 27941.40 25.00 42.00 99.50 251.25 500000.00 ▇▁▁▁▁
killing_high 11397 0.03 3043.11 44714.85 25.00 62.00 149.00 397.75 800000.00 ▇▁▁▁▁
killing_present 6176 0.47 0.06 0.23 0.00 0.00 0.00 0.00 1.00 ▇▁▁▁▁
id 0 1.00 5859.00 3382.55 1.00 2930.00 5859.00 8788.00 11717.00 ▇▇▇▇▇
theta_mean 0 1.00 0.05 1.52 -3.77 -0.99 -0.07 0.96 5.14 ▂▇▇▂▁
theta_sd 0 1.00 0.36 0.19 0.18 0.23 0.27 0.47 1.31 ▇▂▁▁▁
# HR.Data$year <- as.Date(HR.Data$YEAR, format = "%Y")

What do we have?

library(gganimate)
p1 <- p1 + transition_reveal(YEAR) # this is kind of a hack, the year isn't right
animate(p1, nframes = 200)

COW.Codes <- distinct(COW.Codes) # Duplicates exist in the COW Code master file
COW.Codes$Continent <- cut(COW.Codes$CCode, breaks = c(0, 100, 200, 400, 600, 700, 900,1000), labels = c("N. America", "S. America", "Europe", "Africa", "Med/Mid", "Asia", "Oceania"), right = FALSE)
HR.Data.Named <- left_join(HR.Data, COW.Codes, by = c("COW" = "CCode"))

Now I have something to work with that is labeled.

( ggplot(HR.Data.Named) + aes(x=YEAR, y=theta_mean, color=as.factor(StateAbb), label = StateAbb) + geom_line(alpha = 0.3)  +  scale_color_viridis_d(guide=FALSE) + labs(x="Year", y="Human Rights Dynamic Factor Score", title = "The Evolution of Human Rights with Normed Scores", caption = "See Fariss and Schnakenberg (2014)" ) + theme_economist_white() + facet_wrap(vars(Continent)) -> p2 )

p2

Now let’s look at that.

p2 <- p2 + transition_reveal(YEAR)
animate(p2, nframes = 200)

North America

HR.Data.Named %>% filter(COW < 100) %>% ggplot(.) + aes(x=YEAR, y=theta_mean, color=as.factor(StateAbb), label = StateAbb) + geom_line(alpha = 0.3) +   scale_color_viridis_d(guide=FALSE) + labs(x="Year", y="Human Rights Dynamic Factor Score", title = "The Evolution of Human Rights with Normed Scores", caption = "See Fariss and Schnakenberg (2014)", subtitle = "North America") + theme_economist_white()

An Animation for North America

HR.Data.Named %>% filter(COW < 100) %>% ggplot(.) + aes(x=YEAR, y=theta_mean, color=as.factor(StateAbb), label = StateNme) + geom_label_repel(x=2010, size=2, direction = "y", hjust = 1, nudge_x = 20) + geom_line(alpha = 0.3) +   scale_color_viridis_d(guide=FALSE) + labs(x="Year", y="Human Rights Dynamic Factor Score", title = "The Evolution of Human Rights with Normed Scores", caption = "See Fariss and Schnakenberg (2014)", subtitle = "North America") + theme_economist_white() + transition_reveal(YEAR) -> NA.p
animate(NA.p, nframes=200)

South America

HR.Data.Named %>% filter(COW < 200 & COW > 100) %>% ggplot(.) + aes(x=YEAR, y=theta_mean, color=as.factor(StateAbb), label = StateNme) + geom_line(alpha = 0.3) +   scale_color_viridis_d(guide=FALSE) + labs(x="Year", y="Human Rights Dynamic Factor Score", title = "The Evolution of Human Rights with Normed Scores", caption = "See Fariss and Schnakenberg (2014)", subtitle = "South America") + theme_economist()

Animation for South America

HR.Data.Named %>% filter(COW < 200 & COW >= 100) %>% ggplot(.) + aes(x=YEAR, y=theta_mean, color=as.factor(StateAbb), label = StateNme) + geom_label_repel(x=2010, size=2, direction = "y", hjust = 1, nudge_x = 20) + geom_line(alpha = 0.3) +   scale_color_viridis_d(guide=FALSE) + labs(x="Year", y="Human Rights Dynamic Factor Score", title = "The Evolution of Human Rights with Normed Scores", caption = "See Fariss and Schnakenberg (2014)", subtitle = "South America") + theme_economist() + transition_reveal(YEAR) -> SA.p
animate(SA.p, nframes=200)

Europe

HR.Data.Named %>% filter(COW < 400 & COW >= 200) %>% ggplot(.) + aes(x=YEAR, y=theta_mean, color=as.factor(StateAbb), label = StateNme) + geom_line(alpha = 0.3) +   scale_color_viridis_d(guide=FALSE) + labs(x="Year", y="Human Rights Dynamic Factor Score", title = "The Evolution of Human Rights with Normed Scores", caption = "See Fariss and Schnakenberg (2014)", subtitle = "Europe") + theme_economist()

Animate Europe

HR.Data.Named %>% filter(COW < 400 & COW >= 200) %>% ggplot(.) + aes(x=YEAR, y=theta_mean, color=as.factor(StateAbb), label = StateNme) + geom_label_repel(x=2010, size=2, direction = "y", hjust = 1, nudge_x = 20) + geom_line(alpha = 0.3) +   scale_color_viridis_d(guide=FALSE) + labs(x="Year", y="Human Rights Dynamic Factor Score", title = "The Evolution of Human Rights with Normed Scores", caption = "See Fariss and Schnakenberg (2014)", subtitle = "Europe") + theme_economist() + transition_reveal(YEAR) -> EU.p
animate(EU.p, nframes=200)

Africa

HR.Data.Named %>% filter(COW < 600 & COW >= 400) %>% ggplot(.) + aes(x=YEAR, y=theta_mean, color=as.factor(StateAbb), label = StateNme) + geom_line(alpha = 0.3) +   scale_color_viridis_d(guide=FALSE) + labs(x="Year", y="Human Rights Dynamic Factor Score", title = "The Evolution of Human Rights with Normed Scores", caption = "See Fariss and Schnakenberg (2014)", subtitle = "Africa") + theme_economist()

Animate Africa

HR.Data.Named %>% filter(COW < 600 & COW >= 400) %>% ggplot(.) + aes(x=YEAR, y=theta_mean, color=as.factor(StateAbb), label = StateNme) + geom_label_repel(x=2010, size=2, direction = "y", hjust = 1, nudge_x = 20) + geom_line(alpha = 0.3) +   scale_color_viridis_d(guide=FALSE) + labs(x="Year", y="Human Rights Dynamic Factor Score", title = "The Evolution of Human Rights with Normed Scores", caption = "See Fariss and Schnakenberg (2014)", subtitle = "Africa") + theme_economist() + transition_reveal(YEAR) -> AF.p
animate(EU.p, nframes=200)

Middle East / North Africa

HR.Data.Named %>% filter(COW < 700 & COW >= 600) %>% ggplot(.) + aes(x=YEAR, y=theta_mean, color=as.factor(StateAbb), label = StateNme) + geom_line(alpha = 0.3) +   scale_color_viridis_d(guide=FALSE) + labs(x="Year", y="Human Rights Dynamic Factor Score", title = "The Evolution of Human Rights with Normed Scores", caption = "See Fariss and Schnakenberg (2014)", subtitle = "Middle East and North Africa") + theme_economist()

Animate Mid East / North Africa

HR.Data.Named %>% filter(COW < 700 & COW >= 600) %>% ggplot(.) + aes(x=YEAR, y=theta_mean, color=as.factor(StateAbb), label = StateNme) + geom_label_repel(x=2010, size=2, direction = "y", hjust = 1, nudge_x = 20) + geom_line(alpha = 0.3) +   scale_color_viridis_d(guide=FALSE) + labs(x="Year", y="Human Rights Dynamic Factor Score", title = "The Evolution of Human Rights with Normed Scores", caption = "See Fariss and Schnakenberg (2014)", subtitle = "Middle East and North Africa") + theme_economist() + transition_reveal(YEAR) -> MENA.p
animate(MENA.p, nframes=200)

Asia

HR.Data.Named %>% filter(COW < 900 & COW >= 700) %>% ggplot(.) + aes(x=YEAR, y=theta_mean, color=as.factor(StateAbb), label = StateNme) + geom_line(alpha = 0.3) +   scale_color_viridis_d(guide=FALSE) + labs(x="Year", y="Human Rights Dynamic Factor Score", title = "The Evolution of Human Rights with Normed Scores", caption = "See Fariss and Schnakenberg (2014)", subtitle = "Asia") + theme_economist()

Animate Asia

HR.Data.Named %>% filter(COW < 900 & COW >= 700) %>% ggplot(.) + aes(x=YEAR, y=theta_mean, color=as.factor(StateAbb), label = StateNme) + geom_label_repel(x=2015, size=2, direction = "y", hjust = 1, nudge_x = 20) + geom_line(alpha = 0.3) +   scale_color_viridis_d(guide=FALSE) + labs(x="Year", y="Human Rights Dynamic Factor Score", title = "The Evolution of Human Rights with Normed Scores", caption = "See Fariss and Schnakenberg (2014)", subtitle = "Asia") + theme_economist() + transition_reveal(YEAR) -> Asia.p
animate(Asia.p, nframes=200)

Oceania

HR.Data.Named %>% filter(COW  >= 900) %>% ggplot(.) + aes(x=YEAR, y=theta_mean, color=as.factor(StateAbb), label = StateNme) + geom_line(alpha = 0.3) +   scale_color_viridis_d(guide=FALSE) + labs(x="Year", y="Human Rights Dynamic Factor Score", title = "The Evolution of Human Rights with Normed Scores", caption = "See Fariss and Schnakenberg (2014)", subtitle = "Oceania") + theme_economist()

Animate Oceania

HR.Data.Named %>% filter(COW >= 900) %>% ggplot(.) + aes(x=YEAR, y=theta_mean, color=as.factor(StateAbb), label = StateNme) + geom_label_repel(x=2010, size=2, direction = "y", hjust = 1, nudge_x = 20) + geom_line(alpha = 0.3) +   scale_color_viridis_d(guide=FALSE) + labs(x="Year", y="Human Rights Dynamic Factor Score", title = "The Evolution of Human Rights with Normed Scores", caption = "See Fariss and Schnakenberg (2014)", subtitle = "Oceania") + theme_economist() + transition_reveal(YEAR) -> OC.p
animate(OC.p, nframes=200)

Avatar
Robert W. Walker
Associate Professor of Quantitative Methods

My research interests include causal inference, statistical computation and data visualisation.

Next
Previous

Related