# Unit 12 AR(2) models

$X_t = \beta + \phi_1 X_{t-1} +\phi_2 X_{t-2} +a_t$ where $$\beta = \left( 1 - \phi_1 - \phi_2 \right) \mu$$ is the moving average constant.

## 12.2 Stationarity in AR(2)

$E[X_t] = \mu$

$\sigma_X^2 = \frac {\sigma^2_a}{1-\phi_1 \rho_1 - \phi_2 \rho_2 }$

Instead of depending on positive or negative roots, like AR(1), the behavior of the autocorrelations and spectral density depends on whether or not the roots of the characteristic equation are complex. This means it is already hard to tell from the equation whether or not it is stationary just by looking at the equation.

## 12.3 AR(2) zero mean form

If $$\mu = 0$$, then the AR(2) model takes the form :

$X_t = \phi_1 X_{t-1} +\phi_2 X_{t-2} +a_t$

We can study this much easier and then add the mean back later. A more common way of writing this, and more useful to us is the form: $X_t- \phi_1 X_{t-1} -\phi_2 X_{t-2}= a_t$

## 12.4 More on backshift operator notation

Remember, we defined the backshift operator as $$B$$ such that $$BX_t = X_{t-1}$$

We can extend this and say: $B^k X_t = X_{t-k}$

This means we can rewrite:

$X_t- \phi_1 BX_t -\phi_2 B^2 X_t= a_t$

$X_t\left[ 1 - \phi_1 B - \phi_2 B^2 \right] = a_t$

or, more tersely:

$\phi(B)X_t = a_t$

Where $$\phi (B) = 1 - \phi_1 B - \phi_2 B^2$$

We can rewrite this $$\phi(B)$$ as a characteristic equation now: $1 - \phi_1 Z - \phi_2 Z^2 = 0$

Lets quickly expand on our quadratic solver to get the roots of an AR(2) model:

ar2solver <- function(p1, p2) {
res <- as.complex(quad_form(p2, p1, 1))
mag <- Mod(res)
absrecip <- 1/mag
data.frame(roots = res, magnitude = mag, abs.recip = absrecip)
}
ar2solver(0.4, 0.8)
##         roots magnitude abs.recip
## 1 -0.25-1.09i  1.118302 0.8942126
## 2 -0.25+1.09i  1.118302 0.8942126

## 12.5 Characteristic equation

$x = \frac{ - b \pm \sqrt {b^2 - 4ac} }{2a}$ $1- \phi_1 Z - \phi_2 Z^2 = 0$

Just solve the quadratic equation using the quadratic formula:

$x = \frac{ - b \pm \sqrt {b^2 - 4ac} }{2a}$

Two cases: * Two real roots * Two complex roots

## 12.6 Key result

An AR(2) is stationary iff all roots are outside the unit circle

### 12.6.1 Two real roots

We can factor the AR(2) into two AR(1)s

• one part positive one part negative
• Wandering but oscillating
• Damping ACF but slightly oscillatory
• S(f) has a peak at 0 and at 0.5
• Two Positive roots
• Super wandering
• Super Damped
• S(f) peak at 0
• Two Negative
• super oscillating

### 12.6.2 Complex conjugate roots

Stationary AR(2)’s with complex conjugate roots have an autocorrelation function which looks more like a damped sinusoid instead of a damped exponential, and a system frequency, $$f_0$$ defined as+ $f_0 = \frac{1}{2\pi}\mathrm{cos}^{-1} \left( \frac{\phi_1}{2 \sqrt{-\phi_2}} \right )$. Pretty easy stuff.
{"ft_lang_label":"__label__en","ft_lang_prob":0.75180143,"math_prob":0.9998692,"size":2889,"snap":"2021-21-2021-25","text_gpt3_token_len":1027,"char_repetition_ratio":0.11611785,"word_repetition_ratio":0.06048387,"special_character_ratio":0.38040844,"punctuation_ratio":0.09466437,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9999527,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-06-16T14:34:01Z\",\"WARC-Record-ID\":\"<urn:uuid:a64d592d-4d02-4ae5-9a77-105c1ca843af>\",\"Content-Length\":\"41091\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:add39132-12aa-4ddb-befd-4ddf69aa68d8>\",\"WARC-Concurrent-To\":\"<urn:uuid:7a1dcc00-a4b5-46e5-90ed-2f46d23eb85e>\",\"WARC-IP-Address\":\"34.236.45.28\",\"WARC-Target-URI\":\"https://bookdown.org/josephs_david11/tsReview/ar2-models.html\",\"WARC-Payload-Digest\":\"sha1:6DT2VLJYPWCEZEJRWER4WYLPHK2SNMBG\",\"WARC-Block-Digest\":\"sha1:UNNGRJ5TFANDTSDZZUOHJRRWZDLHIMTE\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-25/CC-MAIN-2021-25_segments_1623487623942.48_warc_CC-MAIN-20210616124819-20210616154819-00223.warc.gz\"}"}