Law of Large Numbers with Sampling
Statistical Inference DS practice problem on Onlearn.
Difficulty: medium.
Topics: Understanding the Law of Large Numbers through Empirical Simulation, Cumulative Moving Average, Pseudorandom Number Generation, Vectorized Array Operations, Empirical Distribution, Asymptotic Behavior, Probability Theory, Statistical Inference, Computational Statistics, Stochastic Processes, Data Visualization Principles, Law of Large Numbers, Sampling Distributions, Expected Value, Random Variable Simulation, Convergence of Means.
Write a function that simulates rolling a fair six sided die N times. The function should return a list of cumulative means after each roll. The cumulative mean at index i is the average of all rolls from index 0 to i. Use this to demonstrate that as N increases, the cumulative mean approaches the theoretical expected value of 3.5.