Computational Statistics

Chapter 7 - Monte Carlo Methods in Inference

Dr. Mehdi Maadooliat

Marquette University
MATH 4750 - Spring 2025

Lecture 1: Monte Carlo Estimation (Part 1)

Basic Monte Carlo Estimation

  • Introduction to Monte Carlo estimation
  • Example: Estimating the expected difference of two normal variables
m <- 1000
g <- numeric(m)
for (i in 1:m) {
    x <- rnorm(2)
    g[i] <- abs(x[1] - x[2])
}
est <- mean(g)
est
[1] 1.108968

Visualizing Monte Carlo Simulations

# Histogram of the simulated differences
hist(g, main="Histogram of Differences (Monte Carlo)", col="lightblue")

Lecture 2: Monte Carlo MSE Estimation (Part 2)

Estimating the Mean Squared Error (MSE)

  • Monte Carlo estimation of MSE for trimmed means
n <- 20
m <- 1000
mean_trim <- numeric(m)
for (i in 1:m) {
    x <- rnorm(n)
    mean_trim[i] <- mean(x, trim = 0.1)
}
mse <- mean((mean_trim - 0)^2)
mse
[1] 0.05229764

Visualizing MSE Simulations

# Histogram of the trimmed means
hist(mean_trim, main="Trimmed Means (Monte Carlo MSE)", col="lightgreen")

Lecture 3: Advanced Monte Carlo Techniques (Part 3)

Additional Monte Carlo Techniques

  • Exploring advanced Monte Carlo techniques for inference
  • Example: Hypothesis testing with Monte Carlo methods
# Monte Carlo test example: Hypothesis testing
n <- 50
m <- 1000
test_stat <- numeric(m)
for (i in 1:m) {
    x <- rnorm(n)
    test_stat[i] <- mean(x)
}
p_value <- mean(test_stat >= 1.96)
p_value
[1] 0

Conclusion

  • Recap of Monte Carlo methods in inference, MSE estimation, and hypothesis testing
  • Practice: Apply these methods to other inferential problems