Chapter 9 Exercise 2:

Let \(\{X_k\}\), \(1 \leq k \leq n\), be a sequence of independent random variables, all with mean 0 and variance 1, and let \(S_n\), \(S_n^*\), and \(A_n\) be their sum, standardized sum, and average, respectively. Verify directly that \(S_n^* = \frac{S_n}{\sqrt{n}} = \sqrt{n}A_n\).

We’re going to show that the standardized sum of some random numbers (all with average 0 and variance 1) is equal to the square root of the number of these random numbers times their average.

  1. We generate n random numbers with average 0 and variance 1.
  2. We sum these numbers to get Sn.
  3. We divide Sn by the square root of n to get the standardized sum, Sn*.
  4. We also calculate the average of these numbers, An.
  5. We show that Sn* is the same as sqrt(n) * An.
set.seed(123) # For the same results each time

verify_relationship <- function(n) {
  X <- rnorm(n, 0, 1) # n random numbers
  Sn <- sum(X) # Sum
  Sn_star <- Sn / sqrt(n) # Standardized sum
  An <- Sn / n # Average
  
  cat("Sn*:", Sn_star, "\n")
  cat("sqrt(n) * An:", sqrt(n) * An, "\n")
}

verify_relationship(10) # Test with 10 random numbers
## Sn*: 0.235987 
## sqrt(n) * An: 0.235987

The output shows that Sn* (the standardized sum) and sqrt(n) * An (the square root of n times the average) are indeed equal, as they both came out to be 0.235987. This confirms the mathematical relationship we were looking to verify.