Introduction
The research explores the relationship between online hate speech and offline hate crimes, specifically targeting migrant and LGBT communities in Spain. It is based on the premise that attitudes precede behaviors, a cornerstone of social psychology. Traditional methods for measuring attitudes towards sensitive topics like migration and sexual diversity often fall short, potentially masking underlying biases. User-generated content on social media offers a valuable alternative, as users may express opinions more freely online. Previous research suggests a link between online opinions and offline behaviors, with the spread of hate speech potentially anticipating hate crimes. However, existing studies often rely on low-frequency crime data (e.g., yearly statistics), masking the temporal dynamics of online opinions and their relationship with criminal actions. Most studies also utilize single social media sources and targets. This study addresses these limitations by using a unique dataset of daily police reports in Spain, disaggregated at the province level, coupled with data from both X (Twitter) and Facebook, focusing on hate speech directed at migrants and LGBT individuals. The objective is to model and predict the temporal patterns of hate crime, enhancing our understanding of social media as a predictor of offline behavior, not simply as a reflection of society or a direct cause of individual actions. The study combines manual and computational approaches, analyzing hate speech and inflammatory language over three years (2016-2018), using disaggregated and anonymized police reports alongside social media data. The core hypothesis is that the volume of inflammatory language on social media anticipates an increase in offline hate crimes.
Literature Review
Existing research supports the idea that attitudes precede behaviors, but measuring attitudes towards sensitive topics is challenging. Social media provides a valuable window into these attitudes, allowing researchers to explore potentially hidden biases. Studies have shown a correlation between online opinions and offline behaviors. However, most empirical studies rely on low-frequency, aggregated crime data which limits the analysis of temporal dynamics and correlations with high-frequency social media data. Furthermore, many studies use a single social media platform or focus on generic hate speech, rather than specific target groups. This study addresses these gaps by using high-frequency, granular crime data from Spain, coupled with data from multiple social media platforms (X and Facebook), and focusing on specific target groups (migrants and LGBT individuals). Previous attempts to correlate hate crime data from non-official sources with hate speech on social media did not reveal a strong relationship, leading the current researchers to leverage official police data despite underreporting challenges. While temperature is often cited as a predictor of crime, research suggests other factors, such as specific social events, are more influential in predicting hate crimes. The temporal patterns of hate crimes are often influenced by social events like terrorist attacks or political events. These events can trigger both offline and online reactions, leading to an increase in hate speech. Online hate speech is often considered a crime itself, although enforcement challenges remain due to complexities in detection and freedom of speech considerations. The automated detection of hate speech remains a research challenge, with existing methodologies focusing primarily on hate speech against single target groups or utilizing a single social media source. Existing studies also lack consistent evidence of causal effects between aggregated online hate speech and offline hate crimes; instead this study will focus on predictive capabilities.
Methodology
This study used primary data sources: internal data from the Spanish National Police (excluding Catalonia and the Basque Country) for hate crimes (2016-2018), and social media data from X (Twitter) and Facebook. Data cleaning resulted in two hate crime datasets (HCDS1: 1215 reports, HCDS2: 657 reports, specifying migrant or LGBT victims). Two social media datasets (SMDS1 and SMDS2) were created for the same period. SMDS1 contained a random sample of 1,096,000 tweets, with 12,682 classified as hateful (using HaterBert). SMDS2 comprised 776,180 records (215,083 original posts) from X and Facebook, filtered using keywords related to migrants and LGBT individuals. Hate crime data was aggregated by day, week, and month. For online hate speech, HaterBert (for generic hate) and ad-hoc classifiers (for migrant and LGBT-targeted hate) based on multilingual BERT models were used. These classifiers were trained using previously annotated datasets. Sentiment analysis was performed using SentiStrength, and toxicity levels were assessed using the Perspective API. The final datasets were combined and aggregated to create time series datasets (Table 2). The datasets were then analyzed using various methods. HCDS1 + SMDS1 (generic hate crime and hate speech) were analyzed for temporal correlations. HCDS2 + SMDS2 (specific hate crimes and hate speech) were analyzed using VAR (Vector Autoregression), GLMNet (Generalized Linear Models with Lasso and Elastic Net regularization), and XGBTree (Extreme Gradient Boosting Trees) to predict hate crimes four time periods in advance, on a daily and weekly basis. The choice of algorithms was driven by selecting models for time series data (VAR) and machine learning models for linear (GLMNet) and non-linear (XGBTree) relationships. For VAR models, relevant variables were selected using Granger causality tests and Johansen cointegration tests (when applicable). Stationarity of time series was checked using the augmented Dickey-Fuller test. The AIC was used to determine the optimal lag order for the VAR models. GLMNet and XGBTree models incorporated all variables and their standard deviations. Variable importance was assessed to help understand the relationships; if a model didn't provide variable importance, all features were considered. A maximum of ten lags were used for these models. The study used several performance metrics to compare the different models. These included R², RMSE (Root Mean Squared Error), and MAE (Mean Absolute Error).
Key Findings
A positive and significant temporal correlation was observed between generic hate speech on X and all hate crimes. Machine learning models achieved impressive results in forecasting hate crimes against migrants and the LGBT community, explaining up to 64% of the variance for migrant hate crimes and 53% for LGBT hate crimes. Toxic language consistently outperformed hate speech or sentiment analysis as a predictor. Facebook posts were more predictive than tweets. In most cases, inflammatory language temporally preceded hate crimes, although causality cannot be definitively established. National-level models outperformed those restricted to Madrid, and models predicting hate crimes against migrants showed better results than those targeting the LGBT community. Weekly aggregations generally outperformed daily aggregations in predictive accuracy. The best performing models were GLMNet for migrant hate crimes (R² = 64%) and XGBTree for LGBT hate crimes (R² = 53%). Analysis of the best-performing models for each target group and algorithm (VAR, GLMNet, XGBTree) revealed that toxicity-related variables were consistently more important than hatred and sentiment. Facebook posts were generally more influential predictors than tweets from X. Cross-interactions between hate speech targeting the different groups were observed in GLMNet and XGBTree models. VAR model analyses demonstrated that language features generally preceded hate crime events in time, although some recursive relationships were identified in a few models, suggesting the possibility of hate crimes influencing subsequent hate speech online, although not consistently.
Discussion
The findings support the existence of a relationship between online hate speech and offline hate crime, providing strong empirical evidence that online inflammatory language can serve as a reliable predictor of future hate crimes. This study goes beyond previous research by incorporating data from multiple social media sources, analyzing hate speech directed at two specific vulnerable groups, and employing advanced machine learning techniques to model temporal dynamics. The superior performance of models based on toxic language features, rather than purely hateful content, highlights the complex nature of the relationship, and suggests that subtle expressions of hostility or inflammatory statements can be more potent indicators of future violence. The better predictive power of Facebook data compared to Twitter data highlights platform-specific differences in user behavior and content moderation. The study's limitations notwithstanding, the findings suggest the potential for practical applications in crime prevention. By monitoring social media for indicators of inflammatory language, law enforcement and other relevant agencies might be better equipped to anticipate and prevent hate crimes.
Conclusion
This research demonstrates a significant predictive relationship between online inflammatory language and offline hate crimes. The use of multiple social media sources, specific target groups, and advanced machine learning techniques yielded robust models capable of forecasting hate crimes with considerable accuracy. Toxic language proved a particularly strong predictor, highlighting the need for broader monitoring efforts than just focusing on explicit hate speech. The findings suggest the practical utility of social media monitoring for crime prevention, while emphasizing ethical considerations related to digital surveillance. Future research should explore the impact of major social and political events on this relationship, refine models by using real-time data from social media, and incorporate additional variables such as local socioeconomic factors.
Limitations
The study's limitations include the availability of hate crime data. Hate crimes are relatively rare events, and underreporting is likely. The analysis did not include high-profile events as variables, which might have influenced the variables considered. Social media platforms actively remove illegal content, potentially affecting data completeness. The models' performance might vary depending on factors not considered, such as local socioeconomic context. Further research should address these issues for a more comprehensive analysis of the relationship between online and offline hate.
Related Publications
Explore these studies to deepen your understanding of the subject.