2D Normal Data Generator

Sean Conte, PhD
BlueRed
StatisticSettingSampleSettingSample

Settings describe the distribution the points come from. Sample values are computed from the points actually drawn, so they wander a little from the settings, and more so with fewer points.

Quick explanation

Mean of a variable (for a data set)
shifts the data set along the corresponding axis.
Variance of a variable (for a data set)
stretches the data set along the corresponding axis.
Correlation between two variables (of a data set)
the extent to which one variable predicts the other, on a -1 to 1 scale.

The seed controls the random number generation. To have the two distributions produce the exact same data points, make the seeds the same in addition to the other parameters.

Longer explanation

Introduction

Don’t be intimidated by all the sliders. You’ll learn very quickly what they all do. There are only three main ideas: mean, variance and correlation.

First notice that there are two different data sets: blue and red. This is so that you can compare two different distributions (combinations of parameters) at once. Each one has its own set of sliders. For now, let’s just focus on the blue one to get the basic ideas.

The data is generated by normal distributions. Most people are familiar with normal distributions in the form of bell curves — most of the data is close to the mean (the center) and the amount of points tapers off evenly on either side. While the mean determines the center of the points, the variance determines how spread out they are (more on that shortly).

The same is true here, but now we have two variables for each data set (variable 1 and variable 2). These could be height and weight, order sizes and order frequencies, or basically anything you want. So instead of a single bell curve (which can capture one variable), we can think of this as more of your typical real world (3D) bell. There’s the center, higher (denser in points) than the rest, and then on all sides it tapers down. The figure we look at is a top-down view of the bell. We can think of the height of the bell as how densely packed the points are.

Number of points

The number of points is fairly self explanatory: it determines the amount of data points in the data set. What’s important to note is that it doesn’t dictate where the data is or its shape. Taking a bigger sample (when done right) just gives you more of a picture of the same underlying distribution. (We just get more resolution on our picture of the bell, but the bell stays the same.)

Mean

The mean of a variable determines where all of the points center around. So shifting the mean of variable 1 will shift that entire distribution along the variable 1 axis.

Notice that the mean doesn’t affect the shape of the data: how spread out it is nor how oblong it is. It merely shifts the data. Try shifting the mean of variable 2 also.

Variance

The variance of a variable indicates how spread out the data is with regard to that variable. Increasing the variance of variable 2 increases the diversity of the points with regard to that feature. Notice that the spread of the other variable isn’t affected - we can spread out one variable without affecting the other.

One detail about the stretching: the amount of stretch is set by the standard deviation, which is the square root of the variance. So multiplying the variance by 4 only doubles the spread. That is why each variance slider also shows its standard deviation (SD).

The variance tells you how similar all of the data points are to the mean. A low variance implies the mean does a good job of representing all the rest (it’s very close, very similar to all the rest). A high variance implies that the mean is not a great representative of the rest. That’s why knowing the average of your data is only half the story. You need to also know how spread out that data is, how closely it all aligns with that average.

Correlation

Notice that there is a mean and variance for both variables of the data set. You can shift horizontally or vertically, and likewise you can stretch horizontally or vertically. And each of these things can be done independently from the others. Correlation is different, because it doesn’t belong to either variable on its own. It is a measure of how the two variables relate to each other, or how well one variable can predict the other.

With a positive correlation, the points tilt upward: when one variable is high, the other tends to be high too. With a negative correlation they tilt downward, and the relationship runs the other way. At 0, knowing one variable doesn’t help you guess the other. At 1 or -1, the points fall on a single line.

For example, suppose height and weight are strongly correlated. Then we could make a good guess about a person’s height just by knowing their weight. The stronger the correlation, the closer those guesses tend to land. (Strictly speaking, correlation measures how well a straight line does the predicting.)

Blue Red