I run a simple AR(1) model in my analysis using ols:

ar.ols(df$y, order.max = 1))

However, I work with generations as my unit of analysis. Therefore, the first lag of y would be the observation of y at time t-30. How can I specify this in the AR(1) model in R?

  • $\begingroup$ This is a bit confusing. From this I am guessing that your data is annual, but that you want to capture the effect of the previous generation's features (e.g., your X at t = -30) on the current generation (your y at t = 0). Is that correct? $\endgroup$ – heh Oct 21 '19 at 14:35
  • $\begingroup$ @heh: Yes, this is correct. $\endgroup$ – R-User Oct 22 '19 at 8:45

The ar.ols() function in R defaults to order $10log_{10} (N)$. This implies that, to catch the 30th time lag, you need at least 1000 observations. That seems like a lot, but bear in mind that you are then running OLS on 30 features (lags t-1 to t-30). All else equal, it is not clear why 30 is the magic number for you here, and you can't just drop the more recent lags as they may have the dominant effect.

Without knowing more about your study, it's hard to recommend further. Intuitively, though, I would not expect to be using annualized data to perform generational analysis unless I were running OLS (not AR) and explicitly constructing a lagged column vector to use as an additional feature alongside contemporaneous features/controls.

  • $\begingroup$ My datastructure is as follows: I do have yearly data consisting of moving averages over 30 years (e.g. the y of 1915 contains the average y for the generation 1900-1930, etc.). Now the aim is e.g. to regress the y of 1915 on the one of 1885 (as the second one is the average for the generation 1870-1900) in order to find the correlation between the two generations. $\endgroup$ – R-User Oct 22 '19 at 15:42
  • $\begingroup$ A couple of things: First, that doesn't materially alter the technical issue - you still have 29 other moving averages in between 1915 and 1885 that could potentially influence the 1915 data in more significant ways than the 1885 data does. Second, I would argue that moving averages hamper your ability to argue causality -- consider that 93% of the 1885 "generation" is comprised of members of the 1886 generation; 86% of it is comprised of members of the 1887 generation; and so-on. $\endgroup$ – heh Oct 24 '19 at 15:41
  • $\begingroup$ If you're comfortable with your data points being constructed from highly overlapping sets of underlying data (I would not be), then your simplest recourse may be to use OLS and to code a 30-year-lagged set of column vectors to pick up the previous "generation". In matrix form, your model would look like $Y = \beta * [X_{current} | X_{lagged}]$. $\endgroup$ – heh Oct 24 '19 at 15:45
  • $\begingroup$ Also, it just occurred to me that if you're using moving averages as data for use in an autoregression, that is a disastrous error, as by definition, a moving average creates a time dependency in the data even if there isn't one fundamentally. If you're not doing this, then great! $\endgroup$ – heh Oct 24 '19 at 16:35
  • $\begingroup$ I see the disadvantage of using moving averages in this analysis. However, I need the moving averages for another part of the analysis. I will use sharp generation calculations for this AR(1) calculation. In my opinion, there should be no problem if I reduce the dataset in a way that I only have the data point 1915 (as the average of the generation 1900-1930) and the data point 1945 (as the average for the generation 1930-1960) and so on. Is that correct? Can I then calculate an AR(1) process for group means (or generation means) with this reduced dataset as usual? $\endgroup$ – R-User Oct 29 '19 at 10:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.