I am Adrián from Valencia (Spain). I am doing an empirical study through the structural breaks test involved by Bai & Perron. Right now, I am having so many problems related with the Qu and Perron test.

The error appeared is:

C:\Users\Adrian\Desktop\TFG ROMAN\bai_and_perron\mbreak2 QPERRON2(36) : error G0058 : Index out of range

I would like to send you my database and then you could see where I have the error.

My GAUSS file is:

new; library pgraph; format /ld 6,3; cls; @select your output [email protected] output file = mbr-out.out reset; @load the [email protected] @import excel [email protected] filename= "Q&Perron.xlsx"; range= "B3:Z1060"; xlsmat= SpreadsheetReadM(filename, range, 1); @do matrix variables in vector [email protected] @Set your T by n matrix of dependent [email protected] y=xlsmat[.,2:13]; @Set your T by q matrix of [email protected] z=xlsmat[.,14:26]; @Specify the number of [email protected] T=rows(y); @Specify the matrix _S (here the first and second regressors are used in the first equation and the first and third regressors are used in the second equation)@ _S={1 0 0 0 0, 0 1 0 0 0, 0 0 1 0 0, 0 0 0 1 0, 0 0 0 1 0, 0 0 0 0 0, 0 0 0 0 1}; @set the maximum number of breaks allowed. If use the WDmax test set m=5, since the critical values reported correspond to this [email protected] m=4; @If you have restrictions, specify the matrix R (here only the constants (first regressor) is allowed to change in each equation). if you do not have restrictions, set R=eye(cols(_S)*(m+1))@ R=eye(cols(_S)*(m+1)); @set the trimming parameter that specifies the minimal length of a segment as a proportion of the sample [email protected] trm=0.2; @set brv=1 when allowing breaks in the covariance matrix of the errors; otherwise, set [email protected] brv=0; @set brbeta=1 when allowing breaks in regression coefficients; otherwise, set [email protected] brbeta=1; @set vauto=1 when applying a correction for serial correlation in the errors (in which case Andrews' (1991) method is used to construct the robust covariance [email protected] vauto=0; @set to prewhit=1 if you want to apply an AR(1) pre-whitening when estimating the robust covariance matrix (see Andrews and Monahan (1992)[email protected] prewhit=0; @Set hetq=1 if you want to allow the distribution of the regressors to change across regimes (this is used only when constructing confidence intervals for the estimates of the break dates. For the construction of the test hetq=1 [email protected] hetq=1; /*Call the main procedure*/ call mainp(m,cols(_S),z,y,cols(y),trm,T,brv,brbeta,vauto,hetq,prewhit); #include mbreak.src; end;

## 8 Answers

1

accepted

Your error message is telling us that the error is on line 36 of the file `mbreak2 QPERRON2`. Can you post the contents of that line?

0

Line 36 refers to this one:

z=xlsmat[.,14:26];

Do you want me to send you my database? Or with line 36 specified is enough?

Thank you.

0

The problem is that `xlsmat` is a 1057 row by 25 column matrix. We know this, because you assign `xlsmat` by loading data from `B3:Z1060` of the `XLS` file.

On the line with the error:

z=xlsmat[.,14:26];

you are trying to assign `z` to be equal to all the rows of `xlsmat` in the 14th through 26th columns. However, as we said above, `xlsmat` only has 25 columns.

To fix this problem, you either need to load an extra column from the spreadsheet (if one exists) or you need to assign fewer columns to `z`. For example this should not cause an error:

z=xlsmat[.,14:25];

Which you want to do will depend upon your data and model.

0

Ok, thank you, I see my mistake. However, the problem is not solved yet, as new errors appear, so that I'm going to try to explain all the possible mistakes:

My database starts from column A (which refers to dates... Do I have to include dates on GAUSS within the range?). If so, the range would be from A3 to Z1060.

After that, my dependent variables go from column B to column M (in total, 12 columns). Would it be y=xlsmat[.,2:13], because column 1 is related with dates.

And regressors go from N to Z (in total, 13 columns), so that we have:

z=xlsmat[.,14:26]

With this, there are two new errors which are this ones:

The basic specifications for testing and estimation:

-------------------------------------------

(1) M= 4.000

(2) Trimming= 0.200

(3) T= 1058.000

(4) The covariance matrix of errors is not allowed to change

(5) The number of coefficients (beta) in each regime is: 5.000

-------------------------------------------

other specificiations:

-------------------------------------------

(1) the code reports results for an unrestricted model (apart

from the basic specifications and for a restricted model

with restrictions specified by the user)

(2) the error is serially uncorrelated

(3) the distribution of the regressors is allowed to change

(4) No pre-whittening when constructing confidence intervals

------------------------------------------------------------------------

C:\Users\Adrian\Desktop\TFG ROMAN\bai_and_perron\mbreak.src(530) : error G0036 : Matrices are not conformable

Currently active call: transf [530] C:\Users\Adrian\Desktop\TFG ROMAN\bai_and_perron\mbreak.src

Stack trace:

transf called from C:\Users\Adrian\Desktop\TFG ROMAN\bai_and_perron\mbreak.src, line 68

mainp called from C:\Users\Adrian\Desktop\TFG ROMAN\bai_and_perron\mbreak2 QPERRON2, line 98

Thank you for your attention.

0

The first error you are getting is:

C:\Users\Adrian\Desktop\TFG ROMAN\bai_and_perron\mbreak.src(530) : error G0036 : Matrices are not conformable

This means that on line 530 of the file `mbreak.src` some operation matrix operation is being attempted in which the dimensions of the two matrices are not conformable.

You need to trace the code and see where these variables come from and what is wrong with them. The GAUSS debugger is very helpful for this.

0

Hi,

I am having the same problem exactly on the same line. Have you managed to solve it? Would appreciate for any help!

0

I actually could trace this up to this level (the bold code is the line 530)

local maty,matz,i,_ID;

_ID=eye(cols(y));

maty=y[1,.]';

**matz=_ID.*.(z[1,.])*_S;**

Following the instructions of the writers, _ID is a 2x2 matrix; z is a (1x3) and _S is a (3x3) matrix. Thus the multipication of these matrices is not possible. But i dont know how to solve this problem without ruining something in the test:(

0

Actually, the operator between `_ID` and `z` is the Kronecker product (`.*.`). As it stands, assuming the dimensions that you report, it should return a matrices not conformable error.

Can you post a link to download the code?