### Aptech Systems, Inc. Worldwide Headquarters

Address:

Aptech Systems, Inc.

2350 East Germann Road, Suite #21

Chandler, AZ 85286Phone: 360.886.7100

FAX: 360.886.8922**Ready to Get Started?**### Request Quote & Product Information

### Industry Solutions

### Products

### Resources

### Support

### Training & Events

Want more guidance while learning about the full functionality of GAUSS and its capabilities? Get in touch for in-person training or browse additional references below.

### Tutorials

Step-by-step, informative lessons for those who want to dive into GAUSS and achieve their goals, fast.

### Have a Specific Question?

Get a real answer from a real person

- Need Support?

### Q&A: Register and Login

### Support Plans

Premier Support and Platinum Premier Support are annually renewable membership programs that provide you with important benefits including technical support, product maintenance, and substantial cost-saving features for your GAUSS System or the GAUSS Engine.

### User Forums

Join our community to see why our users are considered some of the most active and helpful in the industry!

### Where to Buy

Available across the globe, you can have access to GAUSS no matter where you are.

### Recent Tags

applications character vectors CML CMLMT Constrained Optimization datasets dates dlibrary dllcall error error handling errors Excel FANPACMT file i/o floating network GAUSS Engine graphics GUI hotkeys installation Java API license licensing linux loading data matrices matrix matrix manipulation Maxlik MaxLikMT Memory optimization Optmum output PQG graphics procs RAM random numbers string functions strings structures threading Time Series writing data### Recent Questions

### Features

### Time Series 2.0 MT

### Industry Solutions

### Find out more now

### Time Series MT 2.1

# Resources

# Qu and Perron Test. Error G0058.

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 file@ output file = mbr-out.out reset; @load the data@ @import excel file@ filename= "Q&Perron.xlsx"; range= "B3:Z1060"; xlsmat= SpreadsheetReadM(filename, range, 1); @do matrix variables in vector variables@ @Set your T by n matrix of dependent variables@ y=xlsmat[.,2:13]; @Set your T by q matrix of regressors@ z=xlsmat[.,14:26]; @Specify the number of observations@ 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 case@ 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 size.@ trm=0.2; @set brv=1 when allowing breaks in the covariance matrix of the errors; otherwise, set brv=0@ brv=0; @set brbeta=1 when allowing breaks in regression coefficients; otherwise, set brbeta=0.@ 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 matrix.@ 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).@ 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 always.@ 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;

## 5 Answers

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?

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.

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.

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.

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.