An Eviews Program to Run a Monte Carlo Experiment: a Dickey-Fuller Distribution

Yüklə 31,94 Kb.
ölçüsü31,94 Kb.

An EViews Program to Run a Monte Carlo Experiment:

A Dickey-Fuller Distribution

Carlos Guerrero de Lizardi*

JEL C15, C22, C87

We present an Eviews program to run a Monte Carlo experiment. We use as example a Dickey-Fuller distribution. The proposed program is easier to put into practice than the code designed by, among others, Brooks (2002) or Fantazzini (2007). A short note about the Monte Carlo method is included. At the end we compare our critical values with the ones in Brooks (2002), Charemza and Deadman (1992), Enders (2004), and Patterson (2000).

An Eviews Program to Run a Monte Carlo Experiment:

a Dickey-Fuller Distribution
“But with this miraculous development of the ENIAC—along with the applications Stan must have been pondering—it occurred to him that statistical techniques should be resuscitated, and he discussed this idea with von Neumann. Thus was triggered the spark that led to the Monte Carlo method.” N. Metropolis (1987, p. 126).
A Monte Carlo experiment attempts to replicate an actual data-generating process (DGP). The process is repeated numerous times so that the distribution of the desired parameters and sample statistics can be tabulated. Its reliability is warranted by the Law of Large Numbers: as the sample size grows sufficiently large, the sample statistic converges to the true one. Thus, the sample statistic is an unbiased estimate of the population one. The beauty of the simulation is that attributes of the constructed series are known to the researcher. It is well-known that a limitation of a Monte Carlo experiment is that the results are specific to the assumptions used to generate the simulated data. For example, if you modify the sample size, include or delete an additional parameter, or use an alternative initial condition, a new simulation needs to be performed.1
In order to generate a Dickey-Fuller distribution using a Monte Carlo approach, it is necessary to follow four steps:

  1. Generate a sequence of (seudo) random numbers et based on a standard normal distribution.2

  2. Generate the sequence yt = ρ*yt-1 + et (eq. 1), where ρ = 1. With the intention of minimize the influence of yo, its value is fixed to zero and T = 500.

  3. Estimate the model ∆yt = γ*yt-1 + et (eq. 2), where γ = ρ-1. Following Dickey and Fuller (1979, 1981), the “t”-statistic will be recorded as . Obtain its distribution is our goal. According to Patterson (2000, p. 228), even though γ = 0 by construction, “the presence of et a random disturbance term, will prevent us from reaching this conclusion with certainty from a particular dataset”, that is, there will be a distribution of the with nonzero values occurring; if the estimation method is unbiased then this should be picked up if T is large enough “by an average of over the T samples equal to the value in the DGP”. About eq. 2 Charemza and Deadman (1997, p. 99) remind us that, because it is a regression of an I(0) variable on a I(1) variable, “not surprisingly, in such a case the t-ratio does not have a limiting normal distribution.”

  4. Repeat steps 1 to 3. By the way, Dickey and Fuller (1979, 1981) obtained 100 values for et, set γ = 1, y0 = 0 and calculated, accordingly, 100 values for yt.

The Eviews program to run the experiment is the following:

'Create a workfile undated, range 1 to 500.

!reps = 50000

for !i=1 to !reps

genr perturbacion{!i}=@nrnd

smpl 1 1

genr y{!i}=0

smpl 2 500

genr y{!i}=y{!i}(-1)+perturbacion{!i}

smpl 1 500

matrix(!reps,2) resultados

equation eq{!i}.ls D(y{!i})=c(1)*y{!i}(-1)



d perturbacion{!i}

d y{!i}

d eq{!i}


'Export "resultados" to Excel.

'Create a workfile undated, range 1 to 50,000.

'Copy and paste from Excel to the workfile.

The critical values depend on the specification of the null and alternative hypotheses. The Ho: γ = 0 implying yt = ρ*yt-1 + et with ρ =1, that is, yt is I(1). The alternative “should be chosen to maximize the power of the test in the likely direction of departure from the null. A two-sided alternative γ ≠ 0, comprising γ > 0 and γ < 0 is not chosen in general because γ > 0 corresponds to ρ > 1 and in that case the process generating yt is not stable; instead the one-side alternative Ha: γ < 0, that is ρ < 1, is chosen because departures from the null are expected to be in this direction corresponding to an I(0) process. Thus the critical values are negative, with sample values more negative than the critical values leading to rejection of the null hypothesis in the direction of the one-side alternative” (Patterson 2000, p. 228). The empirical distribution of our Dickey-Fuller statistic and its descriptive statistics are shown in the following figures:
Figure 1. Histogram and estimated densities of the Dickey-Fuller statistic

Figure 2. Descriptive statistics

It is clear that the simulated distribution is not like that of the t-distribution, which is symmetric and centered at zero. In Excel we sort from the highest values to the lowest ones. The value of -1.9359 is the average between the 2500th and 2501st lowest values in the 50,000 replications, and may be regarded as the critical value at the level of significance of 5%.

As a final point, in the following table we compare our results with those of Brooks (2002), Charemza y Deadman (1992), Enders (2004), and Patterson (2000).

Table 1. Critical values, Dickey-Fuller distribution

Sample size (T)


Brooks (2002)




Charemza y Deadman (1992)




Enders (2004)




Patterson (2000)




Brooks, C. (2002), Introductory Econometrics for Finance, Cambridge University Press.

Charemza, W. W. and D. F. Deadman (1999), New Directions in Econometric Practice, Edward Elgar.

Davidson, R. and J. G. MacKinnon (1993), Estimation and Inference in Econometrics, Oxford University Press.

Dickey D. and W. A. Fuller (1981), “Likelihood ratio statistics for autoregressive time series with a unit root”, Econometrica 49, July, 1057-72.

Dickey, D. and W. A. Fuller (1979), “Distribution of the estimates for autoregressive time series with a unit root”, Journal of the American Statistical Association 72, June, 427-31.

Enders, W. (2004), Applied Econometric Time Series, John Wiley&Sons.

Fantazzini, D. (2007), Econometrics I: OLS, University of Pavia,

Metropolis, N. (1987), Los Alamos Science, Special Issue: Stanislaw Ulam 1909-1984, pp. 125-30.

Patterson, K. (2000). An Introduction to Applied Econometrics: a Time Series Approach, Palgrave.

** Director del Doctorado en Política Pública, concentración en Economía Pública, y de la Maestría en Economía y Política Pública, Tecnológico de Monterrey, Campus Ciudad de México,

1 “The term is reported to have originated with Metropolis and Ulam (1949). If it had been coined a little later, it might have been called the ‘Las Vegas method’ instead of the ‘Monte Carlo method’” (Davidson and MacKinnon, 1993, p. 732).

2 Its mechanics is fully explained in Davidson and MacKinnon (1993).

Dostları ilə paylaş:

Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur © 2019
rəhbərliyinə müraciət

    Ana səhifə