Tutorials › VEE Mathematical Statistics › Raw Moments of a Random Variable

VEE Mathematical Statistics · Expectation and Variability · Tutorial 66 of 880

Raw Moments of a Random Variable

Calculate moments about zero from a probability mass function or density, and check that the model and moment assumptions support each calculation.

Beginner 10 min read

What You'll Learn

  • Define the kth raw moment and state when it is finite.
  • Calculate first and second raw moments from a discrete probability function.
  • Calculate raw moments from a continuous density by integration.
  • Combine probability masses and density contributions for a mixed distribution.
  • Check support, normalization, units, and moment calculations.
  • Distinguish the second raw moment from the square of the first raw moment.

Moments About Zero

A probability distribution describes the possible values of a random variable and how probability is assigned to them. A raw moment summarizes that distribution by taking an expectation of a power of the random variable. The first raw moment is the expected value; the second raw moment uses squared values. The word “raw” indicates that the powers are taken from zero, rather than from a shifted reference point.

Definition: For a positive integer \(k\), the \(k\)th raw moment of \(X\) is \(E[X^k]\), provided it is finite. A standard condition for a finite moment is \(E[|X|^k]<\infty\). The first and second raw moments are \(E[X]\) and \(E[X^2]\), respectively.

A raw moment is calculated from the full probability distribution, not from a single observed value. When \(X\) is discrete, each possible value contributes its \(k\)th power multiplied by its probability. When \(X\) is continuous, the corresponding contributions are accumulated using the density. In either case, use the actual support of the distribution and verify that the probabilities or density describe a valid model.

Calculating Raw Moments for a Discrete Random Variable

Suppose \(X\) has possible values \(x_1,x_2,\ldots\), with probability mass function \(p_X(x)=P(X=x)\). If the indicated sum is finite, or converges to a finite value, its \(k\)th raw moment is found by weighting each power \(x^k\) by its probability.

$$ E[X^k]=\sum_x x^k p_X(x). $$

The sum is taken over the possible values of \(X\). For the first raw moment, use \(x\); for the second, square each value first and then apply its probability weight. Negative values must retain their signs when calculating the first moment. Their squares, in contrast, are nonnegative.

Worked Example: First and Second Moments From a Probability Mass Function

A hypothetical service model assigns a random number \(X\) of extra processing hours to a randomly selected case. The model is discrete, with the following probability mass function. Calculate \(E[X]\), \(E[X^2]\), and \(P(X>1)\). Hours are the unit for \(X\).

\(x\)\(P(X=x)\)
\(-1\)0.20
00.30
20.40
40.10

Method and model check. Use the discrete raw-moment sum. The probabilities are nonnegative and add to \(0.20+0.30+0.40+0.10=1.00\), so they form a probability mass function.

First raw moment. Multiply each value by its probability and add:

$$ E[X]=(-1)(0.20)+(0)(0.30)+(2)(0.40)+(4)(0.10) =-0.20+0+0.80+0.40=1.00. $$

Thus the expected number of extra processing hours is \(1.00\) hour.

Second raw moment. Square each possible value before multiplying by its probability:

$$ E[X^2]=(-1)^2(0.20)+0^2(0.30)+2^2(0.40)+4^2(0.10) =0.20+0+1.60+1.60=3.40. $$

The second raw moment is \(3.40\) hours squared. Finally, \(X>1\) occurs for \(X=2\) or \(X=4\), so \(P(X>1)=0.40+0.10=0.50\). The calculation is consistent with the table: the two values above 1 account for half the total probability.

Common mistake avoided: The value \(-1\) contributes \(-0.20\) to \(E[X]\), not \(+0.20\). Its contribution to \(E[X^2]\) is \(+0.20\), because the value is squared for that moment.

Calculating Raw Moments for a Continuous Random Variable

Suppose \(X\) is continuous with probability density function \(f_X(x)\). The density must be nonnegative on its support and integrate to 1. If the integral exists and is finite, the \(k\)th raw moment is the integral of \(x^k\) weighted by the density.

$$ E[X^k]=\int_{-\infty}^{\infty}x^k f_X(x)\,dx. $$

When the density is zero outside a smaller support, integrate only over that support. The first moment may involve negative contributions if the support includes negative values. The integrand for the second raw moment, \(x^2 f_X(x)\), is nonnegative, but its integral is not guaranteed to be finite for every density.

Worked Example: Integrating a Density for Two Raw Moments

A hypothetical continuous model assigns a random proportion \(X\) of a one-hour review period to a particular task. Let \(X\) have density \(f_X(x)=2x\) for \(0<x<1\), and zero otherwise. Calculate \(E[X]\), \(E[X^2]\), and \(P(X>1/2)\). Here \(X\) is a proportion, so it has no physical unit.

Method and model check. Use density integrals over the support \((0,1)\). The density is nonnegative there, and its total integral is

$$ \int_0^1 2x\,dx=[x^2]_0^1=1-0=1. $$

It is therefore normalized.

First raw moment.

$$ E[X]=\int_0^1 x(2x)\,dx =2\int_0^1x^2\,dx =2\left[\frac{x^3}{3}\right]_0^1 =2\left(\frac13-0\right) =\frac23. $$

Second raw moment. Multiply the density by \(x^2\), not by the first moment:

$$ E[X^2]=\int_0^1 x^2(2x)\,dx =2\int_0^1x^3\,dx =2\left[\frac{x^4}{4}\right]_0^1 =2\left(\frac14-0\right) =\frac12. $$

Probability check. The requested event is an interval, so integrate the density over that interval:

$$ P(X>1/2)=\int_{1/2}^1 2x\,dx =[x^2]_{1/2}^1 =1-\frac14 =\frac34. $$

The results \(E[X]=2/3\), \(E[X^2]=1/2\), and \(P(X>1/2)=3/4\) follow directly from the stated density and support.

Common mistake avoided: Integrating \(x^2\) alone would omit the probability weighting supplied by the density. The moment integrand is \(x^2 f_X(x)\), which here is \(2x^3\).

Why the Sum and Integral Formulas Work

For a discrete variable, the possible outcomes partition the probability into separate masses. The expectation of a function \(g(X)\) is the sum of each function value \(g(x)\) weighted by the probability of that outcome. Choosing \(g(x)=x^k\) gives the discrete raw-moment formula:

$$ E[g(X)]=\sum_x g(x)P(X=x) \quad\Longrightarrow\quad E[X^k]=\sum_x x^kP(X=x). $$

For a continuous variable, divide its support into small intervals. In an interval of width \(\Delta x\) near \(x\), the probability is approximately \(f_X(x)\Delta x\). The contribution to the expectation of \(g(X)\) is therefore approximately \(g(x)f_X(x)\Delta x\). Adding these contributions and taking the limit as the interval widths shrink gives the integral of \(g(x)f_X(x)\). Substituting \(g(x)=x^k\) yields the continuous formula.

$$ E[X^k]=\int_{-\infty}^{\infty}x^k f_X(x)\,dx. $$

This justification also explains the key practical distinction: a discrete calculation uses probability masses, while a continuous calculation uses a density integrated over intervals. A density value at one point is not itself the probability at that point.

Mixed Distributions and Careful Bookkeeping

Some random variables have both one or more point masses and a continuous part. For these models, include both kinds of contribution. A point mass contributes its value raised to the required power, multiplied by the probability at that value. The continuous part contributes an integral using its density, which must include only the probability assigned to that continuous part.

Worked Example: Combining a Point Mass and a Density

For a hypothetical model of a nonnegative delay \(X\), there is probability \(1/4\) of no delay, so \(P(X=0)=1/4\). With probability \(3/4\), the delay has conditional density \(2x\) on \(0<x<1\). Calculate the first and second raw moments and \(P(X>1/2)\). Delay is measured in hours.

Method and model check. The conditional density integrates to \(\int_0^1 2x\,dx=1\). Thus the continuous component has total probability \(3/4\), and the atom at zero has probability \(1/4\); together they sum to 1.

The unconditional density on \(0<x<1\) is the conditional density multiplied by the probability \(3/4\) of entering that component:

$$ f_{\text{continuous}}(x)=\frac34(2x)=\frac32x,\qquad 0<x<1. $$

First raw moment. The atom at zero contributes \(0(1/4)=0\). The continuous component contributes:

$$ E[X]=0\left(\frac14\right)+\int_0^1 x\left(\frac32x\right)dx =\frac32\left[\frac{x^3}{3}\right]_0^1 =\frac32\left(\frac13\right) =\frac12. $$

Second raw moment. The atom again contributes zero, and the continuous component gives:

$$ E[X^2]=0^2\left(\frac14\right)+\int_0^1x^2\left(\frac32x\right)dx =\frac32\left[\frac{x^4}{4}\right]_0^1 =\frac32\left(\frac14\right) =\frac38. $$

Probability check. The event \(X>1/2\) excludes the atom at zero. Hence

$$ P(X>1/2)=\int_{1/2}^1\frac32x\,dx =\frac32\left[\frac{x^2}{2}\right]_{1/2}^1 =\frac34\left(1-\frac14\right) =\frac34\cdot\frac34 =\frac9{16}. $$

The results are \(E[X]=1/2\) hour, \(E[X^2]=3/8\) hour squared, and \(P(X>1/2)=9/16\). The continuous component has probability \(3/4\), not 1, in the unconditional distribution.

Common mistake avoided: Using the conditional density \(2x\) as though it were the unconditional density would ignore the probability \(3/4\) of entering the continuous component. The unconditional density is \((3/4)(2x)\).

Checks, Units, and a Common Exam Trap

Raw moments retain powers of the units of \(X\). If \(X\) is measured in dollars, \(E[X]\) is in dollars and \(E[X^2]\) is in dollars squared. If \(X\) is a count or proportion, the units are interpreted accordingly. Keeping track of units can reveal that an expression has been calculated incorrectly.

One frequent error is confusing the second raw moment with the square of the first raw moment. They are different calculations: \(E[X^2]\) averages squared values, while \((E[X])^2\) squares the average. In the first worked example, \(E[X^2]=3.40\), whereas \((E[X])^2=(1.00)^2=1.00\). The incorrect calculation \(E[X^2]=(E[X])^2\) would therefore give \(1.00\), not \(3.40\).

To avoid errors, identify the support and probability model before calculating. For a discrete variable, check that the listed probabilities sum to 1. For a continuous variable, check that the density integrates to 1. Then write the moment formula with the power applied to \(X\), and include the probability mass or density in every contribution. These checks are useful whether the calculation is performed by hand or with software.

Key takeaway: The \(k\)th raw moment is \(E[X^k]\): sum \(x^k\) times its probability for a discrete distribution, or integrate \(x^k f_X(x)\) over the support for a continuous distribution. For a mixed distribution, include both the mass and density contributions.

Check Your Understanding

For each problem, identify the model and use its probability weights or density to calculate the requested quantities.

  1. A discrete variable \(X\) takes values \(-1\) and \(2\) with probabilities \(0.40\) and \(0.60\). Find \(E[X]\) and \(E[X^2]\). (Answer: \(E[X]=0.80\), \(E[X^2]=2.80\))
  2. A continuous variable has density \(f_X(x)=3x^2\) for \(0<x<1\), and zero otherwise. Find \(E[X]\) and \(E[X^2]\). (Answer: \(E[X]=3/4\), \(E[X^2]=3/5\))
  3. A mixed variable has probability \(0.20\) at \(X=2\); with probability \(0.80\), it is uniformly distributed on \([0,1]\). Find \(E[X]\) and \(E[X^2]\). (Answer: \(E[X]=0.80\), \(E[X^2]=16/15\))
  4. A discrete variable takes values \(0,1,3\) with probabilities \(0.25,q,0.75-q\). If \(E[X]=1.25\), find \(q\) and \(E[X^2]\), and verify that the resulting probabilities are valid. (Answer: \(q=0.50\), probabilities \(0.25,0.50,0.25\), and \(E[X^2]=2.75\))
  5. A continuous variable has density \(f_X(x)=cx\) for \(0<x<2\), and zero otherwise. Find \(c\), \(E[X]\), \(E[X^2]\), and \(P(X>1)\). (Answer: \(c=1/2\), \(E[X]=4/3\), \(E[X^2]=2\), and \(P(X>1)=3/4\))
Clinical Biostats