This app will let you explore a few basic distributions that you can sample in R. Generating random samples is a good way to get better intuitions about what data look like.

Click on a distribution below or in the sidebar to explore the visualisations

The normal distribution is useful for modeling continuous data like reaction times.

• Set n = 100, mean = 0, and sd = 1. Plot data by clicking the 'Sample Again' button. Do this 5 times. How much does the distribution change between samples?
• Clear the samples and plot 5 sets of data with n = 10. Does the distribution change more or less?
• Set n = 100 and sd = 1. Plot data with means of -2, -1, 0, 1 and 2.
• Set n = 100 and mean = 0. Plot data with SDs of 2, 1.5, 1, 0.8, 0.6, 0.4, and 0.2. What happens to the range of the data as SD gets smaller?
• Clear the samples and set n = 1. Now each sample adds to the overall distribution. How many times do you need to sample to get a mean that is close to the mean you set?
rnorm(n =
, mean =
, sd =
)

The binomial distribution is useful for modeling data where each trial can have one of two outcomes, like success/failure, yes/no, or head/tails.

• Set n = 100, size = 10, and prob = 0.5. Plot data by clicking the 'Sample Again' button. Do this 5 times. How much does the distribution change between samples?
• Clear the samples and plot 5 sets of data with n = 10. Does the distribution change more or less?
• Set n = 1000 and prob = 0.5. Plot data with sizes 1 to 10.
• Set n = 1000 and size = 10. Plot data with prob = 0, 0.25, 0.5, 0.75, and 1.0
• Set n = 1, size = 1, and prob = 0.5 to simulate single coin flips. Each sample adds 1 observation of 1 fair coin flip.
• Set n = 1, size = 10, and prob = 0.5. How many tries does it take to get a trial with 8 or more successes? Can you get 10?
• Compare n = 10 and size = 1 to n = 1 and size = 10.
• How would you simulate a data set where each of 40 subjects sees 50 pairs of faces and indicates if they are related? The DV here is the number of correct guesses. Simulate data where people are 70% accurate and compare this to data where people are at chance.
rbinom(n =
, size =
, prob =
)

The poisson distribution is good for modeling the rate of something, like the number of texts you receive per day. Lambda is the average rate.

• Set n = 100 and lambda = 5. Plot data by clicking the 'Sample Again' button. Do this 5 times. How much does the distribution change between samples?
• Clear the samples and plot 5 sets of data with n = 10. Does the distribution change more or less?
• Set n = 1000. Plot data with lambda ranging from 1 to 10.
• Set n = 1 and lambda = 1. Now each sample adds to the overall distribution. How many times do you need to sample to get an observation where x >= 4 or x >= 5?
• If the number of pets is poisson-distributed and people on average have 1.4 pets, how would you simuate a data set where you sampled the number of pets from 75 people?
rpois(n =
, lambda =
)