Decision Making

Representativeness Heuristics

Heuristics are mental shortcuts or straightforward rules of thumb, often developed from past experiences, used to make quick decisions. While it helps enormously to cut down time and effort to make decisions – decisions are taxing to the brain – occasionally, it can also lead to troubles. For example, a popular heuristic, the availability bias, makes us think that we live in an era of violence more than ever before, thanks to the day-to-day images we see in the media.

Here, we look at another one – the representativeness heuristics. The best way to describe it is:
“If it looks like a duck, swims like a duck, and quacks like a duck, then it probably is a duck”.

In representativeness heuristics, when compelled to make a decision, one compares herself with a prototype (or stereotype) of an event or behaviour she already has in mind.

In the famous Linda’s Problem, the image of a girl who participates in a demonstration drives us to tag her as a feminist.

A known example with more serious implications is racial profiling. It is when the police search for a crime suspect or an airport security officer doing random checks disproportionately focus on blacks or people of colour.

Representativeness Heuristics Read More »

Happiness and PCA

Let’s do a principal component analysis of the underlying variables in the estimation of the Happiness Index. They are

Real GDP per capita
Social support
Healthy life expectancy
Freedom to make life choices
Generosity
Perceptions of corruption

The objective is to see how countries are clustered together in the PCA.

Happiness and PCA Read More »

PCA of NBA Players

Let’s now move to NBA. Following is the PCA biplot of the ESPN top 40 NBA players of the regular season 2022-23.

We can see a few things:
1) Damian Lillard and Steph Curry are in a cluster which is closer to the vector 3PM (three points made)
2) A few centres are closer to each other, and the vector BLKPG (blocks per game) is closer to them.
3) Jokic and Giannis are placed somewhere far away.
4) APG (assists per game) and TOPG (turnover per game) are similar contributions (negative) to the principal component 2. The leaders, Harden, Haliburton and Young, are closer to the APG vector.
5) Centres and power forwards dominate the right side of principal component 1, whereas the guards take the left.

We see 3PM and FG% (field goal percentages) diametrically opposite to each other, suggesting they are negatively correlated.

And, if you are wondering who they are:

The data are taken from the ESPN site using the following R code:

library(rvest)
nba_23 <- read_html("https://www.espn.com/nba/seasonleaders")
nba_23 <- nba_23 %>% html_table(fill = TRUE)

Followed by a few clean-up steps

nba_data <- as.data.frame(nba_23)
names(nba_data) <- nba_data[2,]
nba_data <- nba_data[-1:-2,]
index <- which(nba_data$PLAYER == "PLAYER")
nba_data <- nba_data[-index,]
nba_data <- nba_data %>% mutate_at(vars(GP, MPG, `FG%`, `FT%`, `3PM`, RPG, APG, STPG, BLKPG, TOPG, PTS), as.numeric)

References

2022-2023 NBA Season Leaders: ESPN

PCA of NBA Players Read More »

Principal Component Analysis Applied

Let’s apply what we learned in the ‘mtcars’ data. We use R to perform the calculations. We require two packages, ‘stats’ and ‘ggbiplot’, to do the job.

library(stats)
library(ggbiplot)

Start with the simplest first – two variables – mpg and disp

data("mtcars")
car_data <- mtcars
mtcars.pca <- prcomp(car_data[,c(1,3)], center = TRUE,scale. = TRUE)
ggbiplot(mtcars.pca,
  ellipse = TRUE,
  labels = rownames(car_data)
)

You can see a few clusters – things on the right, left and centre. You can also see two arrows, one corresponding to mpg and another to disp. It’s true we don’t need to do a PCA for two variables; a 2-D can do the job already.

You can already start interpreting the PCA plot. The Cadilac and Lincoln are closer to the disp line in the PCA plot, which is towards the northwest of the Displacement vs Mileage plot. On the other hand, Honda, Porche etc., are closer to the mpg axis.

mtcars.pca <- prcomp(car_data[,c(1,3, 6, 7)], center = TRUE,scale. = TRUE)
ggbiplot(mtcars.pca)
ggbiplot(mtcars.pca,
  ellipse = TRUE,
  labels = rownames(car_data)#,
)

Principal Component Analysis Applied Read More »

Principal Component Analysis – The Concept

Last time we saw the practical difficulty of analysing data from four or more measured variables. The demands a means of reducing the numbers to two so that it appears on a 2-D plot but gives the message we want – that similar candidates cluster together.

In other words, one must perform necessary mathematical manipulations to convert the parameters to a different set of variables (principal components), select the top two or the principal components, and plot them. All these happen without losing much of the information embedded inside it.

PCA is the technique of compressing data from a large set of measurements into a smaller number of independent (i.e., uncorrelated) variables that captures the core of the original data. Note that the principal component themselves are linear combinations of the original variables.

The first principal component, which becomes the X-axis, defines the direction of the maximum variation of data.

Principal Component Analysis – The Concept Read More »

Principal Component Analysis – Building the Case

Do you remember the “mtcars” dataset? It’s data collected from the 1974 Motor Trend US magazine and it comprises fuel consumption and ten aspects of automobile design and performance for 32 automobiles (1973–74 models). We’ll use it to explain the concept of principal component analysis or PCA.

If we measure only one aspect, we can present the data on a line plot:

You can see that Toyota Corolla, Fiat 128 etc., are similar to each other, and have relatively higher mileage values, whereas Cadillac Fleetwood and Lincoln Continental have lower.

If we measure two properties, we can present the data in a 2-D graph.

If we measure one more property, we would add one more axis to the graph for a 3-D plot. But what happens if we have four or more parameters? PCA can take four or more measurements and make a 2-D PCA plot.

Principal Component Analysis – Building the Case Read More »

The Lost Diamond of Bayes

Here is a problem that combines combinations with Bayes’s rule. A card is lost from the 52-card deck. Two cards are drawn from the deck and found to be both diamonds. What is the probability that the lost card is a diamond?

Let’s write down Bayes’ equation first.

P(L_D|2_D) = \frac{P(2_D|L_D)*P(L_D)}{P(2_D|L_D)*P(L_D) + P(2_D|L_{nD})*P(L_{nD})}

P(LD|2D) = The probability that the lost card is a diamond, given two diamonds are drawn.
P(2D|LD) = The probability of drawing two diamonds if the lost card is a diamond
P(LD) = The probability of losing a diamond.
P(2D|LnD) = The probability of drawing two diamonds if the lost card is not a diamond
P(LnD) = The probability of losing a card other than a diamond.

Evaluating each term,
As there are 13 diamonds in a pack of 52 cards, P(LD) is 13 in 52 (13/52 = 1/4), and P(LnD) is 52-13 in 52 (3/4).
P(2D|LD), or the probability of drawing two diamonds from a deck with a missing diamond, is 12C2 / 51C2 = 12 x 11 / (51 x 50).
P(2D|LnD), or the probability of drawing two diamonds from a deck with a missing non-diamond, is 13C2 / 51C2 = 13 x 12 / (51 x 50).

\\ P(L_D|2_D) = \frac{\frac{12*11}{51*50}*\frac{1}{4}}{\frac{12*11}{51*50}*\frac{1}{4} + \frac{13*12}{51*50}*\frac{3}{4}} \\ \\ \frac{12*11*(1/4)}{12*11*(1/4) + 13*12*(3/4)} = \frac{11}{50}

P(LD|2D) = 11/50 = 22%

The Lost Diamond of Bayes Read More »

Summary Statistics of Linear Transformations

Here are the summary statistics for 31 daily high temperatures of a location in degrees Fahrenheit. What are the corresponding numbers in degrees Celcius?

Mean86.6oF
Median87.3oF
Standard Deviation5.2oF
Variance27.04oF

Central tendency and variability during transformations

A few exercises before try and estimate the answer.

A few exercises before try and estimate the answer. Consider three numbers, 5,6,7. The mean, median, standard deviation and variance o the collection are 6, 6, 1 and 1.

Now add 3 to each and find the summary statistics:

The new set is 8, 9, and 10 and the summary is 9, 9, 1, 1. The mean and median of the new set are just 3 more than the original, and the variance and the standard deviations are unchanged.

Multiply each by 4 and the summary statistics:

The new set is 20, 24, and 28 and the summary is 24, 24, 4, 16. The mean and median of the new set a4 times the original, and the variance is 4 times and the standard deviation is 42 times.

Transformation of oF to oC

The relationship (which is a linear transformation is)

C = (5/9) x (F – 32)

C = -(160/9) + (5/9) F

Applying what we learned earlier,

Mean in oC = -(160/9) + (5/9) x 86.6 = 30.3
Median in oC = -(160/9) + (5/9) x 87.3 = 30.7
Standard deviation in oC = (5/9) x 5.2 = 2.89
Variance in oC = (5/9)2 x 5.22 = 8.35

Linear Transformations: jbstatistics

Summary Statistics of Linear Transformations Read More »

Geometric Distribution

One in five cars in the city is green. What is the probability that the fifth car is the first green car?

We already know we can solve this problem using the negative binomial distribution function. But there is a special one for these types – where the arrival time of the first in question. That is the geometric distribution. The formal expression of the probability that the first occurrence of success requires k independent trials, each with success probability p is

\\ P(X = k) = p * (1-p)^{k-1}

To answer the question in the beginning, we substitute p = 0.20 (one in fifth), car number = 5; the required probability is (0.2)*(1-0.2)4 = 0.08192

The R code for the same calculation is

dgeom(4, prob = 0.2, log = FALSE)

The below geometric distribution chart shows the probability of seeing the first green car in precisely 1, 2, 3, etc. rolls, up to 30.

Geometric Distribution Read More »

The Big “But” Fallacy

The big but fallacy involves starting with a generally accepted statement only to negate it at the end with a but. An example is: “Yes, it is wrong to hurt animals, but this time it was different (as I was hungry!)”.

The fallacy is closely related to what is known as the “special pleading”. Here, the ‘but’ gives the ‘special’ exception from the generally accepted rules or ethics.

The Big “But” Fallacy Read More »