Thanks for that Allin.

I thought I'd clarify the point regarding the autocorrelation test which was unclear in my previous email. The sample period 1985:01 to 2009:04 is chosen for specific reasons relating to stability and floating of the exchange rate. If the autocorrelation test (automatic) auxiliary equation uses information prior to 1985:01 then the information in that test is not the same as that in a VAR (4) estimated from 1986:01. Since Gretl's VAR or OLS options use 1985:01 as the start there isn't a problem of inconsistency.

It's just that I noticed the difference when I used J-MULTI to estimate the VAR and it uses 1986:01 as the estimation period even though the sample is specified 1985:01 to 2009:04. For my purposes of doing the autocorrelation tests on Gretl, I'll change the sample period to 1986:01 and that should resolve it.

While we're on the subject, is there a script for a portmanteau test for auto correlation? 

And using the var option in Gretl what's the best way to specify heterogeneous (in variables) equation structure? (e.g. to impose block exogeniety for a small open economy VAR) 

eg.
Y = Y-1 + X-1 + Z-1
X= X-1 + Z-1
Z=X-1 + Z-1

Thanks!

On Wed, Oct 12, 2011 at 2:04 PM, Allin Cottrell <cottrell@wfu.edu> wrote:
On Wed, 12 Oct 2011, Muheed Jamaldeen wrote:

> I've been using the modtest --autocorr option to test for
> autocorrelation in a VAR model. I set the sample 1985 01 - 2009 04
> (100 observations). The automatic test and the manually specified
> LM test calculation do not yield the same result because the
> former (automatic) uses observations (for the m lags) outside the
> sample while the latter (manual) stays within the specified sample
> period. I am of the opinion that the latter is more accurate
> because the sample is restricted for a priori reasons that would
> be invalid in the automatic autocorrelation testing option.
> Thoughts?

I think the basic point here is what one means by "restricting the
sample to 1985:1-2009:4" in this context (i.e. estimating a model
with lags).

This has been discussed on the list before, and opinions may differ.
I have maintained that the most intuitive interpretation is that
_estimation_ should run from 1985:1-2009:4, with prior lags being
accessed if possible. An alternative view is that no data earlier
than 1985:1 should be accessed in any way, in which case estimation
of a 4-lag VAR would have to start in 1986:1.

I guess my view is that so long as it's clear what gretl in fact
does, the user should be able to achieve what he or she wants. That
is, knowing that gretl tries to start estimation at the top of the
sample range if possible, if you want a 4-lag VAR that doesn't
access any data before 1985:1, you'll have to do

smpl 1986:1 2009:4

But as for your point about the autocorrelation test, I don't really
get it. The automatic test uses the same sample range as the VAR,
which seems to me right. Your manual test uses a shorter sample, and
that seems to me less pertinent. (Gretl follows the Breusch-Godfrey
and Kiviet approach in setting pre-sample residuals to zero in the
auxiliary regression.)

Besides, the results are substantively the same eiither way (fail to
reject H0, as one would expect in a reasonably specified VAR).

> Here's the output from the script:

> *AUTOMATIC: *
>
> Breusch-Godfrey test for autocorrelation up to order 4
> OLS, using observations 1985:1-2009:4 (T = 100)
> Dependent variable: uhat
>
>              coefficient    std. error     t-ratio     p-value
>  -------------------------------------------------------------
>  const       -0.00580334    0.320830      -0.01809     0.9856
>  time        -4.86302e-07   0.000692273   -0.0007025   0.9994
>  l_USGDP_1   -0.348853      0.657432      -0.5306      0.5970
>  l_USGDP_2    0.627695      0.609177       1.030       0.3057
>  l_USGDP_3   -0.123856      0.568652      -0.2178      0.8281
>  l_USGDP_4   -0.154690      0.333191      -0.4643      0.6436
>  l_COMP_1     0.00101458    0.0120923      0.08390     0.9333
>  l_COMP_2    -0.00117663    0.0211498     -0.05563     0.9558
>  l_COMP_3    -0.0101049     0.0314406     -0.3214      0.7487
>  l_COMP_4     0.0113482     0.0192114      0.5907      0.5563
>  uhat_1       0.377927      0.669859       0.5642      0.5741
>  uhat_2      -0.255529      0.496828      -0.5143      0.6083
>  uhat_3      -0.127548      0.238803      -0.5341      0.5946
>  uhat_4      -0.0859906     0.212572      -0.4045      0.6868
>
>  Unadjusted R-squared = 0.027148
>
> Test statistic: LMF = 0.599973,
> with p-value = P(F(4,86) > 0.599973) = 0.664
>
> *Alternative statistic: TR^2 = 2.714813,*
> *with p-value = P(Chi-square(4) > 2.71481) = 0.607*
>
> Ljung-Box Q' = 0.955537,
> with p-value = P(Chi-square(4) > 0.955537) = 0.916
>
> *MANUAL*
>
> Model 2: OLS, using observations 1986:1-2009:4 (T = 96)
> Dependent variable: uhatUSGDP
>
>                coefficient    std. error    t-ratio    p-value
>  -------------------------------------------------------------
>  const         -0.0211644     0.397158      -0.05329   0.9576
>  uhatUSGDP_1    0.338611      0.910909       0.3717 0.7111
>  uhatUSGDP_2   -0.261190      0.584142      -0.4471 0.6560
>  uhatUSGDP_3   -0.149634      0.245107      -0.6105    0.5432
>  uhatUSGDP_4 -0.0877872     0.221146      -0.3970 0.6924
>  time          -3.10909e-05   0.000855037   -0.03636   0.9711
>  l_USGDP_1     -0.309372      0.900280      -0.3436 0.7320
>  l_USGDP_2      0.580976      0.772587       0.7520 0.4542
>  l_USGDP_3     -0.107547      0.720912      -0.1492    0.8818
>  l_USGDP_4     -0.159781      0.485321      -0.3292 0.7428
>  l_COMP_1       0.00192274    0.0123714      0.1554    0.8769
>  l_COMP_2      -0.00188331    0.0216852     -0.08685   0.9310
>  l_COMP_3      -0.0100372     0.0391818     -0.2562 0.7985
>  l_COMP_4       0.0116237     0.0259833      0.4474 0.6558
>
> Mean dependent var  -0.000048   S.D. dependent var   0.004580
> Sum squared resid    0.001943   S.E. of regression   0.004868
> R-squared            0.024783   Adjusted R-squared  -0.129825
> F(13, 82)            0.160296   P-value(F)           0.999620
> Log-likelihood       382.5531   Akaike criterion    -737.1062
> Schwarz criterion   -701.2053   Hannan-Quinn        -722.5945
> rho                 -0.001343   Durbin-Watson        1.998754
>
> Excluding the constant, p-value was highest for variable 52 (time)
>
> Generated scalar T = 96
> Generated scalar R = 0.024783
> Generated scalar LM = 2.37917
> Chi-square(4): area to the right of 2.37917 = 0.666394
> (to the left: 0.333606)
>
> Thanks!
>
> Mj
_______________________________________________
Gretl-users mailing list
Gretl-users@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users