fightr is a statistical framework for analyzing combat sports data in R.
Because the landscape of mixed martial arts changes weekly, shipping static data inside a package quickly becomes obsolete. fightr solves this by utilizing a CRAN-compliant local caching architecture to dynamically fetch the latest UFC data from GitHub.
Beyond data retrieval, fightr provides a robust, mathematically rigorous modeling suite to estimate latent fighter ability parameters and predict bout outcomes using advanced maximum likelihood estimation techniques and network subgraphing.
fightr provides seamless access to three core, dynamically updated datasets (ufc_athletes, ufc_fights, and ufcstats_data). The package uses a polite caching mechanism—if the data is missing or stale (older than 7 days), it automatically downloads the latest versions in the background.
library(fightr)
# Loads from local cache, fetching updates automatically if needed
athletes <- get_ufc_data("ufc_athletes")
fights <- get_ufc_data("ufc_fights")
# Force a manual refresh of all datasets
update_all_ufc_data()The core analytical engine of fightr is model_fight_outcome(). This function predicts the probability of a win and the specific method of victory (KO/TKO, Submission, Decision) for any hypothetical or scheduled matchup.
It supports three distinct statistical frameworks:
"multinomial"): A baseline model utilizing 19 distinct fighter differentials (age, reach, striking/grappling metrics) to predict specific fight outcomes."bradley-terry"): A pairwise comparison model utilizing a Logit link function. It builds a historical degree-2 subgraph around the selected fighters to estimate unobserved ability parameters (), weighted by their individual historical prop rates."thurstone-mosteller"): A variation of the pairwise comparison framework utilizing a Probit link function, assuming normally distributed latent performance levels.
library(fightr)
# Predict an outcome using the Bradley-Terry subgraph model
matchup_model <- model_fight_outcome(
fighter1 = "Islam Makhachev",
fighter2 = "Alexander Volkanovski",
method_type = "bradley-terry"
)
# The function returns an S3 object containing the fitted model and predictions
print(matchup_model$method_probs)By default, model_fight_outcome() generates a clean ggplot2 visualization of the prop odds spread. The plot object is stored within the returned list for easy extraction and further customization.
# Extract and display the probability chart
matchup_model$plotFuture releases of fightr will continue to expand the analytical toolset:
multinom and BTm objects.fightr strictly adheres to CRAN repository policies regarding user data and file system modification. The package will never silently download data or write to your file system upon running library(fightr). All downloads require an explicit function call by the user, and all cached data is stored safely in tools::R_user_dir("fightr", which = "cache").