<p>The ar.ols() function in R defaults to order <span class="math-container">$10log_{10} (N)$</span>.  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.</p>

<p>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.</p>

CC BY-SA 4.0
2019-10-22T15:42:37.103Z
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.
R-User
CC BY-SA 4.0
2019-10-24T15:41:06.160Z
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.
heh
CC BY-SA 4.0
2019-10-24T15:45:18.043Z
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}]$.
heh
CC BY-SA 4.0
2019-10-24T16:35:51.287Z
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!
heh
CC BY-SA 4.0
2019-10-29T10:15:31.000Z
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?
R-User
CC BY-SA 4.0
2019-10-31T16:19:00.117Z
That's a possible workaround, but if I understand your idea correctly, you do it at the cost of reducing your data set by a factor of 30.  Since your data is annual, this could be a significant tradeoff.  I still think the best approach is to hard-code the lag you're interested in and run OLS.  This is basically what your original question was asking how to "trick" the autoregression function into doing for you.

We can take this to chat if you want to carry it further.
heh
CC BY-SA 4.0
2019-10-31T16:29:45.793Z
Thank you. I would really appreciate if we could take this to chat.
R-User
CC BY-SA 4.0
2019-10-22T14:31:03.310Z
2019-10-22T14:31:03.310Z
heh
<p>I run a simple AR(1) model in my analysis using ols:</p>



<pre><code>ar.ols(df$y, order.max = 1))
</code></pre>

<p>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?</p>

CC BY-SA 4.0
2019-10-21T14:35:34.323Z
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?
heh
CC BY-SA 4.0
2019-10-22T08:45:12.867Z
@heh: Yes, this is correct.
R-User
<econometrics><r><autoregressive>
How to change the observation for the first lag in an AR(1) model?
R-User
# How to change the observation for the first lag in an AR(1) model?

(Asked by: username_0 on 2019-10-21)

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?

**Tags:** econometrics, r, autoregressive
> **Comments:**
> **username_1**: 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?  
> **username_0**: @heh: Yes, this is correct.  

---

## 1 answers

### Answer by username_1 on 2019-10-22. Score: 0 | Accepted answer

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.

> **Comments:**
> **username_0**: 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.  
> **username_1**: 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.  
> **username_1**: 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}]$.  
> **username_1**: 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!  
> **username_0**: 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?  
> **username_1**: That's a possible workaround, but if I understand your idea correctly, you do it at the cost of reducing your data set by a factor of 30.  Since your data is annual, this could be a significant tradeoff.  I still think the best approach is to hard-code the lag you're interested in and run OLS.  This is basically what your original question was asking how to "trick" the autoregression function into doing for you.  We can take this to chat if you want to carry it further.  
> **username_0**: Thank you. I would really appreciate if we could take this to chat.  

---

