May 2022

One-Tailed Or Two-Tailed?

So how do you decide whether to choose one-tailed or two-tailed? It is not as straightforward as it may sound. Let’s look at the distributions that we have seen in the last post. So, first, the two-tailed test.

The shaded area represents the probability that a value will fall within the range. The smaller the value, you attain more confidence to reject the default – the null hypothesis. In this case, I have calculated the sum of the two regions to be 0.05. I guess you know what it means? It represents the alpha (significance level) of 5%.

Mean salary of 30k

So, if the null hypothesis (H0) was that the mean salary of engineers is exactly 30k, you can easily prove it is not the case if you find a sample mean of more than 35.9 or less than 24.1. Mathematically, it is:

\\ H_0 = 30 \\ \\ H_A \neq 30

So far, so good.

What will you do if you decide to prove only the higher side of the claim? i.e., you want to establish that the salary is more than 30k. That will mean the following shaded area of the distribution.

\\ H_0 = 30 \\ \\ H_A > 30

You can now see the problem: you can claim you have achieved the same 5% alpha at a sample mean of 35k.

In case you are wondering from where I got these 34.9, 24.1 and 35, try typing the following R codes.

pnorm(34.95, 30, 3, lower.tail = FALSE) # gives an answer 0.049 for one-tailed. 

1 - pnorm(35.9, 30, 3) + pnorm(24.1, 30, 3) # gives 0.049 for two-tailed. 
#the above code is equivalent to 
pnorm(35.9, 30, 3, lower.tail = FALSE) + pnorm(24.1, 30, 3, lower.tail = TRUE)

pnorm represents the cumulative density function of a normal distribution with a mean = 30 and the standard deviation = 3.

One-Tailed Or Two-Tailed? Read More »

One-Tailed and Two-Tailed test

We have seen the significance value alpha as the threshold probability of rejecting the null hypothesis. Let us illustrate it graphically. Consider this hypothesis: The average weighting time of the ticket counter is more than 30 minutes. The null and alternate hypotheses are:

H0: average less than or equals 30
HA: average more than 30

To establish your theory, you need to prove that the mean is greater than 30 (HA) beyond doubt. In the following illustration, the right-hand side tail provides the region you need to show your measured waiting time. That gives the alpha probability for the H0 to be valid.

Consider this: the starting monthly salary of computer engineers is $30k. The alternate hypothesis needs to prove this is not the case, the number may be lower or higher (two extremes or tails).

H0: average = $30k
HA: average not equal to $30k

One-Tailed and Two-Tailed test Read More »

Setting the Evidentiary Standard

We will continue with the basic terms of hypothesis testing. The first one is the significance level. Alpha, as popularly known, is set by the person in charge of the testing and signifies the strength of the evidence required to establish the tester’s proposition (alternative hypothesis). We are familiar with the alpha of 0.05 (5%). But how does one choose the right level?

The famous analogy is the court cases. For civil cases (deal with personal rights), scholars define 51% of the evidence to support a claim. On the other hand, criminal cases may require far more, say, more than 90% of the evidence, for a verdict against the suspect. It may go to 99% when the potential punishment of the guilty is severe. You may look back at an older post to see the significance of where the judges draw their lines.

In the same way, the analyst may decide on a stricter significance level or a lower probability of rejecting the null hypothesis if the stakes are high. Putting it differently, an alpha of 0.01 means a 1% probability that the test will produce a statistically significant result if the null hypothesis is correct.

Reference

Jim Frost, “Hypothesis Testing: An Intuitive Guide for Making Data Driven Decisions”

Setting the Evidentiary Standard Read More »

Hypothesis Testing

We have done it several times in the past. The objective of hypothesis testing is to assess, using sample data, two mutually exclusive theories about the properties of a population. Please see my earlier post for the definitions of sample and population. The two theories are the null hypothesis and the alternative hypothesis.

The null hypothesis (H0) typically represents the default state or the state of “no effect“. For example, you compare the means of two groups, such as people who took a particular drug and people who received the placebo. As a drug researcher, your objective is to find the effectiveness of the medicine. And that lays the foundation for your alternative hypothesis (HA or H1) – that the drug has a non-zero effect. The default state (H0) assumes the drug has no impact. To be specific, H0 assumes the difference between two means equals zero.

H1 states that the population parameter value does not equal the H0 value. Notice the words, population and parameter. The ambition of the test is to create statements on the who space and not just on the sample itself. And if the sample contains sufficient evidence, we will see what is sufficient, you will reject the null hypothesis in favour of the alternative.

Hypothesis Testing Read More »

Examples of Exponential Distribution

Let us work out some problems using exponential distributions. In reliability theory, it is common to assume that the lifespan of machines and components are random variables. That may suggest that the failure comes as Poisson, and the time between failures is exponentially distributed.

The time to failure of a tool follows an exponential distribution with the mean time between failures (MTBF) of 500 days. Calculate the probability this tool will fail before 500 days.

F(X < t) = 1 - e^{\lambda t}

Since the mean time (for failure) is 500, lambda, the parameter is 1/500. Substituting for lambda and time, the probability becomes 1 – exp((1/500) *500) = 0.63 or 63%. The following R code also gives the same result.

pexp(500, 1/500)

What is the probability that the tool will not fail for 1000 days?

1 - F(X < 1000) = e^{(1/500) * 1000}

The answer is 0.1353 or 13.53%

Examples of Exponential Distribution Read More »

Memoryless Distribution

The exponential distribution is the time between two Poisson events. You may consider exponential distribution as the inverse of Poisson distribution. If the former is the events per time duration, the latter is the time per event. Since Poisson events are independent of each other, it should not be difficult to accept that the exponential distribution is called memoryless.

The following two plots may explain the inverse relationship. First is the Poisson PMF for events with parameter lambda = 5.

The next plot is the corresponding exponential distribution for the same lambda (5).

Memorylessness

We will look at the formal derivation of this memorylessness. First, what does a memoryless function mean? It means that the past segment of action has no impact on the subsequent segment. For example, the time required for a person to get a “one” of a die-roll (to enter a snake and ladder game) doesn’t depend on the previous 5 minutes that she had waited. Mathematically it means:

P(X > t + s | X > t) = P(X > s) \text { ; } t \text{ is forgotten!}

Let’s apply the Conjunction Rule

\\ P(A \cap B) = P(A) * P(B | A) \\ \\  P(B | A) = \frac{P(A \cap B)}{P(A)} \\ \\  \therefore P(X > t + s | X > t) = \frac{P(X > t + s \text{ } \cap \text{ } X > t) }{P(X > t)} \\ \\ \text{If } X > s + t \text{ , then } X > t \text{ is redundant} \\ \\ P(X > t + s | X > t) = \frac{P(X > t + s) }{P(X > t)} = \frac{e^{-\lambda(s+t)}}{e^{-\lambda(t)}} =  e^{-\lambda s} \\ \\ \text{This is the definition of }  P(X > s) \text{!}

Memoryless Distribution Read More »

Irrational Faith in Guns

If having a gun increases the risk of gun-related violent death in the home, why do people choose to own guns?

Pierre, J. M., “The psychology of guns: risk, fear, and motivated reasoning”, Palgrave Communications, 5, 2019

My thoughts go with the children, teachers at the Robb Elementary School in Texas, and their family members.

I will start with my viewpoint on this debate of whether guns kill people vs people kill people – people attack, and they use readily available weapons to cause harm to “the other“. The more lethal the tool used, the deadlier the injury, with death as the endpoint. In other words, if stones are accessible, the outraged may throw and hurt the other, and if guns are accessible, they may kill a few; in a more barbarian society, replace guns with bombs! Only the scale changes. It is as simple as that.

There are statistics, and so are beliefs

In one of the previous posts, we discovered that suicides dominated the gun-related deaths. Studies after studies report the association that homicides are largely incidents committed by family members and acquaintances and not strangers.

Yet, the society, the US in this context, supports and takes great pride in possession of guns! The proponents of guns have several reasons (excuses) to support their position, starting with individual freedom (we have seen it in Covid-19 mask mandates!), to what is known, as per some studies, as the knowledge deficit model.

But one theory that became the most prominent among them points to the aspect of human decision making – i.e., irrationality, controlled by cognitive biases (cherry-picking, motivated reasoning, availability heuristics, status quo bias). As per Metzl, this behaviour stems from the notion of the cultural heritage of gun owners. And it does not come as a surprise that other social cancers (a.k.a. resistance to progress) – religiosity, racism, sexism, nationalism – too originate from similar backgrounds.

The Second Amendment

The story goes back to the second amendment of the US constitution that states, “A well regulated Militia, being necessary to the security of a free State, the right of the people to keep and bear Arms, shall not be infringed.”

First, you need to remember that this followed centuries-old practices of England (English Bill of Rights of 1689), which was embraced and ratified by the US constitution in 1791. And the reason to carry this baggage of the past? The answer is complicated.

Social scientists have been approaching this American love of guns through the lenses of gender, masculinity and race. On top of these, there are the thriving forces of fear of “bad guys, thugs and carjackers“, amply fostered by the ever-powerful National Rifle Association (NRA).

Uncertain future

A solution based on rational, data-based arguments is unlikely to reap any rewards against motivated reasoning. The issue is deep-rooted in American society as a national identity, symbol of resistance, and a collective history of race, gender and socioeconomic status. And as always, such diseases require long term care to heal.

Further Reading

Metzl, J., What guns mean: the symbolic lives of firearms, 2019, Palgrave Comm., 5:35
Pierre, J. M., The psychology of guns: risk, fear, and motivated reasoning, 2019, Palgrave Comm., 5:159

Irrational Faith in Guns Read More »

Exponential Distribution

The exponential distribution is a continuous distribution that runs on a single parameter, lambda. The probability density function (PDF) of this distribution is given by

f(x) = \lambda e^{-\lambda x}, \text{ } \lambda > 0

What does the PDF look like? We use the R code dexp for that. Following is the PDF of an exponential distribution function with parameter lambda = 0.01.

The cumulative distribution of exponential distribution is given by

F(x) = 1-  e^{-\lambda x}

Mean and variance of exponential distribution

The expected value (mean) and variance of the distribution is given by

\\ E(X) = \frac{1}{\lambda} \\ \\ var(X) =  \frac{1}{\lambda^2}

Exponential Distribution Read More »

Population and Sample

We have used these terms many times in the past. This time, we look at their formal definitions.

Population describes the set of all possible observations. For example, the population relevant for the US presidential election represents all eligible voters in the states, which is about 240 million. If one wants to determine the true average height of adult women in the US, one needs to collect data on ca. 108 million females 18 years and older. Similarly, to obtain the real fault rate of a product, the factory manager needs to inspect all products it manufactures!

Collecting data from every single individual (product) is not practically possible. What is possible is to inspect a fraction of the population. This subset is called a sample.

The characteristic of a population is known as a parameter. E.g., the mean height of adult women in the US is a parameter with an exact value. You get it if someone cares to measure every individual of that population. The two most popular parameters are mean (mu) and standard deviation (sigma)

\text{population mean } = \mu; \text{ population standard deviation } = \sigma

A statistic is a characteristic of a sample. The sample mean and the sample standard deviation are the corresponding terms for samples.

\text{sample mean } = \bar{X}; \text{ sample standard deviation } = s

Inference statistics is a means to estimate (population) parameters from (sample) statistics. While it is possible to get a representative sample as a proxy for the population, they are never equal. The differences between sample statistics and population parameters are called sampling error.

Population and Sample Read More »

Should Butler Play Game 4?

Let’s attempt to understand the payoffs and coach Spoelstra’s options for game 4 of the NBA eastern conference final (ECF). Before we get into the arguments, here is a brief primer on the subject that we are discussing today.

The 2022 NBA ECF

And the matchup is between the Miami Heat and the Boston Celtics, with the Heat leading 2-1 at the end of game 3. Game 4, just like game 3, is at Celtic’s court, TD Gardens. So, there is a homecourt advantage for the Boston team. Heat’s star player Jimmy Butler just got injured (knee inflammation) in game 3. Let’s assume the injury was not a serious one, and there is a possibility he could be back for the next game. After game 4, there is a maximum of 3 more games, two of them in Miami’s backyard. Whichever team reaches four wins first will win the conference and advance to the NBA finals.

Butler brings advantage, and so is home.

Let’s write down the key assumptions and payoffs. If Butler plays, his team gets a boost of about 0.2 probability points over not playing. i.e., at home, it is 0.6 vs 0.4, and away 0.4 vs 0.2. If he plays in game 4, there is a 0.5 chance of aggravating his injury, making him unavailable for game 5. If he doesn’t play game 4, there is a 0.8 chance he plays for game 5 healthy, thanks to two additional days of rest. If the Heat wins game 4, it will be a huge boost to win the conference, as they have two home and one away matches to realise just one more win. If they lose game 4, it is still fine as they tie at 2-2, with two more to win with two home matches at hand.

What should Spoelstra do?

Well, he should weigh down factors and write payoff matrices and expected values. I will make one, not exactly a payoff matrix, but still capable of describing winning and losing with and without Butler.

These payoff values are arbitrary, but a win without Butler ranks the highest as he will be available as a fitter player for the rest of the games to close out. Butler playing and losing is risky as there is a higher chance of worsening the injury. And the other two results yield somewhere in between these two extremes.

Dominant strategy

If you compare the first column of the matrix with the second, i.e., comparing Butler playing with not playing, you will note that + 200 > + 100 and 0 > – 100. So, under these payoff values, Butler not playing is the dominant strategy.

Expected values

Let Vplay be the expected value for the Heat when Butler plays, and Vno-play when Butler does not play.

Vplay = 100 x 0.4 + (-100) x 0.6 = – 20

Vno-play= 200 x 0.2 + 0 x 0.8 = 40

Again, Butler not playing has the higher expected value.

Any doubts, coach?

The value of the above arguments is only worth the underlying assumptions, which, at this stage, are only arbitrary or speculative.

Tailpiece

(added on May 24, after the end of match 4). Butler played for the Heat, but the Celtics won by 20 points. Butler scored 6 points in the game (his previous scores were 41, 29 and 8). Whether his involvement in the match affected his fitness for future ties remains to be seen or will never be known.

Should Butler Play Game 4? Read More »