If $y_t$ and $y_{t-1}$ are actually 30 observations apart, for AR(1) you can do the following:
lm( tail(df$y,-30) ~ head(df$y,-30) )
This assumes the first observation is the oldest. If your variable has the first observation being the newest, switch head with tail. This would also imply overlapping observations.
For AR(2) you would do
lm( tail(df$y,-60) ~ tail(head(df$y,-30),-30) + head(df$y,-60) )
If you wish to trade off the added estimation efficiency due to overlapping observations for computational efficiency, you may use every 30th data point as follows:
n=length(df$y)
m=floor(n/30)
index=seq(from=n,to=(n-m*30),by=-30)
g=df$y[index] # g contains every 30th observation of y dropping the oldest few
ar.ols(g, order.max = 1)) # for AR(1)
ar.ols(g, order.max = 2)) # for AR(2)
tail(df$y,-30)drops the first 30, whilehead(df$y,-30)drops the last 30 observations. I still do not understand the structure of your data: do your have yearly observations but are interested in generations (30 years)? Would looking at every 30th data point be what you are interested in? If so, my proposed code also works and will be slightly more efficient as it utilizes overlapping observations rather than just deleting 29 out of every 30 observations. But you could do that, too. – Richard Hardy Oct 21 '19 at 12:53