[This article was first published on DataGeeek, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.In financial markets, distinguishing between information-driven movements and liquidity-driven shocks is critical. The reference study we based our work on highlights the importance of tail analysis: comparing Gaussian (thin-tailed) and Student‑t (fat-tailed) distributions to understand whether price changes are more likely to reflect genuine information or temporary liquidity imbalances.Financial returns are rarely as well‑behaved as the Gaussian (normal) distribution assumes. In theory, extreme price movements should be exceedingly rare under a thin‑tailed Gaussian model. Yet in practice, markets frequently exhibit fat tails: large jumps, crashes, and spikes that occur far more often than Gaussian theory predicts.This discrepancy motivates tail analysis—a statistical approach that compares how well different distributions explain the observed data. Two common candidates are:Gaussian distribution (thin tails): If returns fit this model better, extreme movements are interpreted as information‑driven. In other words, new information has entered the market, and price changes are more likely to reflect genuine shifts in fundamentals or expectations.Student‑t distribution (fat tails): If returns fit this model better, extreme movements are considered liquidity‑driven. These shocks often arise from temporary imbalances in order flow or liquidity constraints, and prices tend to revert once the imbalance subsides.By comparing the log‑likelihoods of Gaussian and Student‑t fits, we can classify market behavior into these two regimes. This classification is not merely academic: it helps traders, risk managers, and analysts distinguish between trend continuation (information‑driven) and mean reversion (liquidity‑driven).In our workflow, we apply this tail analysis to gold futures (GC=F) over the past 15 trading days. We compute log returns, fit both distributions, and compare their likelihoods. We then enrich the analysis with a volume impact metric, which highlights whether abnormal trading activity amplifies price changes. Finally, we present the results in a color‑coded audit table that makes tail behavior visually interpretable.Why These R Packages?tidyverse: Provides a consistent grammar for data manipulation (mutate, drop_na, select). It ensures reproducibility and readability when transforming raw market data into log returns and derived metrics.tidyquant: Bridges financial data sources with the tidyverse ecosystem. We use it to fetch gold futures data (GC=F) directly from Yahoo Finance, making the workflow self-contained and easy to extend to other tickers.MASS: Offers statistical tools for distribution fitting. We rely on fitdistr() to estimate parameters for both Gaussian and Student‑t distributions, enabling a direct comparison of log‑likelihoods.gt: Provides professional table rendering. It allows us to format numbers, apply color scales, and highlight audit warnings, turning raw statistical output into a visually interpretable audit table.library(tidyverse) # Load tidyverse for data manipulationlibrary(tidyquant) # Load tidyquant for financial data retrievallibrary(MASS) # Load MASS for distribution fittinglibrary(gt) # Load gt for table renderingticker % data_color( columns = c(Gaussian_Density, StudentT_Density), colors = scales::col_numeric( palette = c("lightblue","darkblue"), domain = range(c(audit_tbl$Gaussian_Density, audit_tbl$StudentT_Density), na.rm = TRUE) ) ) %>% data_color( columns = c(Volume_Impact), colors = scales::col_numeric( palette = c("pink","red"), domain = c(min(audit_tbl$Volume_Impact, na.rm = TRUE), max(audit_tbl$Volume_Impact, na.rm = TRUE)) ) ) %>% text_transform( locations = cells_body(columns = vars(Audit_Warning)), fn = function(x) { ifelse(x == "INFO-DRIVEN", "INFO-DRIVEN", "LIQUIDITY-DRIVEN") } )audit_gtTo leave a comment for the author, please follow the link and comment on their blog: DataGeeek.R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.Continue reading: Understanding Tail Analysis in Financial Markets