Articles by kjytay

Comparing the Bradley Terry model to betting odds

February 5, 2022 | kjytay

In this previous post, I described the Bradley-Terry model and showed how we could use it to predict game outcomes in the NBA 2018-19 regular season. After ffitting the Bradley-Terry model on the first half of the regular season (with … Continue reading →
[Read more...]

What is the Bradley-Terry model?

February 1, 2022 | kjytay

The Bradley-Terry model The Bradley-Terry model, named after R. A. Bradley and M. E. Terry, is a probability model for predicting the outcome of a paired comparison. Imagine that we have teams competing against each other. The model assigns team … Continue reading →
[Read more...]

Playing Wordle in R

January 18, 2022 | kjytay

The game Wordle has taken the world (or at least my facebook feed) by storm. It’s a really simple word game that’s a lot like the classic Mastermind. Here are the rules from the Wordle website: The logic behind the … Continue reading →
[Read more...]

Simulating dice bingo

December 30, 2021 | kjytay

Note: This post was inspired by the “Classroom Bingo” probability puzzle in the Royal Statistical Society’s Significance magazine (Dec 2021 edition). Set-up Imagine that we are playing bingo, but where the numbers are generated by the roll of two 6-sided … Continue reading →
[Read more...]

Verifying a stat from The Athletic NBA Show

December 18, 2021 | kjytay

A few weeks ago, I was listening to The Athletic NBA Show podcast (Episode 581: “5 Players I was wrong about, 20 Games in Contenders, and Sam Vecenie on the 2021 Rookie Class”) and the following statistic caught my attention: … Continue reading →
[Read more...]

What is the Atkinson index?

October 14, 2021 | kjytay

What is the Atkinson index? The Atkinson index, introduced by Atkinson (1970) (Reference 1), is a measure of inequality used in economics. Given a population with values and an inequality-aversion parameter , the Atkinson index is defined as If we … Continue reading →
[Read more...]

Getting predictions from an isotonic regression model

July 29, 2021 | kjytay

TLDR: Pass the output of the isoreg function to as.stepfun to make an isotonic regression model into a black box object that takes in uncalibrated predictions and outputs calibrated ones. Isotonic regression is a method for obtaining a monotonic fit … Continue reading →
[Read more...]

Using different fonts with ggplot2

July 8, 2021 | kjytay

I was recently asked to convert all the fonts in my ggplot2-generated figures for a paper to Times New Roman. It turns out that this is easy, but it brought up a whole host of questions that I don’t have … Continue reading →
[Read more...]

Documentation for internal functions

June 10, 2021 | kjytay

tl;dr: To avoid triple quotes and R CMD CHECK --as-cran errors due to documentation examples for internal functions, enclose the example code in \dontrun{}. I recently encountered an issue when submitting an R package to CRAN that I couldn’t find … Continue reading →
[Read more...]

Small gotcha when using negative indexing

May 26, 2021 | kjytay

Negative indexing is a commonly used method in R to drop elements from a vector or rows/columns from a matrix that the user does not want. For example, the code below drops the third column from the matrix M: Now, … Continue reading → [Read more...]

Introducing cvwrapr for your cross-validation needs

May 25, 2021 | kjytay

TLDR: I’ve written an R package, cvwrapr, that helps users to cross-validate hyperparameters. The code base is largely extracted from the glmnet package. The R package is available for download from Github, and contains two vignettes which demonstrate how to … Continue reading →
[Read more...]

What is the Tukey loss function?

April 23, 2021 | kjytay

The Tukey loss function The Tukey loss function, also known as Tukey’s biweight function, is a loss function that is used in robust statistics. Tukey’s loss is similar to Huber loss in that it demonstrates quadratic behavior near the origin. … Continue reading →
[Read more...]

Is the EPL getting more unequal?

April 11, 2021 | kjytay

I recently heard that Manchester City were so far ahead in the English Premier League (EPL) that the race for first was basically over, even though they were still about 6-7 more games to go (out of a total of … Continue reading →
[Read more...]

Estimating pi using the method of moments

March 14, 2021 | kjytay

Happy Pi Day! I don’t encounter very much in my area of statistics, so this post might seem a little forced… In this post, I’m going to show one way to estimate . The starting point is the integral identity … Continue reading →
[Read more...]
1 2 3 5

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)