Hello R-Community,
I have quarterly panel-data and not surprisingly missing values, in a few variables, which are differently distributed around the panel.
Now I want to run different unit-root tests.
For ADF on the pooled data set, I chose CADF-package, which can determine the number of lags automa. by SIC and handles missing values. (I hope this is the right one )
Secondly I want to run an LLC and IPS test specificially for the panel data (Levin, Lin & Chu –test and Im, Pesaran & Shin-test ) for which I use the purtest function, from plm-package.
But I don´t know how to apply it, if my series contains missing values ( so only a error-message is created)
> purtest(data.plm,data=data.plm, test = "levinlin",exo = "none",lags ="SIC")
Fehler in lm.fit(X, y) : NA/NaN/Inf in 'x'
Zusätzlich: Warnmeldung:
In Ops.factor(object[2:length(object)], object[1:(length(object) - :
- not meaningful for factors
So my Question is:
1. Is there a way to handle the missing values?
2. Do I just omit them? And if, is there a way to integrate this by adding an ” na.omit” into the function ?
To make it easier explaining the way of proceeding, a reproducible example could be:
data("Grunfeld", package = "plm")
y <- data.frame(split(Grunfeld$inv, Grunfeld$firm))
purtest(y, pmax = 4, exo = "none", test = "levinlin",lags=”SIC”) # works no missing data
# add an NA
data("Grunfeld", package = "plm")
x <−data.frame(split(Grunfeldinv, Grunfeld$firm))
Grunfeldinv[2]<−NA
purtest(x, pmax = 4, exo = "none", test = "levinlin",lags=”SIC”) # Error in lm.fit(X, x) : NA/NaN/Inf in 'x'
Thanks for your hints and suggestions!
Katie
[[alternative HTML version deleted]]