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
dist_norm_plot(mean = 2, sd = 0.6)
## Warning in dist_norm_plot(mean = 2, sd = 0.6): `dist_normal_plot()`
## has been soft deprecated and will be removed in the next version of
## descriptr. Please use the vistributions package for visualizing probability
## distributions.

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?

dist_norm_perc(0.10, 60, 3, 'upper')
## Warning in dist_norm_perc(0.1, 60, 3, "upper"): `dist_normal_perc()`
## has been soft deprecated and will be removed in the next version of
## descriptr. Please use the vistributions package for visualizing probability
## distributions.

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

dist_norm_perc(0.85, 60, 3, 'lower')
## Warning in dist_norm_perc(0.85, 60, 3, "lower"): `dist_normal_perc()`
## has been soft deprecated and will be removed in the next version of
## descriptr. Please use the vistributions package for visualizing probability
## distributions.

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

dist_norm_perc(0.5, 60, 3, 'both')
## Warning in dist_norm_perc(0.5, 60, 3, "both"): `dist_normal_perc()`
## has been soft deprecated and will be removed in the next version of
## descriptr. Please use the vistributions package for visualizing probability
## distributions.

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?

dist_norm_prob(80, mean = 90, sd = 4)
## Warning in dist_norm_prob(80, mean = 90, sd = 4): `dist_normal_prob()`
## has been soft deprecated and will be removed in the next version of
## descriptr. Please use the vistributions package for visualizing probability
## distributions.

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

dist_norm_prob(100, mean = 90, sd = 4, type = 'upper')
## Warning in dist_norm_prob(100, mean = 90, sd = 4, type = "upper"):
## `dist_normal_prob()` has been soft deprecated and will be removed in
## the next version of descriptr. Please use the vistributions package for
## visualizing probability distributions.

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

dist_norm_prob(c(85, 100), mean = 90, sd = 4, type = 'both')
## Warning in dist_norm_prob(c(85, 100), mean = 90, sd = 4, type = "both"):
## `dist_normal_prob()` has been soft deprecated and will be removed in
## the next version of descriptr. Please use the vistributions package for
## visualizing probability distributions.

Binomial Distribution

Distribution Shape

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

## Warning in dist_binom_plot(10, 0.3): `dist_binom_plot()` has been soft
## deprecated and will be removed in the next version of descriptr. Please use
## the vistributions package for visualizing probability distributions.

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
dist_binom_perc(10, 0.5, 0.05)
## Warning in dist_binom_perc(10, 0.5, 0.05): `dist_binom_perc()` has been
## soft deprecated and will be removed in the next version of descriptr.
## Please use the vistributions package for visualizing probability
## distributions.

dist_binom_perc(10, 0.5, 0.05, 'upper')
## Warning in dist_binom_perc(10, 0.5, 0.05, "upper"): `dist_binom_perc()`
## has been soft deprecated and will be removed in the next version of
## descriptr. Please use the vistributions package for visualizing probability
## distributions.

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?

dist_binom_prob(12, 0.2, 4, type = 'exact')
## Warning in dist_binom_prob(12, 0.2, 4, type = "exact"): `dist_binom_prob()`
## has been soft deprecated and will be removed in the next version of
## descriptr. Please use the vistributions package for visualizing probability
## distributions.

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

dist_binom_prob(12, 0.2, 1, 'lower')
## Warning in dist_binom_prob(12, 0.2, 1, "lower"): `dist_binom_prob()`
## has been soft deprecated and will be removed in the next version of
## descriptr. Please use the vistributions package for visualizing probability
## distributions.

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

dist_binom_prob(12, 0.2, 8, 'upper')
## Warning in dist_binom_prob(12, 0.2, 8, "upper"): `dist_binom_prob()`
## has been soft deprecated and will be removed in the next version of
## descriptr. Please use the vistributions package for visualizing probability
## distributions.

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

dist_binom_prob(12, 0.2, c(0, 4), 'interval')
## Warning in dist_binom_prob(12, 0.2, c(0, 4), "interval"):
## `dist_binom_prob()` has been soft deprecated and will be removed in
## the next version of descriptr. Please use the vistributions package for
## visualizing probability distributions.

Chi Square Distribution

Distribution Shape

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

## Warning in dist_chi_plot(df = 5): `dist_chi_plot()` has been soft
## deprecated and will be removed in the next version of descriptr. Please use
## the vistributions package for visualizing probability distributions.
dist_chi_plot(df = 5, normal = TRUE)
## Warning in dist_chi_plot(df = 5, normal = TRUE): `dist_chi_plot()`
## has been soft deprecated and will be removed in the next version of
## descriptr. Please use the vistributions package for visualizing probability
## distributions.

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?

dist_chi_perc(0.05, 8, 'upper')
## Warning in dist_chi_perc(0.05, 8, "upper"): `dist_chi_perc()` has been soft
## deprecated and will be removed in the next version of descriptr. Please use
## the vistributions package for visualizing probability distributions.

What is the tenth percentile?

dist_chi_perc(0.10, 8, 'lower')
## Warning in dist_chi_perc(0.1, 8, "lower"): `dist_chi_perc()` has been soft
## deprecated and will be removed in the next version of descriptr. Please use
## the vistributions package for visualizing probability distributions.

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?

dist_chi_prob(8.79, 12, 'upper')

## Warning in dist_chi_prob(8.79, 12, "upper"): `dist_chi_prob()` has been
## soft deprecated and will be removed in the next version of descriptr.
## Please use the vistributions package for visualizing probability
## distributions.

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

dist_chi_prob(8.62, 12, 'lower')

## Warning in dist_chi_prob(8.62, 12, "lower"): `dist_chi_prob()` has been
## soft deprecated and will be removed in the next version of descriptr.
## Please use the vistributions package for visualizing probability
## distributions.

F Distribution

Distribution Shape

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

## Warning in dist_f_plot(): `dist_f_plot()` has been soft deprecated and will
## be removed in the next version of descriptr. Please use the vistributions
## package for visualizing probability distributions.

dist_f_plot(6, 10, normal = TRUE)
## Warning in dist_f_plot(6, 10, normal = TRUE): `dist_f_plot()` has been soft
## deprecated and will be removed in the next version of descriptr. Please use
## the vistributions package for visualizing probability distributions.

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?

dist_f_perc(0.20, 4, 5, 'upper')
## Warning in dist_f_perc(0.2, 4, 5, "upper"): `dist_f_perc()` has been soft
## deprecated and will be removed in the next version of descriptr. Please use
## the vistributions package for visualizing probability distributions.

What is the 35th percentile?

dist_f_perc(0.35, 4, 5, 'lower')
## Warning in dist_f_perc(0.35, 4, 5, "lower"): `dist_f_perc()` has been soft
## deprecated and will be removed in the next version of descriptr. Please use
## the vistributions package for visualizing probability distributions.

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?

dist_f_prob(3.89, 4, 5, 'upper')
## Warning in dist_f_prob(3.89, 4, 5, "upper"): `dist_f_prob()` has been soft
## deprecated and will be removed in the next version of descriptr. Please use
## the vistributions package for visualizing probability distributions.

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?

dist_f_prob(2.63, 4, 5, 'lower')
## Warning in dist_f_prob(2.63, 4, 5, "lower"): `dist_f_prob()` has been soft
## deprecated and will be removed in the next version of descriptr. Please use
## the vistributions package for visualizing probability distributions.

t Distribution

Distribution Shape

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

dist_t_plot(df = 8)
## Warning in dist_t_plot(df = 8): `dist_t_plot()` has been soft deprecated
## and will be removed in the next version of descriptr. Please use the
## vistributions package for visualizing probability distributions.

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?

dist_t_perc(0.15, 8, 'upper')
## Warning in dist_t_perc(0.15, 8, "upper"): `dist_t_perc()` has been soft
## deprecated and will be removed in the next version of descriptr. Please use
## the vistributions package for visualizing probability distributions.

What is the eleventh percentile?

dist_t_perc(0.11, 8, 'lower')
## Warning in dist_t_perc(0.11, 8, "lower"): `dist_t_perc()` has been soft
## deprecated and will be removed in the next version of descriptr. Please use
## the vistributions package for visualizing probability distributions.

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

dist_t_perc(0.8, 8, 'both')
## Warning in dist_t_perc(0.8, 8, "both"): `dist_t_perc()` has been soft
## deprecated and will be removed in the next version of descriptr. Please use
## the vistributions package for visualizing probability distributions.

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?

dist_t_prob(2, 6, 'lower')
## Warning in dist_t_prob(2, 6, "lower"): `dist_t_prob()` has been soft
## deprecated and will be removed in the next version of descriptr. Please use
## the vistributions package for visualizing probability distributions.

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

dist_t_prob(2, 6, 'upper')
## Warning in dist_t_prob(2, 6, "upper"): `dist_t_prob()` has been soft
## deprecated and will be removed in the next version of descriptr. Please use
## the vistributions package for visualizing probability distributions.

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

dist_t_prob(2, 6, 'both')
## Warning in dist_t_prob(2, 6, "both"): `dist_t_prob()` has been soft
## deprecated and will be removed in the next version of descriptr. Please use
## the vistributions package for visualizing probability distributions.

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

dist_t_prob(2, 6, 'interval')
## Warning in dist_t_prob(2, 6, "interval"): `dist_t_prob()` has been soft
## deprecated and will be removed in the next version of descriptr. Please use
## the vistributions package for visualizing probability distributions.