Dear Team,

I have used Dynamic Cointegration (Johansen's cointegration, with a rolling window). Now I have twin objectives:

1) to estimate the rolling speed of adjustment coefficients and

2) rolling LR test statistic for rolling weak exogeneity tests.

I am not at all skilled at programming. I tried to write the following program(with the help of Rolling Regression code written by @Eviews Gareth). However, it doesn't seem to work, that is, "series lr" shows value only upto first subsample, coefmat contains only "0.0000". I would be highly obliged if you could see what all needs to be corrected. Please find attached the program file. Thank you!

smpl 1 3000

' set window size

!window = 750

' set step size

!step = 1

' get size of workfile

!length = @obsrange

'calculate number of rolls

!nrolls = @floor((!length-!window)/!step)

'matrix to store coefficient estimates

matrix(5,!nrolls) coefmat

'catching start and end points

%start = "@first" '@otod(@ifirst(ser))

%end = "@last" '@otod(@ilast(ser))

'variable keeping track of how many rolls we've done

!j=0

' move sample !step obs at a time

for !i = 1 to !length-!window+1-!step step !step

!j=!j+1

' set sample for estimation period

%first = @otod(@dtoo(%start)+!i)

%last = @otod(@dtoo(%start)+!i+!window-1)

smpl {%first} {%last}

'introduce and run vecm

var vec1.ec(b,1) 1 2 lbel lemu

' store coefficients

series alpha=vec1.a(2,1)

'save unrestricted logl for later use

freeze(test1) vec1.coint(b,2,save=mat1)

'test weak exogeneity a1=0

vec1.cleartext(coint)

vec1.append(coint) a(2,1)=0

'save restricted logl for later use

freeze(test2) vec1.coint(b,2,restrict,c=1e-5,m=100,save=mat2)

series lr=2*(mat1(1,4)-mat2(1,4))

next

## Rolling VEC and Exogeneity

**Moderators:** EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

### Re: Rolling VEC and Exogeneity

Dear Team,

I have used Dynamic Cointegration (Johansen's cointegration, with a rolling window). Now I have twin objectives:

1) to estimate the rolling speed of adjustment coefficients and

2) rolling LR test statistic for rolling weak exogeneity tests.

I am not at all skilled at programming. I tried to write the following program(with the help of Rolling Regression code written by @Eviews Gareth). However, it doesn't seem to work, that is, "series lr" shows value only upto first subsample, coefmat contains only "0.0000". I would be highly obliged if you could see what all needs to be corrected. Please find attached the program file. Thank you!

smpl 1 3000

' set window size

!window = 750

' set step size

!step = 1

' get size of workfile

!length = @obsrange

'calculate number of rolls

!nrolls = @floor((!length-!window)/!step)

'matrix to store coefficient estimates

matrix(5,!nrolls) coefmat

'catching start and end points

%start = "@first" '@otod(@ifirst(ser))

%end = "@last" '@otod(@ilast(ser))

'variable keeping track of how many rolls we've done

!j=0

' move sample !step obs at a time

for !i = 1 to !length-!window+1-!step step !step

!j=!j+1

' set sample for estimation period

%first = @otod(@dtoo(%start)+!i)

%last = @otod(@dtoo(%start)+!i+!window-1)

smpl {%first} {%last}

'introduce and run vecm

var vec1.ec(b,1) 1 2 lbel lemu

' store coefficients

series alpha=vec1.a(2,1)

'save unrestricted logl for later use

freeze(test1) vec1.coint(b,2,save=mat1)

'test weak exogeneity a1=0

vec1.cleartext(coint)

vec1.append(coint) a(2,1)=0

'save restricted logl for later use

freeze(test2) vec1.coint(b,2,restrict,c=1e-5,m=100,save=mat2)

series lr=2*(mat1(1,4)-mat2(1,4))

next

I have used Dynamic Cointegration (Johansen's cointegration, with a rolling window). Now I have twin objectives:

1) to estimate the rolling speed of adjustment coefficients and

2) rolling LR test statistic for rolling weak exogeneity tests.

I am not at all skilled at programming. I tried to write the following program(with the help of Rolling Regression code written by @Eviews Gareth). However, it doesn't seem to work, that is, "series lr" shows value only upto first subsample, coefmat contains only "0.0000". I would be highly obliged if you could see what all needs to be corrected. Please find attached the program file. Thank you!

smpl 1 3000

' set window size

!window = 750

' set step size

!step = 1

' get size of workfile

!length = @obsrange

'calculate number of rolls

!nrolls = @floor((!length-!window)/!step)

'matrix to store coefficient estimates

matrix(5,!nrolls) coefmat

'catching start and end points

%start = "@first" '@otod(@ifirst(ser))

%end = "@last" '@otod(@ilast(ser))

'variable keeping track of how many rolls we've done

!j=0

' move sample !step obs at a time

for !i = 1 to !length-!window+1-!step step !step

!j=!j+1

' set sample for estimation period

%first = @otod(@dtoo(%start)+!i)

%last = @otod(@dtoo(%start)+!i+!window-1)

smpl {%first} {%last}

'introduce and run vecm

var vec1.ec(b,1) 1 2 lbel lemu

' store coefficients

series alpha=vec1.a(2,1)

'save unrestricted logl for later use

freeze(test1) vec1.coint(b,2,save=mat1)

'test weak exogeneity a1=0

vec1.cleartext(coint)

vec1.append(coint) a(2,1)=0

'save restricted logl for later use

freeze(test2) vec1.coint(b,2,restrict,c=1e-5,m=100,save=mat2)

series lr=2*(mat1(1,4)-mat2(1,4))

next

### Who is online

Users browsing this forum: No registered users and 7 guests