### Introduction

The validity of many time series models and panel data models requires that the underlying data is stationary. As such, reliable unit root testing is an important step of any time series analysis or panel data analysis.

However, standard time series unit root tests and panel data unit root tests aren’t reliable when structural breaks are present. Because of this, when structural breaks are suspected, we must employ unit root tests that properly incorporate these breaks.

Today we will examine one of those tests, the Carrion-i-Silvestre, et al. (2005) panel data test for stationarity in the presence of multiple structural breaks.

## Why Panel Data Unit Root Testing?

We may be tempted when working with panel data to treat the data as individual time-series, performing unit root testing on each one separately. However, one of the fundamental ideas of panel data is that there is a shared underlying component that connects the group.

It is this shared component, that suggests that there are advantages to be gained from testing the panel data collectively:

- Panel data contains more combined information and variation than pure time-series data or cross-sectional data.
- Collectively testing for unit roots in panels provides more power than testing individual series.
- Panel data unit root tests are more likely than time series unit root tests to have standard asymptotic distributions.

Put simply, when dealing with panel data, using tests designed specifically for panel data and testing the panel collectively, can lead to more reliable results.

## Why do we Need to Worry About Structural Breaks?

It is important to properly address structural breaks when conducting unit root testing because most **standard unit root tests will bias towards non-rejection** of the unit root test. We discuss this in greater detail in our “Unit Root Tests with Structural Breaks” blog.

## Panel Data Stationarity Test with Structural Breaks

The Carrion-i-Silvestre, *et al.* (2005) panel data stationarity test introduces a number of important testing features:

- Tests the null hypothesis of stationarity against the alternative of non-stationarity.
- Allows for multiple, unknown structural breaks.
- Accommodates shifts in the mean and/or trend of the individual time series.
- Does not require the same breaks across the entire panel but, rather, allows for each individual to have a different number of breaks at different dates.
- Allows for homogeneous or heterogeneous long-run variances across individuals.

## Conducting Panel Data Stationarity Tests in GAUSS

### Where can I Find the Tests?

The panel data stationarity test with structural breaks is implemented by the `pd_kpss`

procedure in the GAUSS tspdlib library.

The library can be directly installed using the GAUSS Package Manager.

### What Format Should my Data be in?

The `pd_kpss`

procedure takes panel data in wide format - this means that each column of your data matrix should contain the time series observations for a different individual in the panel.

For example, if we have 100 observations of real GDP for 3 countries, our test data will be 100 x 3 matrix.

Observation # | Country A | Country B | Country C |
---|---|---|---|

1 | 1.11 | 1.40 | 1.39 |

2 | 1.14 | 1.37 | 1.34 |

3 | 1.27 | 1.45 | 1.28 |

4 | 1.19 | 1.51 | 1.35 |

$\vdots$ | $\vdots$ | $\vdots$ | $\vdots$ |

99 | 1.53 | 1.75 | 1.65 |

100 | 1.68 | 1.78 | 1.67 |

### How do I Call the Test Procedure?

The first step to implementing the panel date stationarity test with structural breaks in GAUSS is to load the `tspdlib`

library.

`library tspdlib;`

This statement provides access to all the procedures in the `tspdlib`

libraries. After loading the libraries, the `pd_kpss`

procedure can be called directly from the command line or within a program file.

The `pd_kpss`

procedure takes 2 required inputs and 5 optional arguments:

```
{ testd_hom, testd_het, m_lee_est, brks } = pd_kpss(y, model,
nbreaks,
bwl,
varm,
pmax,
b_ctl);
```

- y
- $T \times N$ Wide form panel data to be tested.
- model
- Scalar, model to be used when there are structural breaks found:
1 Constant (Hadri test) 2 Constant + trend (Hadri test) 3 Constant + shift (in mean) 4 Constant + trend + shift (in mean and trend) - nbreaks
- Scalar, Optional input, number of breaks to consider (up to 5). Default = 5.
- bwl
- Scalar, Optional input, bandwidth for the spectral window. Default = round(4 * (T/100)^(2/9)).
- varm
- Scalar, Optional input, kernel used for long-run variance computation. Default = 1:
1 iid 2 Bartlett. 3 Quadratoc spectral (QS). 4 Sul, Phillips, and Choi (2003) with the Bartlett kernel. 5 Sul, Phillips, and Choi (2003) with quadratic spectral kernel. 6 Kurozumi with the Bartlett kernel. 7 Kurozumi with quadratic spectral kernel. - pmax
- Scalar, Optional input, denotes the number of maximum lags that is used in the estimation of the AR(p) model for lrvar. The final number of lags is chosen using the BIC criterion. Default = 8.
- b_ctl
- Optional input, An instance of the
`breakControl`

structure controlling the setting for the Bai and Perron structural break estimation.

The `pd_kpss`

procedure provides 4 returns :

- test_hom
- Scalar, stationarity test statistic with structural breaks and homogeneous variance.
- test_het
- Scalar, stationarity test statistic with structural breaks and heterogeneous variance.
- kpss_test
- Matrix, individual tests. This matrix contains the test statistics in the first column, the number of breaks in the second column, the BIC chosen optimal lags, and the LWZ chosen optimal lags.
- brks
- Matrix of estimated breaks. Breaks for each individual group are contained in separate rows.

## Empirical Example

Let’s look further into testing for panel data stationarity with structural breaks using an empirical example.

### Data Description

The dataset contains government deficit as a percentage of GDP for nine OECD countries. The time span ranges from 1995 to 2019. This gives us a balanced panel of 9 individuals and 25 time observations each.

### Loading our data into GAUSS

Our first step is to load the data from `govt-deficit-oecd.csv`

using `loadd`

. This `.csv`

file contains three variables, `Country`

, `Year`

, and `Gov_deficit`

.

We will load all three variables into a GAUSS dataframe. Note that `loadd`

automatically detects that `Country`

is a categorical variable, and assigns the `category`

type. However, we will need to convert `Year`

to a date variable:

```
// Load all variables and convert country to numeric categories
data = loadd("govt-deficit-oecd.csv");
// Convert "Year" to a date variable
data = asDate(data, "%Y", "Year");
```

This loads our data in long format (a 225x1 dataframe). Our next step, is to convert this to wide-format using the `dfWider`

procedure.

```
// Specify names_from column
names_from = "Country";
// Specify values_from column
values_from =
// Convert from long to wide format
wide_data = df(data);
```

```
// Delete first column which contains the year variable
govt_def = delcols(wide_data, 1);
```

### Setting up our Model Parameters

With our loading and transformations complete, we are ready to set-up our testing parameters. For this test, we will allow for both a constant and trend. All other parameters will be kept at their default values.

```
// Specify which model to
// Allow for both constant and trend.
model = 2;
```

### Calling the `pd_kpss`

Procedure

Finally, we call the `pd_kpss`

procedure:

`{ test_hom, test_het, kpss_test, brks } = pd_kpss(wide_data, model);`

## Empirical Results

The `pd_kpss`

output includes:

- A header describing the testing settings.
- The
`test_hom`

and`test_het`

test statistics along with associated p-values. - The critical values for both test statistics.
- The testing conclusions based on a comparison of the test statistics to the associated critical values.

Test: PD KPSS Ho: Stationarity Number of breaks: None LR variance: iid Model: Break in level & trend ============================================================== PD KPSS P-val Homogenous 14.352 0.000 Heterogenous 10.425 0.000 Critical Values: 1% 5% 10% Homogenous 2.326 1.645 1.282 Heterogenous 2.326 1.645 1.282 ============================================================== Homogenous var: Reject the null hypothesis of stationarity at the 1% level. Heterogenous var: Reject the null hypothesis of stationarity at the 1% level.

These results tell us that we can reject the null hypothesis of stationarity at the 1% level for both cases, homogenous and heterogenous variance.

The test results also include a table of individual test results and conclusions:

============================================================== Individual panel results ============================================================== KPSS Num. Breaks AUT 0.165 2.000 DEU 0.079 0.000 ESP 0.249 4.000 FRA 0.210 2.000 GBR 0.298 2.000 IRL 0.235 2.000 ITA 0.130 3.000 LUX 0.127 3.000 NOR 0.414 1.000 Critical Values: 1% 5% 10% AUT 0.059 0.048 0.043 DEU 0.207 0.150 0.122 ESP 0.035 0.031 0.028 FRA 0.056 0.045 0.040 GBR 0.058 0.046 0.041 IRL 0.074 0.059 0.051 ITA 0.055 0.045 0.041 LUX 0.058 0.045 0.039 NOR 0.083 0.066 0.058 ============================================================== AUT Reject Ho ( 1% level) DEU Cannot reject Ho ESP Reject Ho ( 1% level) FRA Reject Ho ( 1% level) GBR Reject Ho ( 1% level) IRL Reject Ho ( 1% level) ITA Reject Ho ( 1% level) LUX Reject Ho ( 1% level) NOR Reject Ho ( 1% level) ==============================================================

Finally, the `pd_kpss`

procedure prints the estimated breakpoints for each individual in the panel.

Group Break 1 Break 2 Break 3 Break 4 Break 5

AUT 2003 2008 . . .

DEU . . . . .

ESP 1999 2006 2009 2012 .

FRA 2001 2008 . . .

GBR 2000 2008 . . .

IRL 2007 2010 . . .

ITA 1997 2006 2009 . .

LUX 1999 2004 2008 . .

NOR 2008 . . . .

`pd_kpss`

see our data viewing tutorial.## Interpreting the Results

When interpreting the results from `pd_kpss`

test, it helps to remember a few key things:

- The test considers the null hypothesis of stationarity against the alternative of non-stationarity.
- We reject the null hypothesis of stationarity at
- Large values of the test statistic.
- Small p-values.

Notice that the TSPDLIB library conveniently provides interpretations for the `pd_kpss`

tests.

### Panel Data Test Statistic

The test statistic for our panel, assuming homogeneous variances:

- Is equal to 14.352 with a p-value of 0.0000.
- Suggests that we reject the null hypothesis of stationarity at the 1% level.

The test statistic for our panel, assuming heterogeneous variances:

- Is equal to 10.425 with a p-value of 0.000.
- Suggests that we reject the null hypothesis of stationarity at the 1% level.

These results tell us that regardless of whether we assume heterogeneous or homogenous variances, we can reject the null hypothesis of stationarity for the panel. Given this, we must make proper adjustments to account for non-stationarity when modeling our data.

### Individual Test Results

Country | Statistic | Breaks | Conclusion |
---|---|---|---|

Austria | 0.165 | 2003;2008 | Reject null at 1%. |

France | 0.210 | 2001;2008 | Reject null at 1%. |

Germany | 0.079 | None | Cannot reject null. |

Ireland | 0.235 | 2007;2010 | Reject null at 1%. |

Italy | 0.130 | 1997;2006;2009 | Reject null at 1%. |

Luxemberg | 0.127 | 1999;2004;2008 | Reject null at 1%. |

Norway | 0.414 | 2008 | Reject null at 1%. |

Spain | 0.249 | 1999;2006;2009;2012 | Reject null at 1%. |

United Kingdom | 0.298 | 2000;2008 | Reject null at 1%. |

## Conclusion

Todays's blog considers the panel data stationarity test proposed by Carrion-i-Silvestre, et al. (2005). This test is built upon two crucial aspects of unit root testing:

- Panel data specific tests should be used with panel data.
- Structural breaks should be accounted for.

Ignoring these two facts can result in unreliable results.

After today, you should have a stronger understanding of how to implement the panel data stationarity test with structural breaks in GAUSS and how to interpret the results.

### Further Reading

- Panel data, structural breaks and unit root testing
- Panel Data Basics: One-way Individual Effects
- How to Aggregate Panel Data in GAUSS
- Introduction to the Fundamentals of Panel Data
- Transforming Panel Data to Long Form in GAUSS
- Getting Started With Panel Data in GAUSS

Eric has been working to build, distribute, and strengthen the GAUSS universe since 2012. He is an economist skilled in data analysis and software development. He has earned a B.A. and MSc in economics and engineering and has over 18 years of combined industry and academic experience in data analysis and research.

jamelsVery nice and clear blog. A blog with the "Cointegration in panel data with structural breaks and cross-section dependence" would be great!

Best,

JS