I have a data set with three variables: year (21 consecutive years) and two time series which are count data (count1 and count2). I want to know whether count2 correlates with some time delay lag with count1.
Both time series follow a positive (and similar in size) linear trend as resulting by running a linear model for each time series (in R, function lm
). According to the Augmented Dickey-Fuller Test (in R function adf.test
from tseries
) Count1 neither count1 and count2 are stationary but they become stationary after differencing once. According to partial autocorrelation functions of the counts after differencing (in R function pacf
) count1 shows significant autocorrelation of order 1 (lag=1) and count2 shows no significant autocorrelation.
Questions:
Should I use a cross-correlation test (in R function ccf
) on the variables obtained after differencing each time series (say, diff.count1 vs. diff.count2)?
Or should I use a distributed lag model on the time series after differencing (in R dlm
from dLagM
)? I have tried but I have problems to select the model with the right time lag because as I increase the value of q (no. of time lags) the AIC improve always (decreases), even when the model is not able to estimate any slope. I know of a third possibility that is the autoregressive distributed lag model (in R ardl
from dLagM
) on the raw data but I have the same issue with the AIC.
My data look like this (in R):
data <- data.frame(year=1:21,count1=c(7, 40, 86, 4, 73, 199, 400, 673, 1125, 0, 832, 3643, 2236, 2172, 5267, 7228, 0, 6909, 939, 7851, 1231), count2= c(5, 6, 0, 0, 1, 1, 15, 1, 0, 1, 2, 29, 5, 38, 22, 46, 132, 161, 103, 32, 70))