Hey arun, I am thankful for your help and assistance! With the example it works!
Have a nice day, Katie -----Ursprüngliche Nachricht----- Von: arun [mailto:smartpink...@yahoo.com] Gesendet: Freitag, 25. April 2014 18:01 An: r-help@r-project.org Cc: Katharina Mersmann Betreff: Re: [R] purtest and missing values (plm-package) Hi, May be this helps: library(plm) data(Grunfeld) Grunfeld$inv[c(2,8)] <- NA GrunfeldNew <- subset(Grunfeld, !year %in% year[is.na(inv)]) x <- data.frame(split(GrunfeldNew$inv, GrunfeldNew$firm)) purtest(x, pmax = 4, exo = "none", test = "levinlin",lags="SIC") # Levin-Lin-Chu Unit-Root Test (ex. var. : None ) # #data: x #z.x1 = 5.0507, p-value = 4.402e-07 #alternative hypothesis: stationarity # #Warning message: #In selectT(l, theTs) : the time serie is short A.K. On Friday, April 25, 2014 10:48 AM, Katharina Mersmann <kmers...@smail.uni-koeln.de> wrote: Because, my inbox shows a "cutted-email-version", once again: 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 -----Ursprüngliche Nachricht----- Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im Auftrag von Katharina Mersmann Gesendet: Freitag, 25. April 2014 15:53 An: r-help@r-project.org Betreff: [R] purtest and missing values (plm-package) 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 b ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.