# Exploring Distributions

In exploring statistical distributions, we focus on the following:

• what influences the shape of a distribution
• calculate probability from a given quantile
• calculate quantiles out of given probability

To explore the above 3 concepts, we have defined functions for the following distributions:

• Normal
• Binomial
• Chi Square
• F
• t

## Normal Distribution

### Distribution Shape

Visualize how changes in mean and standard deviation affect the shape of the normal distribution.

##### Input
• mean: mean of the normal distribution
• sd: standard deviation of the normal distribution
##### Output
• Normal distribution plot

### Percentiles

#### Calculate and visualize quantiles out of given probability.

##### Input
• probs: a probability value
• mean: mean of the normal distribution
• sd: standard deviation of the normal distribution
• type: lower/upper tail

Suppose X, the grade on a exam, is normally distributed with mean 60 and standard deviation 3. The teacher wants to give 10% of the class an A. What should be the cutoff to determine who gets an A?

The teacher wants to give lower 15% of the class a D. What cutoff should the teacher use to determine who gets an D?

The teacher wants to give middle 50% of the class a B. What cutoff should the teacher use to determine who gets an B?

### Probabilities

#### Calculate and visualize probability from a given quantile

##### Input
• perc: a quantile value
• mean: mean of the normal distribution
• sd: standard deviation of the normal distribution
• type: lower/upper/both tail

Let X be the IQ of a randomly selected student of a school. Assume X ~ N(90, 4). What is the probability that a randomly selected student has an IQ below 80?

What is the probability that a randomly selected student has an IQ above 100?

What is the probability that a randomly selected student has an IQ between 85 and 100?

## Binomial Distribution

### Distribution Shape

Visualize how changes in number of trials and the probability of success affect the shape of the binomial distribution.

### Percentiles

#### Calculate and visualize quantiles out of given probability

##### Input
• p: a single aggregated probability of multiple trials
• n: the number of trials
• tp: the probability of success in a trial
• type: lower/upper tail

### Probabilities

#### Calculate and visualize probability from a given quantile

##### Input
• p: probability of success
• n: the number of trials
• s: number of success in a trial
• type: lower/upper/interval/exact tail

Assume twenty-percent (20%) of Magemill have no health insurance. Randomly sample n = 12 Magemillians. Let X denote the number in the sample with no health insurance. What is the probability that exactly 4 of the 15 sampled have no health insurance?

What is the probability that at most one of those sampled has no health insurance?

What is the probability that more than seven have no health insurance?

What is the probability that fewer than 5 have no health insurance?

## Chi Square Distribution

### Distribution Shape

Visualize how changes in degrees of freedom affect the shape of the chi square distribution.

### Percentiles

#### Calculate quantiles out of given probability

##### Input
• probs: a probability value
• df: degrees of freedom
• type: lower/upper tail

Let X be a chi-square random variable with 8 degrees of freedom. What is the upper fifth percentile?

What is the tenth percentile?

### Probability

#### Calculate probability from a given quantile.

##### Input
• perc: a quantile value
• df: degrees of freedom
• type: lower/upper tail

What is the probability that a chi-square random variable with 12 degrees of freedom is greater than 8.79?

What is the probability that a chi-square random variable with 12 degrees of freedom is greater than 8.62?

## F Distribution

### Distribution Shape

Visualize how changes in degrees of freedom affect the shape of the F distribution.

### Percentiles

#### Calculate quantiles out of given probability

##### Input
• probs: a probability value
• num_df: nmerator degrees of freedom
• den_df: denominator degrees of freedom
• type: lower/upper tail

Let X be an F random variable with 4 numerator degrees of freedom and 5 denominator degrees of freedom. What is the upper twenth percentile?

What is the 35th percentile?

### Probabilities

#### Calculate probability from a given quantile.

##### Input
• perc: a quantile value
• num_df: nmerator degrees of freedom
• den_df: denominator degrees of freedom
• type: lower/upper tail

What is the probability that an F random variable with 4 numerator degrees of freedom and 5 denominator degrees of freedom is greater than 3.89?

What is the probability that an F random variable with 4 numerator degrees of freedom and 5 denominator degrees of freedom is less than 2.63?

## t Distribution

### Distribution Shape

Visualize how degrees of freedom affect the shape of t distribution.

### Percentiles

#### Calculate quantiles out of given probability

##### Input
• probs: a probability value
• df: degrees of freedom
• type: lower/upper/both tail

What is the upper fifteenth percentile?

What is the eleventh percentile?

What is the area of the curve that has 95% of the t values?

### Probabilities

#### Calculate probability from a given quantile.

##### Input
• perc: a quantile value
• df: degrees of freedom
• type: lower/upper/interval/both tail

Let T follow a t-distribution with r = 6 df.

What is the probability that the value of T is less than 2?

What is the probability that the value of T is greater than 2?

What is the probability that the value of T is between -2 and 2?

What is the probability that the absolute value of T is greater than 2?