Moments and Continuous Distributions

Review and such

Moments and Parameters

Just as we compute "summary statistics" for a sample, we often compute similar statistics for a population or, equivalently, a distribution. Thus, we might talk about the mean of a population that we are sampling from.

Statistics for populations are often called parameters. They are also sometimes called moments. (These terms aren't quite interchangeable. For example, the minimum value for a uniform random variable would be called a parameter but not a moment, which is a slightly more specialized term. However, we will not concern ourselves with these subtleties.) Also, they are usually denoted with greek letters. Thus:

 samplepopulation
meanx-barμ
std. dev.sσ

In simulation, we will often use the mean, variance and other parameters of a population to control and specify a random number generator (RNG). After all, what an RNG does for us is draw one sample from a population of numbers, so it makes sense that we need to specify that population.

Of course, we often don't know the mean or variance of a population. Later in the course, we'll talk about how to estimate these, but for now, imagine that we take a big sample of real-world data, compute the mean, variance or whatever, and use that for the mean or variance of the population.

The Mean of a Distribution

See section 6.6

We know what the mean of a sample is: add 'em up and divide by N. If something occurs several times, just add it in several times. Suppose, though, that instead of having all the raw data, we had a "digest" of it, as in a histogram. For example, suppose we do a survey of the number of stuffed animals that Wellesley students have with them and find that

What is the average number of stuffed animals per student? We could compute this with a weighted average.

The mean or expected value of a distribution is just a weighted average of the values, where the weights are the probabilities!

μ = Σ xi pmf(xi)

You will also see notation like this, where X is a random variable and E means the expected value.

E[X] = Σ xi pmf(xi)

Mean of a binomial

Amazingly, the mean of a binomial is very simple:

μ = np

We can easily check this using Excel. The function sumproduct is convenient for this.

Q: Confirm the mean of a binomial(10,0.6). Recall that binomdist(x,n,p,cumulative) gives the probability of x successes in n trials, with p probability of success in each trial.

Mean of a Poisson

It's also amazing but true that the mean of the Poisson is simple:

μ = λ

That is, the mean is the same as the rate parameter we used in defining the PMF. Again, we can easily check this using Excel.

Now it's no surprise that we use "np" as the mean of the Poisson when we use the approximation!

Variance and Standard Deviation

See section 6.7

Just as the mean is an expected value, the variance is the expected squared distance from the mean. In symbols, that's:

Var[X] = E[(X-μ)2]

Once again, we can do this using a weighted average, where we take each value, subtract the mean, square that, and then multiply by the probability of that value:

Var[X] = Σ (xi-μ)2 pmf(xi)

The standard deviation is just the square root of the variance. When we're doing mathematical things, it's nice to work with the variance because it has nice properties, such as linearity if random variables are independent:

Var(X+Y) = Var(X)+Var(Y)

The same is not true of the standard deviation. The previous equation means that the variance of the sum of two dice is twice the variance of one die!

Variance of the Binomial

The variance of the binomial is very simple:

Var[X] = np(1-p)

Often the standard shorthand is to let q=1-p, so you'll sometimes see this as

Var[X] = npq

Q: Compute the variance of the binomial(10,0.6). Again, using binomdist and sumproduct will be helpful.

Variance of the Poisson

The variance of the Poisson is the same as the mean!

Var[X] = λ

Q: Compute the mean and variance of a Poisson(0.5). Recall that poisson(x,μ,cumulative) will give the theoretical probability of x events when the rate is μ.


Continuous Distributions

Unlike typical prob/stat classes, we will look at a variety of continuous distributions. That's because the world is more complicated and interesting than just the normal distribution and therefore simulation software provides more interesting continuous distributions to sample from.

Probability Density Functions

See section 7.1

If we have infinitely many values, the probability of any one of them has to be zero, whether they're all equally likely or not. Yes, somehow, they all add up to 1. What that really means is that their individual probabilities are infinitesimal. But how do we work with this?

The answer is that we describe not the probability of any particular value but the probability of ranges of values. The relative probability of different ranges of values is defined by a function called the probability density function or PDF. A PDF is very similar in meaning and usage to the probability mass functions (PMF) that we looked at with discrete distributions. Essentially, they both:

Well, that last statement isn't quite right, since the probability of any particular x is zero. However, we can say:

The probability of a range of values is equal to the area under the curve of the PDF over the range.

To really understand this requires calculus, but we can work pictorially instead. Let's start by looking at some examples.

The Uniform Distribution

With the uniform distribution, the probability of the sample coming from any subrange is directly proportional to the width of the subrange.

Q: For example, in the standard uniform distribution (ranges from 0 to 1), what are the probabilities of a number between

Q: Suppose we want a number uniform between 5 and 50. What then are the probabilities:

In simulation, the uniform distribution is often used when we only know the minimum and maximum for some value, perhaps because of logical constraints. For example, we may have absolutely no idea what fraction of people own stuffed animal. All we're really willing to commit to is that it's between 0 and 1. So, in our simulation, we use a "uniform, real" distribution.

Triangular Distribution

Sometimes, we know a little more than minimum and maximum. We might also know the "most likely" value (the mode). One common approach, then, is to use a triangular distribution. To find the probability of any range, we only need to do a little geometry.

Q: Suppose we think that the most likely value for the fraction of people that own a stuffed animal is 30 percent. What are the probabilities that:

In general, a triangular distribution is characterized by three values:

triangular distribution

The calculation of probabilities using a triangular distribution is mostly based on the geometrical idea of similar triangles. Define the following quantities, based on the preceding figure

Given these values, it's relatively easy to find the area of any sub region. Suppose we want to find the probability of a value between min and x, as illustrated:

area in triangular distribution

The probability we want is simply the area of the little red triangle. Let a=x-min be the base of the little red triangle. Let h be the height of the little red triangle, which we can find by similar triangles, since a/A=h/H. Solving, we find that h=Ha/A=2a/CA. The area of the little triangle is (1/2)ah or a2/CA.

The same reasoning lets us find areas to the right of the mode. By adding and subtracting area of triangles, we can find any probability we want.

This work is licensed under a Creative Commons License | Creative Commons License | Viewable With Any
Browser | Valid HTML 4.01! | Valid CSS!