# Large N Large T Unbalanced Panel - Serial Correlation

I have an unbalanced panel data, which consists of 180 vintage groups. The ith group will have time series length of t=181-i. For example, Group 1 will have 180-month observations; Group 2, originated 1 month after Group 1, will have 179-month observation, etc. I believe given T and N can be as large as 180, it should be regarded as "large N large T" problem.

I try to fit a nonlinear longitudinal model to this group, by using mixed effects. The model gives me a decent overall fit, but from the group level I can definitely see residuals showing the serial correlation. Although in this model I care more about the overall fit instead of fitting perfectly in each group. I think it would be different to test error autocorrelation for a single time series (ACF) and a unbalanced panel. My questions are:

1. Should I care about residual serial correlation and the corresponding incorrect standard errors? After all I don't have time series components in my model (such as ARMA), so whether it's correct to examine errors like this?
2. If Yes to Question 1, is there a way to effective test panel serial correlation, in the case of large N and large T and nonlinear mixed-effect model? If the implementation is in R I would really appreciate it.

sample code:

# Generate Data:
library(data.table)
library(lattice)

dat <- data.table(group = 1:180)
dat <- dat[, list(t = 1:(181 - group)), by = group]
parameters <- abs(rnorm(1))
dat[, y := 1 / (t + parameters) + cumsum(rnorm(180, mean = 0, sd = 0.01)), by = group]

# First 10 Groups Visualization
xyplot(data = dat[group < 10], y ~ t |
as.character(group), type = "l")

# Nonlinear Mixed-effects
library(nlme)

nonlinearFun <- function(m, n, t) {
return(1 / (t + m) + n)
}

test <- nlme(
data = dat,
y ~ nonlinearFun(m, n, t),
fixed =  list(m ~ 1),
random = n ~ 1 | group,
start = c(m = parameters)
)

# Get prediction
dat\$pred_y <- predict(test)

xyplot(
data = dat[group < 10],
y + pred_y ~ t | as.character(group),
type = c("l", "g"),
lty = c(1, 2),
auto.key = T
)

xyplot(
data = dat[group < 10],
I(y - pred_y) ~ t | as.character(group),
type = c("p", "g"),
lty = c(1, 2),
main = "Prediction Error Over Time",
ylab = "Error"
)

# ACF Test
acf(with(dat[group == 1], y - pred_y), main = "Group 1 error ACF")
acf(with(dat[group == 10], y - pred_y), main = "Group 10 error ACF")