Solved – way to get a panel unit root test result when the data contain some missing values

hypothesis testingmissing datapanel dataplmunit root

Let me explain my question with the following example:

data("Grunfeld", package = "plm")
y <- data.frame(split(Grunfeld$inv, Grunfeld$firm))
purtest(y, pmax = 4, exo = "intercept", test = "madwu")

gives a result. But if we include a missing value in it, e.g., Grunfeld$inv[2] <- NA,
then the above steps for unit root test gives the error, in lm.fit(X, y) : NA/NaN/Inf in 'x'

What can we do regarding a panel unit root test when we have missing values in our data?

Best Answer

I have solved the problem the following way. Please correct me if something is wrong.

First the panel data without missing values gives unit root results. For example,

> library(plm)
> data("Grunfeld", package = "plm")
> y <- data.frame(split(Grunfeld$inv, Grunfeld$firm))
> purtest(y, pmax = 4, exo = "intercept", test = "madwu")

        Maddala-Wu Unit-Root Test (ex. var. : Individual Intercepts )

data:  y
chisq = 47.5818, df = 20, p-value = 0.0004868
alternative hypothesis: stationarity

Now, impose a missing value to the 2nd observation, that corresponds to the year 1936.

> data("Grunfeld", package = "plm")
> Grunfeld$inv[2] <- NA
> y <- data.frame(split(Grunfeld$inv, Grunfeld$firm))
> purtest(y, pmax = 4, exo = "intercept", test = "madwu")
Error in lm.fit(X, y) : NA/NaN/Inf in 'x'

Oops! we get now error result. However the Hadri test is still working.

> data("Grunfeld", package = "plm")
> Grunfeld$inv[2] <- NA
> y <- data.frame(split(Grunfeld$inv, Grunfeld$firm))
> purtest(y, pmax = 4, exo = "intercept", test = "hadri")

        Hadri Test (ex. var. : Individual Intercepts )

data:  y
z = 23.884, p-value < 2.2e-16
alternative hypothesis: at least one series has a unit root

To get results for the "madala" test omit all observations that belong to the year 1936.

> data("Grunfeld", package = "plm")
> Grunfeld$inv[2] <- NA
> Grunfeld <- subset(Grunfeld, year !=1936)
> y <- data.frame(split(Grunfeld$inv, Grunfeld$firm))
> purtest(y, pmax = 4, exo = "intercept", test = "madwu")

        Maddala-Wu Unit-Root Test (ex. var. : Individual Intercepts )

data:  y
chisq = 39.3042, df = 20, p-value = 0.00611
alternative hypothesis: stationarity

This time we get a result.

Related Question