Montecarlo Simulation LAB NOV ECON 4550
Montecarlo Simulations Monte Carlo simulation is a method of analysis based on artificially recreating a chance process (usually with a computer), running it many times, and directly observing the results We can use computers to draw large numbers of artificial random samples to evaluate the performance of a variety of sample-based statistics
Montecarlo Simulations Monte Carlo simulation” is a general term with many meanings “Simulation” means that we build an artificial model of a real system to study and understand the system The “Monte Carlo” part of the name comes from the capital of Monaco and reminds us of the randomness inherent in the analysis
Montecarlo Simulations We will conduct simple Monte Carlo simulations that will remind us about how the OLS performs It is like “test-driving” OLS
Montecarlo Simulations For example, in the single regression model, the parameter of interest is usually the slope parameter If the errors have zero mean, the explanatory variable is non-random and the model is correctly specified, the OLS estimator is an unbiased estimator of the slope parameter, which means that on average it will be equal to the parameter
Montecarlo Simulations If, additionally, the errors are normally distributed, the OLS estimator has a normal distribution With one given sample of observations from the population, OLS can be applied to obtain one estimate of the slope parameter That OLS estimate will be smaller or larger than the true parameter However, if estimates were obtained from a "large" number of random samples then the average estimate over all samples would equal the true parameter value
Montecarlo Simulations The above ideas can be illustrated with the help of computer simulation Repeated samples of data can be generated by artificially generating errors that follow a given distribution The properties of the OLS estimation rule can then be analyzed
Montecarlo Simulations Example m
Montecarlo Simulations Example mhttp://shazam.econ.ubc.ca/intro/mcarlo.ht m Using an amplified version of the dataset GHJ160.txt It contains data on food expenditures and income
Montecarlo Simulations Example mhttp://shazam.econ.ubc.ca/intro/mcarlo.ht m Using an amplified version of the dataset GHJ160.txt It contains data on food expenditures and income
Montecarlo Simulations We can use a simple OLS regression on the first 40 original observations to obtain: Yhat = INCOME
Montecarlo Simulations However, we will now assume that these results are not merely estimates but rather describe the true (usually deemed unobservable) model for household expenditure on food That is, let us assume that the true linear regression model is: Y = INCOME + e
Montecarlo Simulations The first order of business would be to say something about the error e We can assume it is distributed normally and homoskedastically We can find out from the original OLS regression its estimated variance
Montecarlo Simulations Now we assume that that estimated variance is actually the one driving the real process in the population That variance is , which you can obtain from SHAZAM
Montecarlo Simulations For a sample size of N=40 : Use a random number generator to generate a sample of independent and identically distributed errors with mean zero and variance The NOR function on the GENR command is used to generate normal random numbers.
Montecarlo Simulations For a sample size of N=40 : Calculate sample observations for the variable Y where INCOME is fixed Run OLS to obtain estimates of the intercept parameter and the slope parameter
Montecarlo Simulations For a sample size of N=40 : The above steps are repeated. At each replication a different set of expenditures Y is computed The number of replications is first set at 1000 The experiment then yields 1000 estimates of the slope parameter using a sample size of N=40 The sampling variability in the estimates can be summarized by plotting the empirical frequency distribution of the estimates in an histogram
Montecarlo Simulations For a sample size of N=80 : The above steps are repeated. At each replication a different set of expenditures Y is computed The number of replications is first set at 1000 The experiment then yields 1000 estimates of the slope parameter using a sample size of N=80 The sampling variability in the new set of estimates can be summarized by plotting the empirical frequency distribution of the estimates in an histogram
Montecarlo Simulations For a sample size of N=160 : The above steps are repeated. At each replication a different set of expenditures Y is computed The number of replications is first set at 1000 The experiment then yields 1000 estimates of the slope parameter using a sample size of N=160 The sampling variability in the new set of estimates can be summarized by plotting the empirical frequency distribution of the estimates in an histogram
Montecarlo Simulations Repeat the whole exercise for the case of only 200 replications and compare your results