R Academy · Lesson

Probability Distributions

Work with common distributions (normal, binomial, Poisson) and generate random samples.

Lesson 2 of 310 steps

Probability Distributions is a free R Academy lesson on CoddyKit. This is lesson 2 of 3. Any 3 lessons of this learning path are free to read in full — after that, CoddyKit PRO unlocks every lesson, plus hands-on practice with a built-in code editor and a 24/7 AI tutor. It is part of the R Academy learning path, and your progress syncs across the web and the CoddyKit app. The R Academy course includes 3 lessons in total.

Introduction to Probability Distributions

Probability distributions describe how values are distributed in a dataset. In R, you can work with common distributions using built-in functions.

Probability Distributions — illustration 1

Normal Distribution

The normal distribution is a symmetric, bell-shaped distribution commonly used in statistics.

x <- rnorm(100, mean=50, sd=10)
hist(x, main='Normal Distribution', col='blue')

Binomial Distribution

The binomial distribution models the number of successes in a fixed number of independent trials.

x <- rbinom(100, size=10, prob=0.5)
barplot(table(x), main='Binomial Distribution', col='red')

Poisson Distribution

The Poisson distribution represents the probability of a given number of events occurring in a fixed interval.

x <- rpois(100, lambda=5)
barplot(table(x), main='Poisson Distribution', col='green')

Uniform Distribution

The uniform distribution assigns equal probability to all values within a range.

x <- runif(100, min=0, max=10)
hist(x, main='Uniform Distribution', col='purple')

Exponential Distribution

The exponential distribution describes the time between events in a Poisson process.

x <- rexp(100, rate=1)
hist(x, main='Exponential Distribution', col='orange')

Comparing Distributions

You can generate and compare multiple distributions using plots.

x1 <- rnorm(100, mean=50, sd=10)
x2 <- rnorm(100, mean=60, sd=15)
hist(x1, col=rgb(1,0,0,0.5), main='Comparing Distributions')
hist(x2, col=rgb(0,0,1,0.5), add=TRUE)

Simulating Probability Distributions

You can generate random samples from different distributions for simulations.

set.seed(123)
data <- rnorm(1000, mean=50, sd=10)
hist(data, main='Simulated Normal Distribution', col='blue')

Summary

In this lesson, you learned:

  • How to generate data from different probability distributions.
  • The key characteristics of normal, binomial, Poisson, uniform, and exponential distributions.
  • How to compare distributions using histograms.
Probability Distributions — illustration 10
Free to start

Learn R with an AI tutor — free

Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.

Courses
43
Lessons
159

Frequently Asked Questions

Is the “Probability Distributions” lesson free?

Yes — any 3 lessons of the R Academy learning path, including “Probability Distributions”, are free to read in full here on the web. After that, CoddyKit PRO unlocks every lesson, plus interactive practice with a built-in code editor and a 24/7 AI tutor. The R Academy course includes 3 lessons in total.

What will I learn in “Probability Distributions”?

Work with common distributions (normal, binomial, Poisson) and generate random samples. You practise R Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start R Academy?

No prior experience is required. R Academy on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 2 of 3.

How long does the “Probability Distributions” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this R Academy lesson?

Yes. Every R Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Descriptive Statistics
  2. Probability Distributions
  3. Hypothesis Testing
← Back to R Academy