0% found this document useful (0 votes)
27 views33 pages

Monte Carlo Simulation Regression Analysis

This document describes using Monte Carlo simulations to estimate regression coefficients. It generates random y-data from a known regression model multiple times, estimates the coefficients in each replication, and stores them in a matrix. Descriptive statistics are then calculated on the coefficient distributions to analyze the properties of the estimators.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views33 pages

Monte Carlo Simulation Regression Analysis

This document describes using Monte Carlo simulations to estimate regression coefficients. It generates random y-data from a known regression model multiple times, estimates the coefficients in each replication, and stores them in a matrix. Descriptive statistics are then calculated on the coefficient distributions to analyze the properties of the estimators.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

 

' create workfile


wfcreate mcarlo u 1 10
 
' create data series for x
series x
[Link] 80, 100, 120, 140, 160, 180, 200, 220, 240, 260
 
' set seed for random number generator
rndseed 123456
 
' simulate y data
series y = 2.5 + 0.5*x + 3*nrnd
 
' regress y on a constant and x
equation [Link] y c x
 
' display results
show [Link]

 
' create workfile
wfcreate mcarlo u 1 10
 
' create data series for x
' NOTE: x is fixed in repeated samples
series x
[Link] 80, 100, 120, 140, 160, 180, 200, 220, 240, 260
 
' set seed for random number generator
rndseed 123456
 
' assign number of replications to a control variable
!reps = 100
 
' begin loop
for !i = 1 to !reps
   ' simulate y data
   series y = 2.5 + 0.5*x + 3*nrnd
 
   ' regress y on a constant and x
   equation [Link] y c x
next
' end of loop
 
' create workfile
wfcreate mcarlo u 1 10
 
' create data series for x
' NOTE: x is fixed in repeated samples
series x
[Link] 80, 100, 120, 140, 160, 180, 200, 220, 240, 260
 
' set seed for random number generator
rndseed 123456
 
' assign number of replications to a control variable
!reps = 100
 
' begin loop
for !i = 1 to !reps
   ' simulate y data
   series y = 2.5 + 0.5*x + 3*nrnd
 
   ' regress y on a constant and x
   equation [Link] y c x
next
' end of loop

' store monte carlo results in a matrix

 
' set workfile range to number of obs
wfcreate mcarlo u 1 10
 
' create data series for x
' NOTE: x is fixed in repeated samples
series x
[Link] 80, 100, 120, 140, 160, 180, 200, 220, 240, 260
 
' set seed for random number generator
rndseed 123456
 
' assign number of replications to a control variable
!reps = 100
 
' declare storage matrix
matrix(!reps,2) beta
 
' begin loop
for !i = 1 to !reps
   ' simulate y data
   series y = 2.5 + 0.5*x + 3*nrnd
 
   ' regress y on a constant and x
   equation [Link] y c x
 
   ' store each coefficient estimate in matrix
   beta(!i,1) = eq1.@coefs(1)     ' column 1 is intercept
   beta(!i,2) = eq1.@coefs(2)     ' column 2 is slope
next
' end of loop
 
' show descriptive stats of coef distribution
[Link]
 
HISTOGRAMA Y SUS ESTADÍSTICAS

DESVIACIÓN ESTÁNDAR

Asimetría : skewness
Curtosis
JARQUE-BERA

El estadístico de Jarque-Bera se distribuye asintóticamente como una distribución chi


cuadrado con dos grados de libertad y puede usarse para probar la hipótesis nula de que los
datos pertenecen a una distribución normal. La hipótesis nula es una hipótesis conjunta de
que la asimetría y el exceso de curtosis son nulos (asimetría = 0 y curtosis = 3).
14/04/2021

You might also like