pd_coint_wedgerton#

Purpose#

Computes the Westerlund-Edgerton test of the null hypothesis of cointegration allowing for the possibility structural breaks.

Format#

{ brks, lmn, nf } = pd_coint_wedgerton(y, x, model[, p, q, trimm, kmax])#
Parameters:
  • y (TxN matrix) – Dependent variable.

  • x (TxN matrix) – Independent variable.

  • model (Scalar) –

    Model to be implemented.

    0

    No shift.

    1

    Level shift.

    2

    Regime shift.

  • p (Scalar) – Optional, the number of autoregressive lags to include. Default = int(4 * (t/100)^(2/9)).

  • q (Scalar) – Optional, number of lags to include in the long-run variance estimation. Default = int(4 * (t/100)^(2/9)).

  • trimm (Scalar) – Optional, trimming rate. Default = 0.10.

  • kmax (Scalar) – Optional, the maximum number of factors to include. Default = 5.

Returns:
  • brks (Vector) – Break dates.

  • lmn (Vector) – Test statistics.

  • nf (Scalar) – The number of factors.

Examples#

library tspdlib;

// Load data
dat = loadd(__FILE_DIR $+ "pd_brics.gdat");

// This panel has 5 countries
N = 5;

/*
** Note that the data needs
** to be wide format so we
** need to reshape the data
*/
// Get x data
y = reshape(dat[., "lco2"], N, rows(dat)/N)';

// Separate y
x = reshape(dat[., "ly"], N, rows(dat)/N)';

// Get year
year = asDate(unique(dat[., "Year"]), "%Y");

// Deterministic component
// 0 = no shift,
// 1 = level shift,
// 2 = regime shift
model = 1;

// Estimate breaks and test for cointegration
{ brks, lmn, nf } = pd_coint_wedgerton(year~y, x, model);

Source#

pd_coint_wedgerton.src