Chapter 8

Ques 16: Let Z = X/Y where X and Y have normal densities with mean 0 and standard deviation 1. Then it can be shown that Z has a Cauchy density.

(a) Write a program to illustrate this result by plotting a bar graph of 1000 samples obtained by forming the ratio of two standard normal outcomes. Compare your bar graph with the graph of the Cauchy density. Depending upon which computer language you use, you may or may not need to tell the computer how to simulate a normal random variable. A method for doing this was described in Section 5.2.

X/Y Normal Distribution

hist(rnorm(1000)/rnorm(1000), breaks=20000, xlim=c(-5,5), col = "grey", main = "X/Y Normal Distribution")

Cauchy Distribution

hist(rcauchy(1000), breaks=20000, xlim=c(-5,5), col = "grey", main = "Cauchy Distribution")

The two histograms are quite similar.

(b) We have seen that the Law of Large Numbers does not apply to the Cauchy density (see Example 8.8). Simulate a large number of experiments with Cauchy density and compute the average of your results. Do these averages seem to be approaching a limit? If so can you explain why this might be?

Lets simulate with 10000 trials.

trials <- 10000

# Normal Distribution
norm_dist <- rep(0,trials)
norm_avg <- rep(0,trials)

# Cauchy Distribution
cauchy_dist <- rep(0,trials)
cauchy_avg <- rep(0,trials)

# Calculate average
for (n in 1:trials) {
  norm_dist[n] <- mean(rnorm(1000))
  norm_avg[n] <- mean(norm_dist[1:n])
  
  cauchy_dist[n] <- mean(rnorm(1000)/rnorm(1000))
  cauchy_avg[n] <- mean(cauchy_dist[1:n])
}

# Cauchy plot for mean
plot(cauchy_avg, col = "red", main="")

# normal dist plot for mean
plot(norm_avg, col = "red", main="")

As we can see normal distribution converges to 0 but cauchy doesn’t.