RATS 10.1
RATS 10.1

Examples /

VARSTABILITY.RPF

Home Page

← Previous Next →

VARSTABILITY.RPF is an example of a Nyblom(1989) fluctuations test for a VAR. Note that a VAR has enough flexibility that it may be able to come up with a single set of estimates which can fit a set of data with a break sufficiently well that it passes a fluctuations test. (It may fit both subranges equally poorly).

Full Program

 

open data haversample.rat
calendar(q) 1959
data(format=rats) 1959:1 2006:4 dgnp fm2 gdph ih lr
*
set loggdp = 100.0*log(gdph)
set logm2  = 100.0*log(fm2)
set logp   = 100.0*log(dgnp)
set logi   = 100.0*log(ih)
set unemp  = lr
*
system(model=usamodel)
variables loggdp unemp logi logp logm2
lags 1 to 4
det constant
end(system)
*
estimate(noprint,resids=resids) 1961:1 *
compute sigmainv=inv(%sigma)
*
dec vector s xt ut score %hstats
dec symm v vinv
*
* Compute sample information matrix
*
compute v=%zeros(%nregsystem,%nregsystem)
do time=%regstart(),%regend()
   compute ut=%xt(resids,time)
   compute xt=%eqnxvector(%modeleqn(usamodel,1),time)
   compute score=%kroneker(sigmainv*ut,xt)
   compute v=v+%outerxx(score)
end do time
*
compute v=%nobs*v
compute vinv=inv(v)
*
* Compute test statistics
*
compute s=%zeros(%nregsystem,1)
compute %hstats=%zeros(%nregsystem,1)
compute %hjoint=0.0
do time=%regstart(),%regend()
   compute ut=%xt(resids,time)
   compute xt=%eqnxvector(%modeleqn(usamodel,1),time)
   compute score=%kroneker(sigmainv*ut,xt)
   compute s=s+score
   ewise %hstats(i)=%hstats(i)+s(i)^2
   compute %hjoint=%hjoint+%qform(vinv,s)
end do time
ewise %hstats(i)=%hstats(i)/v(i,i)
*
report(action=define,title="Nyblom Test for VAR")
report(atrow=1,atcol=1) "Joint test" "" %hjoint %nyblomtest(%hjoint,%nregsystem)
*
compute ij=1
do i=1,%nvar
   do j=1,%eqnsize(%modeleqn(usamodel,1))
      report(row=new,atcol=1) %modellabel(usamodel,i) %eqnreglabels(%modeleqn(usamodel,1))(j) $
           %hstats(ij) %nyblomtest(%hstats(ij),1)
      compute ij=ij+1
   end do j
end do i
*
report(action=format,atcol=3,tocol=4,format="*.###")
report(action=show)
 

Output

 

Joint test           17.400807 0.509393

LOGGDP     LOGGDP{1}  0.036875 0.946262

LOGGDP     LOGGDP{2}  0.036875 0.946261

LOGGDP     LOGGDP{3}  0.036886 0.946209

LOGGDP     LOGGDP{4}  0.036894 0.946167

LOGGDP     UNEMP{1}   0.035370 0.953455

LOGGDP     UNEMP{2}   0.033872 0.960169

LOGGDP     UNEMP{3}   0.034618 0.956886

LOGGDP     UNEMP{4}   0.034505 0.957387

LOGGDP     LOGI{1}    0.037753 0.941874

LOGGDP     LOGI{2}    0.037748 0.941898

LOGGDP     LOGI{3}    0.037593 0.942685

LOGGDP     LOGI{4}    0.037750 0.941890

LOGGDP     LOGP{1}    0.040375 0.928008

LOGGDP     LOGP{2}    0.040458 0.927550

LOGGDP     LOGP{3}    0.040542 0.927087

LOGGDP     LOGP{4}    0.040594 0.926804

LOGGDP     LOGM2{1}   0.039239 0.934150

LOGGDP     LOGM2{2}   0.039284 0.933909

LOGGDP     LOGM2{3}   0.039336 0.933633

LOGGDP     LOGM2{4}   0.039396 0.933314

LOGGDP     Constant   0.035430 0.953179

UNEMP      LOGGDP{1}  0.024642 0.989980

UNEMP      LOGGDP{2}  0.024666 0.989931

UNEMP      LOGGDP{3}  0.024670 0.989922

UNEMP      LOGGDP{4}  0.024684 0.989894

UNEMP      UNEMP{1}   0.021566 0.995137

UNEMP      UNEMP{2}   0.021149 0.995662

UNEMP      UNEMP{3}   0.021779 0.994854

UNEMP      UNEMP{4}   0.021953 0.994614

UNEMP      LOGI{1}    0.024959 0.989313

UNEMP      LOGI{2}    0.025162 0.988872

UNEMP      LOGI{3}    0.025155 0.988888

UNEMP      LOGI{4}    0.025298 0.988572

UNEMP      LOGP{1}    0.025975 0.987005

UNEMP      LOGP{2}    0.026021 0.986891

UNEMP      LOGP{3}    0.026062 0.986794

UNEMP      LOGP{4}    0.026147 0.986585

UNEMP      LOGM2{1}   0.026150 0.986579

UNEMP      LOGM2{2}   0.026166 0.986540

UNEMP      LOGM2{3}   0.026140 0.986602

UNEMP      LOGM2{4}   0.026083 0.986743

UNEMP      Constant   0.023759 0.991700

LOGI       LOGGDP{1}  0.054332 0.841732

LOGI       LOGGDP{2}  0.054351 0.841607

LOGI       LOGGDP{3}  0.054410 0.841222

LOGI       LOGGDP{4}  0.054421 0.841148

LOGI       UNEMP{1}   0.051600 0.859643

LOGI       UNEMP{2}   0.047304 0.887080

LOGI       UNEMP{3}   0.046886 0.889684

LOGI       UNEMP{4}   0.047942 0.883078

LOGI       LOGI{1}    0.056344 0.828416

LOGI       LOGI{2}    0.056373 0.828225

LOGI       LOGI{3}    0.056494 0.827418

LOGI       LOGI{4}    0.056651 0.826379

LOGI       LOGP{1}    0.060194 0.802810

LOGI       LOGP{2}    0.060285 0.802203

LOGI       LOGP{3}    0.060394 0.801476

LOGI       LOGP{4}    0.060499 0.800778

LOGI       LOGM2{1}   0.059303 0.808740

LOGI       LOGM2{2}   0.059360 0.808357

LOGI       LOGM2{3}   0.059460 0.807691

LOGI       LOGM2{4}   0.059575 0.806930

LOGI       Constant   0.051240 0.861981

LOGP       LOGGDP{1}  0.102013 0.556576

LOGP       LOGGDP{2}  0.102081 0.556244

LOGP       LOGGDP{3}  0.102095 0.556180

LOGP       LOGGDP{4}  0.102151 0.555906

LOGP       UNEMP{1}   0.067265 0.756096

LOGP       UNEMP{2}   0.067252 0.756180

LOGP       UNEMP{3}   0.068414 0.748609

LOGP       UNEMP{4}   0.073784 0.714250

LOGP       LOGI{1}    0.106607 0.534863

LOGP       LOGI{2}    0.106694 0.534461

LOGP       LOGI{3}    0.107277 0.531783

LOGP       LOGI{4}    0.107338 0.531508

LOGP       LOGP{1}    0.105694 0.539093

LOGP       LOGP{2}    0.105759 0.538789

LOGP       LOGP{3}    0.105840 0.538413

LOGP       LOGP{4}    0.105996 0.537690

LOGP       LOGM2{1}   0.107117 0.532519

LOGP       LOGM2{2}   0.107245 0.531932

LOGP       LOGM2{3}   0.107353 0.531435

LOGP       LOGM2{4}   0.107535 0.530605

LOGP       Constant   0.098515 0.573831

LOGM2      LOGGDP{1}  0.043727 0.908862

LOGM2      LOGGDP{2}  0.043615 0.909526

LOGM2      LOGGDP{3}  0.043582 0.909718

LOGM2      LOGGDP{4}  0.043584 0.909708

LOGM2      UNEMP{1}   0.063642 0.779917

LOGM2      UNEMP{2}   0.062464 0.787718

LOGM2      UNEMP{3}   0.057701 0.819402

LOGM2      UNEMP{4}   0.057232 0.822519

LOGM2      LOGI{1}    0.042813 0.914223

LOGM2      LOGI{2}    0.042264 0.917395

LOGM2      LOGI{3}    0.041986 0.918985

LOGM2      LOGI{4}    0.041826 0.919897

LOGM2      LOGP{1}    0.045330 0.899251

LOGM2      LOGP{2}    0.045419 0.898708

LOGM2      LOGP{3}    0.045515 0.898125

LOGM2      LOGP{4}    0.045570 0.897787

LOGM2      LOGM2{1}   0.044737 0.902838

LOGM2      LOGM2{2}   0.044782 0.902564

LOGM2      LOGM2{3}   0.044857 0.902112

LOGM2      LOGM2{4}   0.044909 0.901799

LOGM2      Constant   0.043561 0.909842

 


Copyright © 2025 Thomas A. Doan