Get startedGet started for free

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.

This exercise is part of the course

Intermediate Regression in R

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

logistic_distn_cdf <- tibble(
  # Make a seq from -10 to 10 in steps of 0.1
  x = ___,
  # Transform x with built-in logistic CDF
  logistic_x = ___,
  # Transform x with manual logistic
  logistic_x_man = ___
) 

# Check that each logistic function gives the same results
all.equal(
  ___, 
  ___
)
Edit and Run Code