All

Borda count Method

Border Count is another method to determine the winner of a voting scheme. As per Wiki, the technique was first proposed in 1435 by Nicholas of Cusa but is named after the French mathematician Jean-Charles de Borda, who developed the system in 1770.

In this method, points are given to candidates based on their ranking:

  1. The last one gets 1 point
  2. The second-to-last gets 2 points, and so on.
  3. The points are totalled, and the one who gets the maximum points is the winner.

Here is our previous example:

# Voters412513263015
1st ChoiceLLFFCC
2nd ChoiceFCLCFL
3rd ChoiceCFCLLF

Points are given as follows:
First place: 3 points
Second Place: 2 points
Third place: 1 point

# Voters412513263015
1st Choice
(3 pts)
L
41×3
123
L
25×3
75
F
13×3
39
F
26×3
78
C
30×3
90
C
15×3
45
2nd Choice
(2 pts)
F
41×2
82
C
25×2
50
L
13×2
26
C
26×2
52
F
30×2
60
L
15×2
30
3rd Choice
(1 pt)
C
41×1
41
F
25×1
25
C
13×1
13
L
26×1
26
L
30×1
30
F
15×1
15

L: 123 + 75 + 26 + 30 + 26 + 30 = 310 points
F: 39 + 78 + 82 + 60 + 25 + 15 = 299 points
C: 90 + 45 + 50 + 52 + 41 + 13 = 291 points

Under the Borda count method, L is the winner.

Borda count Method Read More »

Charlie Munger’s Wisdom – Continued

We saw the first 10 of the 24 Cognitive Biases from Charlie Munger’s 1995 speech – Human Misjudgement. In this post, we will go through the rest.

11. Bias from deprival super-reaction syndrome: This is akin to the loss aversion bias, illustrating how we react when possessions, even trivial ones, are taken away. Consider, for instance, the intensity of employee-management negotiations where every inch is fiercely contested.

12. Bias from envy/jealousy:

13. Bias from chemical dependency, 14. Bias from gambling dependency: These biases don’t need a lot of explanation. They trigger attentional bias, leading individuals to allocate disproportionally more attention to addiction-relevant cues than to neutral stimuli. Businesses, whether pubs or casinos, are well-versed in exploiting these vulnerabilities. Being aware of these tactics can help you navigate such situations more effectively.

15. Bias from liking distortion: It’s about liking oneself, one’s ideas, and community. And making stupid ideas only because they came from someone you liked.

16. Bias from disliking distortion: Opposite of liking distortion. In this case, you dismiss ideas from people who you don’t like.

17. Bias from the non-mathematical nature of the human brain: Human brains in their natural state (i.e., untrained state) are notoriously inefficient when dealing with probabilities. Within this entity, Munger conveniently folds various fallacies of the human mind – crude heuristics, availability, base-rate neglect, hindsight – into one.

18. Bias from fear of scarcity: The fear of scarcity can bring out pure dumbness in otherwise perfectly normal people. A familiar example is the toilet paper rush during the early days of the Covid pandemic.

19. Bias from sympathy: It’s about leaders keeping employees with dubious personal qualities. Often, this happens out of pity for the person or her family. Munger says that while paying them the proper severance is essential, keeping such people in jobs can make the whole organisation poor.

20. Bias from over-influence and extra evidence:

21. Bias caused by confusion due to information not being properly processed by the mind: Munger stresses the need to understand the reasons (answer to the question – why?) for the information to be properly registered in the brain. Like for individuals themselves, it is also important for people to explain the reasoning clearly while communicating the key decisions and proposals to their stakeholders.

22. Stress-induced mental changes: What later happened to the Pavlovian dogs (conditioned for certain behaviours) after their cages were flooded was a good example of what stress can do. The canines forgot all the training and responses that they had acquired.

23. Common mental declines:

24. Say-something syndrome: It’s a habit of many individuals to do the talk irrespective of their expertise and capacities to impact the decision-making process. They remain just soundbites, and Munger cautions to watch out for those quiet selves that eventually add quality.

Charlie Munger’s Wisdom – Continued Read More »

Charlie Munger’s Wisdom

One of the greatest investors in history, Charles Munger, passed away on the 28th of November 2023, 33 days short of his 100th birthday. His celebrated talk at Harvard University in 1995 on the subject of ‘Human Misjudgment’ is undoubtedly a masterclass about the patterns of human irrationality. This and the next posts are about those 24 tendencies of the human brain that Mr Munger has immortalised in his celebrated lecture.

1. Underrecognition of the power of incentives: Munger illustrates his point using the cases of FedEx and Xerox, demonstrating that it was not logic but incentives that drove their employees. The incentives were intended to speed up work and improve sales. However, the workers maximised the commissions and overtime by selling inferior products and working longer.

2. Psychological denial: It is a type of mechanism by the brain to avoid reality, as it can cause deep pain and anxiety. Examples are parents refusing to believe the loss of their children or youths getting into crimes.

3. Incentive-caused bias: It’s also known as the Principal-Agent problem in companies. The people entrusted to lead companies (on behalf of the owners/shareholders) erode the long-term value of companies (principals’ interest) by going after short-term fixes or management’s vested interests (agent’s gain).

4. Self-confirmation bias: People tend to persist on already-made conclusions even when (newly) available evidence disproves them.

5. Bias from cognitive dissonance: It is similar to the earlier one. Cognitive dissonance bias is the mental discomfort that a person goes through if they have to hold two conflicting views about something. Most often, the receiver of the new information revolts with it, leading to selective perception and decision-making.

6. Bias from Pavlovian association: This refers to the famous experiments on dogs carried out by Pavlov. The experiments prove a great deal about the mental shortcuts of humans in making decisions. In other words, people choose a ‘go’ for an incentive stimulus, whereas they select a ‘no go’ on punishment stimuli. A wonderful example is how advertisements work in our minds.

7. Bias from reciprocation tendency: Humans return favour when they receive something from others. While this may seem a virtue, the behaviour can be manipulated, compelling individuals to substantially lower the cost of services.

8. Bias from over-influence of social proof: This is the absolute compliance to the ‘wisdom of the crowd’ or inability to act against social norms. Social proof works in unclear social situations where people follow what the surrounding people do. Munger gives an example of how all major oil companies started buying fertiliser companies when one of them initiated the trend. Another term closely related to this topic is the ‘power of reinforcement‘. Typical causes of bull or bear runs of stock markets.

9. Bias from distortions caused by distortion, sensation, and perceptions: In Cialdini’s famous experiment, students who first dipped their hands in hot water felt cold and cold water felt hot on a subsequent dip in the water at room temperature. He cites the familiar trick of a real estate broker who manages to sell her client a moderately over-priced house by first showing an outrageously overpriced house.

10. Bias from over-influence by authority: It is a tendency of the brain to be influenced by the opinion of an authority figure, even when the content is inaccurate. Like all cognitive biases, the authority bias is a shortcut our brains use to save energy in decision-making.

Reference

The Psychology of Human Misjudgement – Charlie Munger Full Speech: Warren Buffett

Charlie Munger’s Wisdom Read More »

Voting Theory: Instant Runoff

Instant run-off voting, also called the plurality with elimination, is a modification of the plurality method. This method removes the candidate with the least first-place votes, and the votes for the now-eliminated candidate are redistributed to the voter groups’ next choice. It continues until a candidate gets the majority (> 50%).

# Voters412513263015
1st ChoiceLLFFCC
2nd ChoiceFCLCFL
3rd ChoiceCFCLLF

Look at the previous example: L (for library) wins after getting 66 out of the possible 150 votes. For a majority, a candidate must get 76 votes.
L: 66
F: 39
C: 45
IRV method eliminated the last one, F. The table now looks like the following.

# Voters412513263015
1st ChoiceLLCC
2nd ChoiceCLCL
3rd ChoiceCCLL

The two empty entries against the 1st choice now go to the ones below – 13 to L and 26 to C. The updated votes are:
L: 79
C: 71

L now becomes the winner of the Instant run-off voting method.

Voting Theory: Instant Runoff Read More »

Condorcet Criterion

In the earlier post, we saw how the plurality method of voting works. In the plurality method, the choice with the most first preference votes is declared the winner. In the example, the library won the election event (with 66 out of 150 first-choice votes), although it did not get a majority.

# Voters412513263015
1st ChoiceLLFFCC
2nd ChoiceFC LCFL
3rd ChoiceCFCLLF

Condorcet criterion

If there is a winner in this case that wins every one-to-one comparison, we call it a Condorcet winner. Let’s find out who the Condorcet winner is in the earlier example.

Step 1: Ignore the one not in the comparison
Step 2: Add all votes of each
Step 3: The one that has the most votes is the winner of the matchup

L vs F

# Voters412513263015
1st ChoiceLLFF
2nd ChoiceFLFL
3rd ChoiceFLLF

L is preferred over F by 41 + 25 + 15 = 81 votes
F is preferred over L by 13 + 26 + 30 = 69 votes
L wins the matchup

C vs F

# Voters412513263015
1st ChoiceFFCC
2nd ChoiceFC CF
3rd ChoiceCFCF

C = 25 + 30 + 15 = 70
F = 41 + 13 + 26 = 80
F wins

L vs C

# Voters412513263015
1st ChoiceLLCC
2nd ChoiceC LCL
3rd ChoiceCCLL

L = 41 + 25 + 13 = 79
C = 26 + 30 + 15 = 71
L wins

Since L wins both its one-to-one comparisons, it becomes the Condorcet winner.

Condorcet Criterion Read More »

Voting Theory: Plurality Method

In the plurality method, the choice with the most first preference votes is declared the winner. It is possible to have a winner in the plurality method without having a majority over 50%. Here is an example of a preference table:

Six voting blocks made their preferences for a city project. The options are to build a Library (L), Fitness Centre (F) or a commercial complex (C).

# Voters412513263015
1st ChoiceLLFFCC
2nd ChoiceFCLCFL
3rd ChoiceCFCLLF

Here are the aggregates of first-choice votes for each option.

ChoiceVotes%
Library(L)6666/150
= 44
Fitness (F)3929/150
= 26
commercial (C)4545/150
= 30

The library is the winner.

The plurality method can potentially violate fairness criteria as the final choice is not guaranteed to win in all one-to-one comparisons. One of them is the Condorcet Criterion.

Voting Theory: Plurality Method Read More »

Proximity in a Meeting

Amy and Becky are two friends invited to a 5-member committee meeting. What is the probability that they get seats next to each other if:
1. the member seats are arranged in a round table
2. the member seats are arranged in a row

Seated around a roundtable

Given that Amy is seated as denoted in the figure, Becky can sit next to her if she gets one of the two seats marked as Betty. In a random seating assignment case, the probability for that to happen is 2 out of 4 or the probability for the two seated side by side is 2/4 = 50%

Seated in a row

As we did before, let’s place Amy first.
In the end – two such places (E)
In the middle – three such places (M)

Only one person can be next to the position E’s, but two positions are possible for M’s. A series of AND and OR rules estimate the overall possibility.

(Amy on E1 OR E2) AND (Becky on position 1) OR (Amy of M2 OR M3 OR M4) AND (Becky on position 1 OR Position 2).
(1/5+1/5) x (1/4) + (1/5+1/5+1/5) x (1/4 + 1/4)
2/20 + 6/20 = 8/20 = 40%

Reference

How To Solve Bloomberg’s Random Seating Interview Question: MindYourDecisions

Proximity in a Meeting Read More »

Multiple Regression – Non-Linear Transformations

If you recall one of the previous posts relating ‘lstat’ with ‘medev’, we noticed the apparent curvature of the relationship. And how slightly awkward the fit-line on top of the scatter plot was.

This seeming ‘non-linearity’ prompts us to extend the linear model to non-linear. We use a quadratic term by squaring the predictor (‘lstat’). We must use the identity function to do this.

fit5 <- lm(medv ~ lstat + I(lstat^2), Boston)

The results are presented below:

Call:
lm(formula = medv ~ lstat + I(lstat^2), data = Boston)

Residuals:
     Min       1Q   Median       3Q      Max 
-15.2834  -3.8313  -0.5295   2.3095  25.4148 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept) 42.862007   0.872084   49.15   <2e-16 ***
lstat       -2.332821   0.123803  -18.84   <2e-16 ***
I(lstat^2)   0.043547   0.003745   11.63   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 5.524 on 503 degrees of freedom
Multiple R-squared:  0.6407,	Adjusted R-squared:  0.6393 
F-statistic: 448.5 on 2 and 503 DF,  p-value: < 2.2e-16

Now, let’s compare the fit results.

plot(medv~lstat, Boston)
points(Boston$lstat, fitted(fit5), col = "red", pch = 8)

Multiple Regression – Non-Linear Transformations Read More »

Multiple Regression Continued

Continuing from the previous post, we will add all the predictors in the regression this time. The notation is response variable ~ followed by ‘.’ [dot].

fit3 <- lm(medv~., Boston)
summary(fit3)
Call:
lm(formula = medv ~ ., data = Boston)

Residuals:
     Min       1Q   Median       3Q      Max 
-15.1304  -2.7673  -0.5814   1.9414  26.2526 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept)  41.617270   4.936039   8.431 3.79e-16 ***
crim         -0.121389   0.033000  -3.678 0.000261 ***
zn            0.046963   0.013879   3.384 0.000772 ***
indus         0.013468   0.062145   0.217 0.828520    
chas          2.839993   0.870007   3.264 0.001173 ** 
nox         -18.758022   3.851355  -4.870 1.50e-06 ***
rm            3.658119   0.420246   8.705  < 2e-16 ***
age           0.003611   0.013329   0.271 0.786595    
dis          -1.490754   0.201623  -7.394 6.17e-13 ***
rad           0.289405   0.066908   4.325 1.84e-05 ***
tax          -0.012682   0.003801  -3.337 0.000912 ***
ptratio      -0.937533   0.132206  -7.091 4.63e-12 ***
lstat        -0.552019   0.050659 -10.897  < 2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 4.798 on 493 degrees of freedom
Multiple R-squared:  0.7343,	Adjusted R-squared:  0.7278 
F-statistic: 113.5 on 12 and 493 DF,  p-value: < 2.2e-16

The obvious questions that come here are:

  1. Was this a helpful exercise?
  2. Which variables are better at predicting the response?

To answer the first question, we look at the results from two parameters, the R2 and F values. They both signify how the variance around the model is away from that around the mean. R-squared of 0.7343 and F-statistic = 113.5 are good enough to justify this activity.

The clues to the second question are also in the results (the stars at the end of the coefficients). The results show that two variables, ‘Indus’ and ‘age’, have very low significance (high p-values). So, we remove the least damaging predictors to the model and reevaluate using the ‘update’ command.

fit4 <- update(fit3, ~.-age-indus)
summary(fit4)
Call:
lm(formula = medv ~ crim + zn + chas + nox + rm + dis + rad + 
    tax + ptratio + lstat, data = Boston)

Residuals:
     Min       1Q   Median       3Q      Max 
-15.1814  -2.7625  -0.6243   1.8448  26.3920 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept)  41.451747   4.903283   8.454 3.18e-16 ***
crim         -0.121665   0.032919  -3.696 0.000244 ***
zn            0.046191   0.013673   3.378 0.000787 ***
chas          2.871873   0.862591   3.329 0.000935 ***
nox         -18.262427   3.565247  -5.122 4.33e-07 ***
rm            3.672957   0.409127   8.978  < 2e-16 ***
dis          -1.515951   0.187675  -8.078 5.08e-15 ***
rad           0.283932   0.063945   4.440 1.11e-05 ***
tax          -0.012292   0.003407  -3.608 0.000340 ***
ptratio      -0.930961   0.130423  -7.138 3.39e-12 ***
lstat        -0.546509   0.047442 -11.519  < 2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 4.789 on 495 degrees of freedom
Multiple R-squared:  0.7342,	Adjusted R-squared:  0.7289 
F-statistic: 136.8 on 10 and 495 DF,  p-value: < 2.2e-16

An introduction to Statistical Learning: James, Witten, Hastie, Tibshirani, Taylor

Multiple Regression Continued Read More »

Multiple Linear Regression in R

We have seen linear regression before as a simple method in supervised learning. It is of two types – simple and multiple linear regressions. In simple, we write the dependent variable (also known as the quantitative response) Y as a function of the independent variable (predictor) X.

\\ Y \approx f(X) \\ \\ Y \approx \beta_0 + \beta_1 X

Beta0 and beta1 are the model coefficients or parameters. You may realise they are the intercept and slope of a line, respectively. An example of a simple linear regression is a function predicting a person’s weight (response) from her height (single predictor).

Multiple linear regression

Here, we have more than one predictor. The general form for p predictors is:

Y \approx \beta_0 + \beta_1 X_1 + \beta_2 X_2 + ... + \beta_p X_p

We use the Boston data set from the library ISLR2 for the R exercise. The library contains ‘medv’ (median house value) for 506 census tracts in Boston. We will predict ‘medv’ using 12 predictors such as ‘rm’ (average number of rooms per house), ‘age’ (proportion of owner-occupied units built before 1940), and ‘lstat’ (per cent of households with low socioeconomic status).

First, we do the simple linear regression with one predictor, ‘lstat’.

fit1 <- lm(medv~lstat, Boston)
summary(fit1)
Call:
lm(formula = medv ~ lstat, data = Boston)

Residuals:
    Min      1Q  Median      3Q     Max 
-15.168  -3.990  -1.318   2.034  24.500 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) 34.55384    0.56263   61.41   <2e-16 ***
lstat       -0.95005    0.03873  -24.53   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 6.216 on 504 degrees of freedom
Multiple R-squared:  0.5441,	Adjusted R-squared:  0.5432 
F-statistic: 601.6 on 1 and 504 DF,  p-value: < 2.2e-16

Here is the plot with points representing the data and the line representing the model fit.

fit1 <- lm(medv~lstat, Boston)
plot(medv~lstat, Boston)
abline(fit1, col="red")

We will add another predictor, age, to the regression table.

fit2 <- lm(medv~lstat+age, Boston)
summary(fit2)
Call:
lm(formula = medv ~ lstat + age, data = Boston)

Residuals:
    Min      1Q  Median      3Q     Max 
-15.981  -3.978  -1.283   1.968  23.158 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) 33.22276    0.73085  45.458  < 2e-16 ***
lstat       -1.03207    0.04819 -21.416  < 2e-16 ***
age          0.03454    0.01223   2.826  0.00491 ** 
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 6.173 on 503 degrees of freedom
Multiple R-squared:  0.5513,	Adjusted R-squared:  0.5495 
F-statistic:   309 on 2 and 503 DF,  p-value: < 2.2e-16

beta_0 is 33.22, beta_1 is -1.03 and beta_2 is 0.034. All three are significant, as evidenced by their low p-values (Pr(>|t|)). We will add more variables next.

An introduction to Statistical Learning: James, Witten, Hastie, Tibshirani, Taylor

Multiple Linear Regression in R Read More »