Dear all, I have panel data for a series (g) for three time periods. The variable is likely autocorrelated. I would like to generate a new variable using exponential/loess smoothing by group (gid).
For time series, I could have done something like this; smoothdf <- data.frame( x = 1:n, y = as.vector(smooth(dat$g)), method = "smooth()" ) But confused about the panel data setting. Apologies if this a stat question along with an R query. Any help will be greatly appreciated. ### data structure(list(gid = c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 5L, 5L, 5L, 6L, 6L, 6L, 7L, 7L, 7L, 8L, 8L, 8L, 9L, 9L, 9L), year = c(2030L, 2050L, 2100L, 2030L, 2050L, 2100L, 2030L, 2050L, 2100L, 2030L, 2050L, 2100L, 2030L, 2050L, 2100L, 2030L, 2050L, 2100L, 2030L, 2050L, 2100L, 2030L, 2050L, 2100L, 2030L, 2050L, 2100L), g = c(9.24e-05, 0.0001133, 6.3e-05, 7.72e-10, 1.41e-09, 4.68e-09, 0.0001736, 0.0002286, 0.0001541, 1.87e-15, 3.76e-15, 8.52e-15, 0.0001822, 0.0002391, 0.0001348, 3.69e-06, 8.11e-06, 8.63e-06, 3.41e-06, 7.32e-06, 7.18e-06, 8.47e-07, 1.83e-06, 1.84e-06, 1.13e-06, 2.37e-06, 2.15e-06)), class = "data.frame", row.names = c(NA, -27L)) Sincerely, Milu [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.