knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.3 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.3 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.0
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(readxl)
library(modelr)
library(haven)
library(ggplot2)
library(countrycode)
library(maps)
##
## Attaching package: 'maps'
##
## The following object is masked from 'package:purrr':
##
## map
library(labelled)
# load the trip master data
data <- read_dta("~/Desktop/DSL 23-24/dataverse_files/replication_data.dta")
#data cleaning
data<- data|>
mutate_at(c("e_regionpol","e_regionpol_6C"),as.numeric)
val_labels(data) <- NULL
m1<-lm(trip_percent~v2x_polyarchy, data=data)
summary(m1)
##
## Call:
## lm(formula = trip_percent ~ v2x_polyarchy, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.20470 -0.08697 -0.02647 0.02722 0.72614
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.024553 0.005120 4.795 1.69e-06 ***
## v2x_polyarchy 0.256616 0.008755 29.312 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.1413 on 3779 degrees of freedom
## (186 observations deleted due to missingness)
## Multiple R-squared: 0.1852, Adjusted R-squared: 0.185
## F-statistic: 859.2 on 1 and 3779 DF, p-value: < 2.2e-16
#organizing based on democraticness
#finding the quadrants
data|>
select(v2x_polyarchy)|>
summary()
## v2x_polyarchy
## Min. :0.0150
## 1st Qu.:0.2840
## Median :0.5240
## Mean :0.5211
## 3rd Qu.:0.7690
## Max. :0.9240
averages_demo<- data|>
mutate(democracy_category=case_when(
v2x_polyarchy >=0 & v2x_polyarchy <0.2840 ~1,
v2x_polyarchy >=0.2840 & v2x_polyarchy <0.5240 ~2,
v2x_polyarchy >=0.5240 & v2x_polyarchy <0.7690 ~3,
v2x_polyarchy >=0.7690 & v2x_polyarchy <1 ~4
))|>
select(democracy_category,year, trip_score)|>
group_by(democracy_category, year)|>
na.omit()|>
mutate(demo_trip_avg=mean(trip_score))|>
mutate_at(c("democracy_category"),as.character)|>
group_by(democracy_category, year)
Over the course of the past twenty years, legal rights for trans people have dramatically increased. All over the world, transgender people are becoming more and more accepted, not only in society, but in the legislature. However, amidst varying cultural, political, and social landscapes, the laws that shape the lives of transgender people can range from comprehensive legal recognition to pervasive discrimination and marginalization. The Trans Rights Indicator Project, created by Myles Williamson, catalogs country and year data for relevant legal rights protections for 173 countries over the past 25 years. Additionally, the dataset includes population data from all 173 countries listed, such as religiosity and democratism. Using this data, this paper aims to shed light on the complexities of legal environments shaping the lives of transgender individuals, highlighting areas of progress and regression across the world.
TRIP (Trans Rights Indicator Project) uses 14 different variables to calculate both a TRIP score (out of 14) and a TRIP percent score (out of 100%) for each country in the world, for every year from 1999 to 2021. The first two variables are whether or not a country has laws that allow for “Direct Criminalization” or “Indirect Criminalization”. The next five variables categorize whether or not a country allows for a gender marker change on legal documents, and whether or not there are prohibitive, psychological, physiological, or divorce requirements in advance of a possible gender marker change, as well as whether or not a third gender is accepted as an option for a gender marker. Additionally, TRIP measures whether or not there are “Anti-discrimination protections”; overall as well as whether or not protections are enshrined in the constitution, and if there are specific laws protecting discrimination in education, employment, healthcare, and housing. Through these 14 variables, Williamson assigns a score for each country and each year. It’s worth noting that in regions of high political instability, for example if countries have split during the time period measured by Williamson, there is missing data, as the dataset only counts data starting from the generally accepted political independence of a country.
For the initial visualizations, I looked at how TRIP scores and different population variables of various countries changed over time. My goal here was to gain a better understanding of what population variables have an effect on the TRIP score of a country.
#initial visualization (figure 1)
data|>
filter(e_regionpol==5)|>
ggplot()+
geom_line(mapping=aes(x=year,y=trip_percent,color=country_name))+
labs(title="Changing TRIP Scores in the Western World", y="TRIP Score", x= "Year", color="Country Name")
## Warning: Removed 24 rows containing missing values (`geom_line()`).
This visualization charts countries’ TRIP percent scores over time, only counting countries given by the dataset as “Western Europe and North America”. The dataset categorizes all countries into one of six “regions”: “Latin America and the Caribbean”, “Western Europe and North America”, “Sub-Saharan Africa”, “Asia and Pacific”, “Eastern Europe and Central Asia”, and “Middle East and North Africa”. Countries in these regional categories often share similar cultural values or political systems, and so may serve as a good baseline for predicting data in a part of the world. As expected from background knowledge of this collection of nations, most countries have a continuous upward trending line, indicating increased legal rights for transgender individuals in the Western World over the past 20 years. However, this chart may be misleading. Some countries, like the United States, have lines that misrepresent the real legal protections in their country for trans citizens. The Trans Rights Indicator Project looks only at country-wide or federal protections, and for a country like the United States, which is split up into states that individually write their own laws, a TRIP score may not be an accurate representation for the whole country. Overall, however, a vast majority of the world’s nations use systems of governance that are based in the federal government, so we shouldn’t discount the TRIP system, but should instead note some flaws in it.
#how democracy changes over time (figure 2)
data|>
filter(e_regionpol==5)|>
ggplot()+
geom_line(mapping=aes(x=year, y=v2x_polyarchy, color=country_name))+
labs(title="Changing Democracy Scores in the Western World", y="Democracy Score", x= "Year", color="Country Name")
This next graph charts democracy scores over time for the same countries as the past graph. However, compared to the TRIP score chart, there is much more fluctuation over time in the “democratic-ness” of a country, despite the fact that all the countries in the chart are considered part of the same region. Using this information, it seemed relevant to categorize countries based on their “democratic-ness”, not on the regional categories provided by the dataset. Additionally, as seen in the first visualization, despite some cultural similarities between regional neighbors, there can still be much disparity in the TRIP scores of countries in the same region, indicating that what region a country resides in and its TRIP score are not linked.
# load the map data and attach the iso codes
world_data <- map_data("world") |>
fortify() |>
mutate(country_text_id = countryname(region, destination = "iso3c"))
## Warning: There were 2 warnings in `mutate()`.
## The first warning was:
## ℹ In argument: `country_text_id = countryname(region, destination = "iso3c")`.
## Caused by warning:
## ! Some values were not matched unambiguously: Ascension Island, Azores, Barbuda, Canary Islands, Chagos Archipelago, Grenadines, Heard Island, Madeira Islands, Micronesia, Saba, Saint Martin, Siachen Glacier, Sint Eustatius, Virgin Islands
## ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#mapping types of democratic systems (figure 3)
world_data |>
# generate year variable
mutate(year=2021) |>
full_join(subset(data, year==2021), by=c("country_text_id", "year")) |>
#plots the gmc
ggplot(aes(x=long, y=lat, group=group, fill = as.factor(v2x_regime))) +
geom_polygon(color="white", size=0.1) +
theme_void() +
scale_fill_viridis_d(end=0.8, direction = 1, na.value = "grey50", name="",labels = c(
"Closed Autocracy", "Electoral Autocracy", "Electoral Democracy","Liberal Democracy"))
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
#mapping democraticness (figure 4)
world_data |>
# generate year variable
mutate(year=2021) |>
full_join(subset(data, year==2021), by=c("country_text_id", "year")) |>
#plots the gmc
ggplot(aes(x=long, y=lat, group=group, fill = as.factor(v2x_polyarchy))) +
geom_polygon(color="white", size=0.1) +
theme_void() +
scale_fill_viridis_d(end=0.8, direction = 1, na.value = "grey50", name="")
guides(fill="none")
## $fill
## [1] "none"
##
## attr(,"class")
## [1] "guides"
Given this information, countries were split up into four groups for two factors. Firstly, each country was split into the type of democratic system that it uses, either a “Closed Autocracy”, “Electoral Autocracy”, “Electoral Democracy”, or a “Liberal Democracy”. Additionally, using a five-number summary to organize countries based on their “democratic-ness”, which takes into account more factors than simply the type of democratic system used, countries were assigned into different quadrants of “democratic-ness”, with the fourth quadrant being the most democratic. Interestingly, there is a large amount of overlap between which quadrant of “democratic-ness” a country has, and what democratic system it uses, as seen on the maps above.
#charting trip score given democraticness (figure 5)
averages_demo|>
ggplot()+
geom_line(mapping=aes(x=year, y=demo_trip_avg,color=democracy_category))+
labs(x="Year", y="Average TRIP Score")+
scale_color_discrete(name = "Democraticness", labels = c(
"First Quadrant", "Second Quadrant", "Third Quadrant","Fourth Quadrant"))
#charting trip score given type of regime (figure 6)
tripdata<- data|>
select(v2x_regime,year, trip_percent)|>
group_by(v2x_regime, year)|>
na.omit()|>
mutate(regime_avg=mean(trip_percent))|>
mutate_at(c("v2x_regime"),as.character)|>
group_by(v2x_regime, year)
tripdata|>
ggplot()+
geom_line(mapping=aes(x=year, y=regime_avg,color=v2x_regime))+
labs(x="Year", y="Average TRIP Score")+
scale_color_discrete(name = "Type of Regime", labels = c(
"Closed Autocracy", "Electoral Autocracy", "Electoral Democracy","Liberal Democracy"))
Both charts show similar slopes, once again indicating that “democratic-ness” and type of regime, while not interchangeable, are linked. Liberal democratic countries, or those in the most democratic quadrant, are most progressive over time in their support of trans legal rights, as the average TRIP score for both of those groups increases consistently and exponentially. Conversely, closed autocracies and those in the least democratic quadrant are almost constant in their lack of support for trans legal rights, with an inconsistent and shallow slope over time. In order to compare these groups and determine whether there is significant difference between these systems, a linear predictive model was used to generate a constant slope for each line, which can be compared and tested upon.
#categorizing democracy again
demo_data<- data|>
mutate(democracy_category=case_when(
v2x_polyarchy >=0 & v2x_polyarchy <0.2840 ~1,
v2x_polyarchy >=0.2840 & v2x_polyarchy <0.5240 ~2,
v2x_polyarchy >=0.5240 & v2x_polyarchy <0.7690 ~3,
v2x_polyarchy >=0.7690 & v2x_polyarchy <1 ~4
))|>
select(democracy_category,year, trip_score)|>
group_by(democracy_category, year)|>
na.omit()|>
mutate(demo_trip_avg=mean(trip_score))|>
mutate_at(c("democracy_category"),as.character)|>
mutate_at(c("year"),as.numeric)|>
group_by(democracy_category, year)
trip_mod <-lm(trip_score~year*democracy_category, data=demo_data)
grid<-demo_data|>
select(democracy_category, year, trip_score)|>
gather_predictions(trip_mod)
grid<-grid|> add_predictions(trip_mod)
#modeled version of figure 5 (figure 7)
ggplot(demo_data, aes(year, trip_score, color=democracy_category))+
geom_line(data=grid, aes(y=pred, color=democracy_category))+
scale_color_discrete(name = "Democraticness", labels = c(
"First Quadrant", "Second Quadrant", "Third Quadrant","Fourth Quadrant"))+
labs(x= "Year", y= "TRIP Score")
#modeled version of figure 6 (figure 8)
ggplot(demo_data, aes(year, trip_score, color=democracy_category))+
geom_line(data=demo_data, aes(x=year, y=demo_trip_avg, color=democracy_category))+
scale_color_discrete(name = "Type of Regime", labels = c(
"Closed Autocracy", "Electoral Autocracy", "Electoral Democracy","Liberal Democracy"))+
labs(title= "Modeled TRIP Score", x= "Year", y= "TRIP Score")
These two charts visualize the same data as the previous two, but using predictive modeling to create a linear chart. As before, the most democratic and liberal democratic countries are most progressive, while the least democratic and closed autocratic countries are slow and limited in their support for trans legal rights.
summary(trip_mod)
##
## Call:
## lm(formula = trip_score ~ year * democracy_category, data = demo_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.8559 -0.7783 -0.2362 0.5425 9.1028
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -2.739e+01 1.668e+01 -1.642 0.100654
## year 1.424e-02 8.297e-03 1.716 0.086198 .
## democracy_category2 -9.066e+01 2.439e+01 -3.718 0.000204 ***
## democracy_category3 -1.237e+02 2.371e+01 -5.220 1.89e-07 ***
## democracy_category4 -3.955e+02 2.408e+01 -16.424 < 2e-16 ***
## year:democracy_category2 4.520e-02 1.213e-02 3.726 0.000197 ***
## year:democracy_category3 6.187e-02 1.179e-02 5.247 1.63e-07 ***
## year:democracy_category4 1.979e-01 1.198e-02 16.520 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.66 on 3773 degrees of freedom
## Multiple R-squared: 0.3358, Adjusted R-squared: 0.3346
## F-statistic: 272.5 on 7 and 3773 DF, p-value: < 2.2e-16
A summary was run for each linear model (types of regimes as well as most/least democratic countries). Each category was run against the null hypothesis that the slope would be 0, and then again against the slope of the lowest slope (in the regime model, the lowest slope is the Closed Autocratic group, and in the “democratic-ness” model, the lowest slope is the first quadrant). This serves to find out if there is significant difference for each group compared to the null as well as the first group, so we can determine whether or not a prediction will be significantly different based on what group it is run for. For both comparisons (and for all groups) there are large t-values and small p-values, indicating a statistically significant difference based on group. When groups are run against the first group—for both models—there are p-values of less than 0.05. While all groups in both models are consistently significantly different, the first quadrant group and Liberal Democratic group both have p-values of less than 2e16. While this isn’t surprising, it does demonstrate once again that countries in those groups are far more likely to be more progressive in their support of legal transgender rights than countries in the other groups. Again, this demonstrates a significant difference in the predicted TRIP scores given either the type of democratic regime, or the “democratic-ness” of a country.
In conclusion, this study underscores the substantial variation in legal rights and protections for transgender individuals across different countries, as captured by the Trans Rights Indicator Project (TRIP). Over the past twenty years, the global landscape for transgender rights has evolved considerably, reflecting a broad spectrum of acceptance and legislative support. The comprehensive dataset compiled by Myles Williamson provides invaluable insights into these dynamics, utilizing 14 distinct variables to evaluate each country’s performance from 1999 to 2021.
Our analysis reveals that the type of a country’s political regime and its level of democratization significantly influence its TRIP scores. Specifically, countries identified as Liberal Democracies or those within the highest quadrant of “democratic-ness” exhibit markedly higher TRIP scores, indicating more progressive legal environments for transgender rights. Conversely, Closed Autocratic regimes and countries with lower levels of democratic engagement show significantly lower TRIP scores, highlighting persistent legal and societal challenges for transgender individuals in these regions.
The statistical significance of our findings, marked by large t-values and small p-values across various groups, underscores the critical role that political and democratic contexts play in shaping legal protections for transgender people. This evidence not only confirms the disparities between different democratic systems but also emphasizes the importance of political stability and democratic principles in the future, in order to advance transgender rights. By recognizing the influential factors identified in this research, policymakers and advocates can better strategize interventions to foster more inclusive and supportive environments for transgender communities worldwide. The progress achieved so far is commendable, but the journey towards universal acceptance and equality for transgender individuals remains ongoing.