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

Matrices

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)
17 views33 pages

Matrices

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
You are on page 1/ 33

 

' create workfile


wfcreate mcarlo u 1 10
 
' create data series for x
series x
x.fill 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 eq1.ls y c x
 
' display results
show eq1.output

 
' create workfile
wfcreate mcarlo u 1 10
 
' create data series for x
' NOTE: x is fixed in repeated samples
series x
x.fill 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 eq1.ls 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
x.fill 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 eq1.ls 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
x.fill 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 eq1.ls 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
beta.stats
 
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