Qu and Perron "Estimating and testing structural changes in multivariate regressions" (2007) test

Hi,

I am running the Qu-Perron test But I get the message "Undefined symbols: mainp." The link where the code can be downloaded is: http://people.bu.edu/perron/code.html

Thanks

The code I am trying to run is as follows:

@
This version: May 13, 2008.
This program is distributed freely for non-profit academic purposes only. for other uses, please contact Zhongjun Qu (zqu at uiuc.edu).
A lot of effort has been put to construct this program and we would appreciate that
you acknowledge using this code in your research and cite the relevant paper on which it is based:
Qu, Z. and P. Perron (2007): "Estimating and Testing for Structural Changes in Multivariate Regressions", Econometrica.
Although a lot of efforts have been put in constructing the program, we cannot be
held responsible for any consequences that could result from remaining errors.
Copyright: Zhongjun Qu and Pierre Perron (2007)
@

new;
library pgraph;
format /ld 6,3;
cls;

@select your output file@

output file = mbr-out.out reset;

@load the data@

load data[110,24]=data.txt;

@Set your T by n matrix of dependent variables@
y=data[.,1:4];

@Set your T by q matrix of regressors@
z=data[.,5:24];

@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 0 0 0 0 0 0 0 0 0 0 0 0 0 0,
    0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,
    0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,
    0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,
    0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,
    0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0,
    0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0,
    0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0,
    0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0,
    0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0,
    0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0,
    0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0,
    0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0,
    0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0,
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0,
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0,
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0,
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0,
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0,
    0 0 0 0 0 0 0 0 0 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=2;

@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=0;

/*Call the main procedure*/
call mainp(m,cols(_S),z,y,cols(y),trm,T,brv,brbeta,vauto,hetq,prewhit);

#include mbreak.src;

end;

3 Answers



0



accepted

The procedure mainp is defined inside of the file mbreak.src. The line

#include mbreak.src;

can be thought of as copying-and-pasting the contents of the #included'ed file when the file is run. However, for the #include to find mbreak.src, mbreak.src must be in your GAUSS current working directory or in your GAUSS SRC_PATH. For this case, I would set your GAUSS working directory to the directory in which both the file you posted and mbreak.src reside.

aptech

1,773


0



Thank you for your answer. Yes, I realized that too. My new problem is with setting my variables after loading data. The model I am trying to estimate is a VAR model with five lags and four variables. I am using the following code to create the matrix of endogenous variables (y) and the matrix of exogenous variables (z):

y = data[2:T,.];
z = ones(T-1, 1)~data[1 : T -1,.];

Where T is the is the number of observations of the four variables (110 in my case). My problem is that code works for a VAR with one lag and two variables. Could you help me please to set the code according to my data? Thanks a lot.



0



Are you saying that your matrix 'data' already contains the variables and lags that you want, or that you have no problem setting up the matrix correctly, but you need help modifying 'mbreak.src' to accomodate such data?

aptech

1,773

Your Answer

3 Answers

0
accepted

The procedure mainp is defined inside of the file mbreak.src. The line

#include mbreak.src;

can be thought of as copying-and-pasting the contents of the #included'ed file when the file is run. However, for the #include to find mbreak.src, mbreak.src must be in your GAUSS current working directory or in your GAUSS SRC_PATH. For this case, I would set your GAUSS working directory to the directory in which both the file you posted and mbreak.src reside.

0

Thank you for your answer. Yes, I realized that too. My new problem is with setting my variables after loading data. The model I am trying to estimate is a VAR model with five lags and four variables. I am using the following code to create the matrix of endogenous variables (y) and the matrix of exogenous variables (z):

y = data[2:T,.];
z = ones(T-1, 1)~data[1 : T -1,.];

Where T is the is the number of observations of the four variables (110 in my case). My problem is that code works for a VAR with one lag and two variables. Could you help me please to set the code according to my data? Thanks a lot.

0

Are you saying that your matrix 'data' already contains the variables and lags that you want, or that you have no problem setting up the matrix correctly, but you need help modifying 'mbreak.src' to accomodate such data?


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.