1. Learn
  2. /
  3. Courses
  4. /
  5. Intermediate Regression in R

Connected

Exercise

Cumulative distribution function

Understanding the logistic distribution is key to understanding logistic regression. Like the normal (Gaussian) distribution, it is a probability distribution of a single continuous variable. Here you'll visualize the cumulative distribution function (CDF) for the logistic distribution. That is, if you have a logistically distributed variable, x, and a possible value, xval, that x could take, then the CDF gives the probability that x is less than xval.

The logistic distribution's CDF is calculated with the logistic function (hence the name). The plot of this has an S-shape, known as a sigmoid curve. An important property of this function is that it takes an input that can be any number from minus infinity to infinity, and returns a value between zero and one.

ggplot2 is loaded.

Instructions 1/2

undefined XP
    1
    2

Create a tibble containing three columns.

  • x values as a sequence from minus ten to ten in steps of 0.1.
  • logistic_x made from x transformed with the logistic distribution CDF.
  • logistic_x_man made from x transformed with a logistic function calculated from the equation \(cdf(x) = \frac{1}{(1 + exp(-x))}\).
  • Check that both logistic transformations (logistic_x and logistic_x_man) have the same values with all.equal().