' 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