Member-only story
Creating Probability Distribution Datasets with R Programming
Use built-in functions to create data based on a probability distribution for your data frames, data tables, and matrices
In my post Creating Synthetic Datasets with R Programming, I noted several built-in functions in R for creating data with sequencing or patterns within the dataset. Creating an example dataset would be useful for experimenting with a calculation in your R programming script or a function you expect to create for a package.
There is another set of built-in functions for crafting synthetic datasets. But in this case, they are designed for returning probability distributions based on the data. These are often used with advanced data models very similarly to the rep() and seq() functions outlined in the other post, but there are a few significant differences in how they are applied. Understanding these differences can help you understand advanced functions and library choices better.
Probability Distributions
First, let’s look at the probability distributions. The probability distributions built into R include normal, uniform, binomial, exponent, and Poisson. The math behind these is available on a Wikipedia page, but each has applications in real-world…