Reputation: 27
I am using prodest package in R. And everything worked fine until one moment.
Here are 2 datasets
The function works for this: https://docs.google.com/spreadsheets/d/1Ecj9Otj6pb7nu5BSe0alk6Q0FpryK0xnMVWz5S2wa2Q/edit?usp=sharing
Here doesn't: https://docs.google.com/spreadsheets/d/1ECxkygPH6SmKmJpRrFIQ4xNekKHtKjnmnFA3_WwjjpY/edit?usp=sharing
The code is the following:
SK_AB <- read.csv("adata.csv", header = TRUE, sep = ",")
AB <- prodest::prodestACF(SK_AB$turn, fX = SK_AB$l, sX = SK_AB$tfa, pX = SK_AB$m, idvar = SK_AB$ID, timevar = SK_AB$Year,
R = 20, cX = NULL, opt = "DEoptim", theta0 = NULL, cluster = NULL)
Source code for the function: https://github.com/GabrieleRovigatti/prodest/blob/master/prodest/R/prodestACF.R
In the function description, the part of the code that gives the error is:
sX <- checkM(sX)
idvar <- checkM(idvar)
timevar <- checkM(timevar)
snum <- ncol(sX) # find the number of input variables
lag.sX = sX # generate sX lags
for (i in 1:snum) {
lag.sX[, i] = lagPanel(sX[, i], idvar = idvar, timevar = timevar)
}
I do not know why the exact same structure of one file works, and the same structure for the same function not.
UPD: links are now for the needed files
Upvotes: 0
Views: 293
Reputation: 11
I had the same error message. It turned out my problem was that my panel data was problemetic, in the sense that within each individual panel there were repeated time values. For example, for id = Tom, in year 2007 there were two observations. This repeated time within panel will create problem in the lagpanel function as it involves a leftjoin using time and lagged_time.
Upvotes: 1