montecarlo simulation lab nov 27 2009 econ 4550. montecarlo simulations monte carlo simulation is a...

21
Montecarlo Simulation LAB NOV 27 2009 ECON 4550

Upload: patrick-terry

Post on 30-Dec-2015

217 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Montecarlo Simulation LAB NOV 27 2009 ECON 4550. Montecarlo Simulations Monte Carlo simulation is a method of analysis based on artificially recreating

Montecarlo Simulation

LAB NOV 27 2009

ECON 4550

Page 2: Montecarlo Simulation LAB NOV 27 2009 ECON 4550. Montecarlo Simulations Monte Carlo simulation is a method of analysis based on artificially recreating

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

Page 3: Montecarlo Simulation LAB NOV 27 2009 ECON 4550. Montecarlo Simulations Monte Carlo simulation is a method of analysis based on artificially recreating

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

Page 4: Montecarlo Simulation LAB NOV 27 2009 ECON 4550. Montecarlo Simulations Monte Carlo simulation is a method of analysis based on artificially recreating

Montecarlo Simulations

• We will conduct simple Monte Carlo simulations that will remind us about how the OLS performs

• It is like “test-driving” OLS

Page 5: Montecarlo Simulation LAB NOV 27 2009 ECON 4550. Montecarlo Simulations Monte Carlo simulation is a method of analysis based on artificially recreating

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

Page 6: Montecarlo Simulation LAB NOV 27 2009 ECON 4550. Montecarlo Simulations Monte Carlo simulation is a method of analysis based on artificially recreating

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

Page 7: Montecarlo Simulation LAB NOV 27 2009 ECON 4550. Montecarlo Simulations Monte Carlo simulation is a method of analysis based on artificially recreating

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

Page 8: Montecarlo Simulation LAB NOV 27 2009 ECON 4550. Montecarlo Simulations Monte Carlo simulation is a method of analysis based on artificially recreating

Montecarlo Simulations

• Example

• http://shazam.econ.ubc.ca/intro/mcarlo.htm

Page 9: Montecarlo Simulation LAB NOV 27 2009 ECON 4550. Montecarlo Simulations Monte Carlo simulation is a method of analysis based on artificially recreating

Montecarlo Simulations

• Example

• http://shazam.econ.ubc.ca/intro/mcarlo.htm

• Using an amplified version of the dataset GHJ160.txt

• It contains data on food expenditures and income

Page 10: Montecarlo Simulation LAB NOV 27 2009 ECON 4550. Montecarlo Simulations Monte Carlo simulation is a method of analysis based on artificially recreating

Montecarlo Simulations

• Example

• http://shazam.econ.ubc.ca/intro/mcarlo.htm

• Using an amplified version of the dataset GHJ160.txt

• It contains data on food expenditures and income

Page 11: Montecarlo Simulation LAB NOV 27 2009 ECON 4550. Montecarlo Simulations Monte Carlo simulation is a method of analysis based on artificially recreating

Montecarlo Simulations

• We can use a simple OLS regression on the first 40 original observations to obtain:

Yhat = 7.3832 + 0.2323 INCOME

Page 12: Montecarlo Simulation LAB NOV 27 2009 ECON 4550. Montecarlo Simulations Monte Carlo simulation is a method of analysis based on artificially recreating

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 = 7.3832 + 0.2323 INCOME + e

Page 13: Montecarlo Simulation LAB NOV 27 2009 ECON 4550. Montecarlo Simulations Monte Carlo simulation is a method of analysis based on artificially recreating

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

Page 14: Montecarlo Simulation LAB NOV 27 2009 ECON 4550. Montecarlo Simulations Monte Carlo simulation is a method of analysis based on artificially recreating

Montecarlo Simulations

• Now we assume that that estimated variance is actually the one driving the real process in the population

• That variance is 46.853, which you can obtain from SHAZAM

Page 15: Montecarlo Simulation LAB NOV 27 2009 ECON 4550. Montecarlo Simulations Monte Carlo simulation is a method of analysis based on artificially recreating

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 46.853

• The NOR function on the GENR command is used to generate normal random numbers.

Page 16: Montecarlo Simulation LAB NOV 27 2009 ECON 4550. Montecarlo Simulations Monte Carlo simulation is a method of analysis based on artificially recreating

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

Page 17: Montecarlo Simulation LAB NOV 27 2009 ECON 4550. Montecarlo Simulations Monte Carlo simulation is a method of analysis based on artificially recreating

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

Page 18: Montecarlo Simulation LAB NOV 27 2009 ECON 4550. Montecarlo Simulations Monte Carlo simulation is a method of analysis based on artificially recreating

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

Page 19: Montecarlo Simulation LAB NOV 27 2009 ECON 4550. Montecarlo Simulations Monte Carlo simulation is a method of analysis based on artificially recreating

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

Page 20: Montecarlo Simulation LAB NOV 27 2009 ECON 4550. Montecarlo Simulations Monte Carlo simulation is a method of analysis based on artificially recreating

Montecarlo Simulations

Repeat the whole exercise for the case of only 200 replications and compare your results

Page 21: Montecarlo Simulation LAB NOV 27 2009 ECON 4550. Montecarlo Simulations Monte Carlo simulation is a method of analysis based on artificially recreating