RATS 10.1
RATS 10.1

Examples /

GRANGERBOOTSTRAP.RPF

Home Page

← Previous Next →

GRANGERBOOTSTRAP.RPF is a bootstrap alternative to the Granger causality tests in CAUSAL.RPF. The test statistic is the same (joint F test on the lags of nominal money), but the bootstrap allows approximation of the distribution allowing for unit roots in the variables.
 

This first tests for unit roots in the two variables. This is strongly accepted in FM1 (nominal money) and marginally accepted (at roughly the 10% level) for GDPH (real GDP).
 

The test statistic is bootstrapped using a parametric bootstrap, which means generating artificial data using resampled residuals applied to a model estimated on the original data. The bootstrapping has to be done under the null, so the equation for GDPH is estimated without the lags of FM1.
 

This also does a Granger causality test on the first differenced data. If the two series have unit roots but are not cointegrated, that test will have standard asymptotics.

 

A few things to note:

1.While the standard F has "non-standard" asymptotics if the series have unit roots, there is no theory which describes how it might differ. It could have thinner tails, thicker tails, or could be similar to the F. (Here they seem to be slightly thicker).

2.The bootstrapped p-value depends upon random numbers and so will not be exactly reproducible.

Full Program

cal(m) 1959:1
allocate 2006:4
open data haversample.rat
data(format=rats) / gdph fm1
log gdph
log fm1
*
* Test for unit roots
*
@dfunit(det=trend,lags=8,method=gtos) gdph
@dfunit(det=trend,lags=8,method=gtos) fm1
*
* Granger causality test with bootstrapped p-value.
*
* The bootstrap draws are conditional on the first 8 values of the two
* series. We do the equations in terms of "sample" series to make the
* bookkeeping easier later on.
*
* The bootstrapping has to be done under the null, so the GDP equation
* is estimated using only the lags of GDP. The money equation uses lags
* of both.
*
set msample = fm1
set gsample = gdph
linreg(define=eqg) gsample / rg
# constant gsample{1 to 8}
linreg(define=eqm) msample / rm
# constant gsample{1 to 8} msample{1 to 8}
*
group noncausal eqg eqm
*
compute ndraws=10000
set stats 1 ndraws = 0.0
do draw=1,ndraws
   *
   * Resample the residuals over the regression range
   *
   boot entries %regstart() %regend()
   set rgsample = rg(entries(t))
   set rmsample = rm(entries(t))
   *
   * Rebuild the data using the estimated model and the resampled residuals
   *
   forecast(paths,model=noncausal,from=%regstart(),to=%regend(),results=results)
   # rgsample rmsample
   set gsample = results(1)
   set msample = results(2)
   *
   * Do the causality test on the resampled data. Except for minor scale
   * factors, this will give identical results to a full system LR test
   * (under the assumptions of homoscedasticity).
   *
   linreg(noprint) gsample
   # constant gsample{1 to 8} msample{1 to 8}
   exclude(noprint)
   # msample{1 to 8}
   compute stats(draw)=%cdstat
end do draw
*
* Compute the percentiles of the test statistics
*
stats(fractiles) stats 1 ndraws
*
* Do the test with the real data
*
linreg(noprint) gdph
# constant gdph{1 to 8} fm1{1 to 8}
exclude(print,title="Granger causality test on original data")
# fm1{1 to 8}
*
* Figure out the bootstrapped p-value
*
sstats(mean) 1 ndraws (stats>%cdstat)>>pvalue
*
disp "Bootstrapped p-value" pvalue
*
* Granger causality test on differenced data. If the series aren't
* cointegrated (and there is no reason to believe that they would be),
* this wouldn't be misspecified and would have standard asymptotics.
*
set dgdp = gdph-gdph{1}
set dfm1 = fm1-fm1{1}
*
linreg dgdp
# constant dgdp{1 to 7} dfm1{1 to 7}
exclude(title="Granger causality test on differenced data")
# dfm1{1 to 7}

Output

Dickey-Fuller Unit Root Test, Series GDPH

Regression Run From 1959:08 to 2006:04

Observations        562

With intercept and trend

With 6 lags chosen from 8 by GTOS/t-tests(0.100)

 

Sig Level    Crit Value

1%(**)         -3.97881

5%(*)          -3.41984

10%            -3.13223

 

T-Statistic    -3.12952


 

Dickey-Fuller Unit Root Test, Series FM1

Regression Run From 1959:10 to 2006:04

Observations        560

With intercept and trend

With 8 lags chosen from 8 by GTOS/t-tests(0.100)
 

Sig Level    Crit Value

1%(**)         -3.97887

5%(*)          -3.41987

10%            -3.13224

 

T-Statistic    -1.04498


 

Linear Regression - Estimation by Least Squares

Dependent Variable GSAMPLE

Monthly Data From 1959:09 To 2006:04

Usable Observations                       560

Degrees of Freedom                        551

Centered R^2                        0.9998696

R-Bar^2                             0.9998677

Uncentered R^2                      0.9999997

Mean of Dependent Variable       8.6164000918

Std Error of Dependent Variable  0.4292900688

Standard Error of Estimate       0.0049370097

Sum of Squared Residuals         0.0134301097

Regression F(8,551)               528249.2892

Significance Level of F             0.0000000

Log Likelihood                      2184.0884

Durbin-Watson Statistic                2.0053
 

    Variable                        Coeff      Std Error      T-Stat      Signif

************************************************************************************

1.  Constant                      0.006358934  0.004256501      1.49393  0.13576513

2.  GSAMPLE{1}                    0.949359065  0.042548257     22.31253  0.00000000

3.  GSAMPLE{2}                   -0.016663923  0.056816781     -0.29329  0.76940918

4.  GSAMPLE{3}                    0.413050404  0.054687173      7.55297  0.00000000

5.  GSAMPLE{4}                   -0.391946257  0.057547133     -6.81087  0.00000000

6.  GSAMPLE{5}                   -0.020871613  0.057304824     -0.36422  0.71583281

7.  GSAMPLE{6}                    0.336446962  0.054179982      6.20980  0.00000000

8.  GSAMPLE{7}                   -0.319476028  0.056049387     -5.69990  0.00000002

9.  GSAMPLE{8}                    0.049573899  0.041806910      1.18578  0.23621933


 

Linear Regression - Estimation by Least Squares

Dependent Variable MSAMPLE

Monthly Data From 1959:09 To 2006:04

Usable Observations                       560

Degrees of Freedom                        543

Centered R^2                        0.9999593

R-Bar^2                             0.9999581

Uncentered R^2                      0.9999994

Mean of Dependent Variable       6.1448743408

Std Error of Dependent Variable  0.7782903192

Standard Error of Estimate       0.0050371136

Sum of Squared Residuals         0.0137772745

Regression F(16,543)              834053.5358

Significance Level of F             0.0000000

Log Likelihood                      2176.9425

Durbin-Watson Statistic                2.0004

 

    Variable                        Coeff      Std Error      T-Stat      Signif

************************************************************************************

1.  Constant                     -0.012143098  0.014584575     -0.83260  0.40543715

2.  GSAMPLE{1}                    0.065026096  0.043929424      1.48024  0.13938913

3.  GSAMPLE{2}                   -0.118952088  0.058523844     -2.03254  0.04258503

4.  GSAMPLE{3}                   -0.006651182  0.056161490     -0.11843  0.90577107

5.  GSAMPLE{4}                   -0.007690869  0.059057178     -0.13023  0.89643466

6.  GSAMPLE{5}                    0.059109463  0.058782373      1.00556  0.31507303

7.  GSAMPLE{6}                    0.006842079  0.055607604      0.12304  0.90211925

8.  GSAMPLE{7}                   -0.055211217  0.057578229     -0.95889  0.33804066

9.  GSAMPLE{8}                    0.060482658  0.043035457      1.40541  0.16046991

10. MSAMPLE{1}                    1.165909732  0.042866274     27.19877  0.00000000

11. MSAMPLE{2}                   -0.080649164  0.065763656     -1.22635  0.22059907

12. MSAMPLE{3}                    0.058979204  0.065917688      0.89474  0.37132242

13. MSAMPLE{4}                   -0.098532305  0.065982550     -1.49331  0.13593726

14. MSAMPLE{5}                    0.013690713  0.066076849      0.20719  0.83593619

15. MSAMPLE{6}                    0.092944658  0.066049297      1.40720  0.15993983

16. MSAMPLE{7}                   -0.119712105  0.066247686     -1.80704  0.07130968

17. MSAMPLE{8}                   -0.034508500  0.043129754     -0.80011  0.42399760


 

Statistics on Series STATS

Monthly Data From 1959:01 To 2792:04

Observations                 10000

Sample Mean               1.129668      Variance                   0.355424

Standard Error            0.596174      SE of Sample Mean          0.005962

t-Statistic (Mean=0)    189.486334      Signif Level (Mean=0)      0.000000

Skewness                  1.129607      Signif Level (Sk=0)        0.000000

Kurtosis (excess)         2.023916      Signif Level (Ku=0)        0.000000

Jarque-Bera            3833.453135      Signif Level (JB=0)        0.000000

 

Minimum                   0.053248      Maximum                    5.230216

01-%ile                   0.223540      99-%ile                    2.985717

05-%ile                   0.363739      95-%ile                    2.249625

10-%ile                   0.466912      90-%ile                    1.917810

25-%ile                   0.695120      75-%ile                    1.440961

Median                    1.029916


 

Granger causality test on original data

 

Null Hypothesis : The Following Coefficients Are Zero

FM1              Lag(s) 1 to 8

F(8,543)=      1.63750 with Significance Level 0.11131017

 

Bootstrapped p-value       0.17580

 

Linear Regression - Estimation by Least Squares

Dependent Variable DGDP

Monthly Data From 1959:09 To 2006:04

Usable Observations                       560

Degrees of Freedom                        545

Centered R^2                        0.3961784

R-Bar^2                             0.3806674

Uncentered R^2                      0.4937651

Mean of Dependent Variable       0.0027408756

Std Error of Dependent Variable  0.0062482495

Standard Error of Estimate       0.0049172277

Sum of Squared Residuals         0.0131776249

Regression F(14,545)                  25.5418

Significance Level of F             0.0000000

Log Likelihood                      2189.4025

Durbin-Watson Statistic                2.0023

 

    Variable                        Coeff      Std Error      T-Stat      Signif

************************************************************************************

1.  Constant                      0.001479198  0.000408205      3.62366  0.00031765

2.  DGDP{1}                      -0.054816184  0.042781902     -1.28129  0.20063540

3.  DGDP{2}                      -0.056405702  0.040930624     -1.37808  0.16874390

4.  DGDP{3}                       0.351154512  0.040735553      8.62034  0.00000000

5.  DGDP{4}                      -0.046961365  0.043430324     -1.08130  0.28004032

6.  DGDP{5}                      -0.073284061  0.040395052     -1.81418  0.07019912

7.  DGDP{6}                       0.266131432  0.040417472      6.58456  0.00000000

8.  DGDP{7}                      -0.039685183  0.041954270     -0.94592  0.34461101

9.  DFM1{1}                       0.015014447  0.041770042      0.35945  0.71939403

10. DFM1{2}                      -0.011667424  0.041974892     -0.27796  0.78114695

11. DFM1{3}                      -0.030343080  0.042118970     -0.72041  0.47157923

12. DFM1{4}                       0.074219612  0.042453573      1.74825  0.08098318

13. DFM1{5}                       0.102275946  0.042141826      2.42695  0.01554964

14. DFM1{6}                      -0.035357341  0.042253249     -0.83680  0.40307412

15. DFM1{7}                      -0.037454897  0.042075755     -0.89018  0.37376328


 

Granger causality test on differenced data

 

Null Hypothesis : The Following Coefficients Are Zero

DFM1             Lag(s) 1 to 7

F(7,545)=      1.65919 with Significance Level 0.11655625


 


Copyright © 2025 Thomas A. Doan