Displaying 1 result from an estimated 1 matches for "innertask".
2005 Aug 14
1
Panel data handling (lags, growth rates)
...Example:
# paneldata.lags(A, "person", "year", c("v1","v2"), lags=1:4)
paneldata.lags <- function(X, unitvar, timevar, lagvars, lags=1) {
stopifnot(length(lagvars)>=1)
X <- X[order(X[,timevar]),] # just in case it's not sorted.
innertask <- function(Y, lagvars, lags) {
E <- labels <- NULL
for (v in lagvars) {
for (i in lags) {
E <- cbind(E, Lag(Y[,v], i))
}
labels <- c(labels, paste(v, ".l", lags, sep=""))
}
colnames(E) <- labels
cbind(Y, E)
}...