Calculate Roots of Characteristic Polynomial AR(2) using Polyroot R


Calculate Roots of Characteristic Polynomial AR(2)

Using Polyroot Function in R

AR(2) Characteristic Polynomial Root Calculator

An Autoregressive model of order 2 (AR(2)) has a characteristic polynomial of the form: $1 – \phi_1 L – \phi_2 L^2 = 0$, where L is the lag operator. To determine stationarity, we need to find the roots of this polynomial. This calculator helps you find those roots using the coefficients $\phi_1$ and $\phi_2$. In R, the `polyroot` function is used to find the roots of a polynomial defined by its coefficients. For the AR(2) characteristic polynomial $1 – \phi_1 B – \phi_2 B^2$, we often consider the roots of the associated equation $\lambda^2 – \phi_1 \lambda – \phi_2 = 0$ or the roots of $1 – \phi_1 z^{-1} – \phi_2 z^{-2} = 0$. The latter is more directly related to the roots of the polynomial $1 – \phi_1 y – \phi_2 y^2$, which is what `polyroot` typically solves given coefficients in order of descending power of the variable. Therefore, we input the coefficients of $1 – \phi_1 y – \phi_2 y^2$ as `c(1, -phi1, -phi2)`. The roots are typically complex numbers. For stationarity in an AR(2) model, the roots of the characteristic polynomial must lie outside the unit circle, which is equivalent to saying the roots of $1 – \phi_1 z^{-1} – \phi_2 z^{-2} = 0$ must lie inside the unit circle. This means that if $r_1, r_2$ are the roots, then $|r_1| < 1$ and $|r_2| < 1$.



Enter the coefficient for the first lag term (φ₁).



Enter the coefficient for the second lag term (φ₂).



Calculation Results

Roots will appear here.
Polynomial Coefficients (for polyroot): N/A
Roots (z⁻¹): N/A
Magnitude of Roots: N/A
Stationarity Check (All |root| < 1): N/A

Formula Used: The calculator finds the roots of the polynomial $1 – \phi_1 y – \phi_2 y^2 = 0$, where y is the variable. The coefficients are passed to `polyroot` as `c(1, -phi1, -phi2)`. For stationarity of the AR(2) process, all roots must lie inside the unit circle (i.e., their magnitudes must be less than 1).

Root Locations Relative to Unit Circle

Root Details Table

Details of Characteristic Polynomial Roots
Root Index Root Value (z⁻¹) Magnitude (|root|) Inside Unit Circle?
Enter coefficients and calculate to see table.

What is the Characteristic Polynomial of an AR(2) Model?

The characteristic polynomial of an AR(2) model is a fundamental concept in time series analysis, crucial for understanding the behavior and stability of the model. An Autoregressive model of order 2, denoted as AR(2), describes a time series where the current value is a linear combination of the two preceding values plus a random error term. Mathematically, it’s represented as: $Y_t = c + \phi_1 Y_{t-1} + \phi_2 Y_{t-2} + \epsilon_t$, where $Y_t$ is the value at time $t$, $\phi_1$ and $\phi_2$ are the autoregressive coefficients, and $\epsilon_t$ is the white noise error term at time $t$. To analyze the properties of this model, especially its stationarity, we use the characteristic polynomial. This polynomial is derived by rewriting the AR(2) equation using the lag operator $L$, where $LY_t = Y_{t-1}$. The equation becomes $(1 – \phi_1 L – \phi_2 L^2)Y_t = c + \epsilon_t$. The characteristic polynomial is then defined as $P(L) = 1 – \phi_1 L – \phi_2 L^2$. To find the roots of this polynomial, we replace the lag operator $L$ with a variable, commonly denoted as $z$ or $y$. So, we study the roots of $1 – \phi_1 z – \phi_2 z^2 = 0$. These roots dictate the model’s dynamic properties.

Who should use it? This concept is vital for time series analysts, econometricians, statisticians, data scientists, and researchers working with financial data, economic indicators, climate data, or any sequential data that can be modeled using autoregressive processes. Understanding the characteristic polynomial helps in identifying whether an AR(2) model is stationary, which is a prerequisite for many forecasting and inference techniques. If the model is not stationary, its forecasts can be unreliable.

Common misconceptions include confusing the roots of the characteristic polynomial of the AR representation with the roots of the MA (Moving Average) representation, or incorrectly applying the stationarity condition (e.g., checking if roots are positive instead of their magnitude being less than 1). Another common issue is the inversion of the polynomial: ensuring that the correct polynomial form (e.g., $1 – \phi_1 z – \phi_2 z^2$ or $\lambda^2 – \phi_1 \lambda – \phi_2$) is used for root finding and stationarity checks, as different forms have reciprocal roots.

AR(2) Characteristic Polynomial Formula and Mathematical Explanation

The AR(2) model is defined as $Y_t = c + \phi_1 Y_{t-1} + \phi_2 Y_{t-2} + \epsilon_t$. To derive the characteristic polynomial, we first assume the process is stationary and has a mean $\mu$. Subtracting the mean from both sides and assuming $c = \mu(1 – \phi_1 – \phi_2)$ for stationarity with constant mean $\mu$: $(Y_t – \mu) = \phi_1 (Y_{t-1} – \mu) + \phi_2 (Y_{t-2} – \mu) + \epsilon_t$. Let $X_t = Y_t – \mu$. Then the model is $X_t = \phi_1 X_{t-1} + \phi_2 X_{t-2} + \epsilon_t$. Using the lag operator $L$, where $L^k X_t = X_{t-k}$, we can write this as $X_t – \phi_1 L X_t – \phi_2 L^2 X_t = \epsilon_t$, which simplifies to $(1 – \phi_1 L – \phi_2 L^2) X_t = \epsilon_t$. The characteristic polynomial is obtained by replacing the lag operator $L$ with a variable, say $z$. Thus, the polynomial is $P(z) = 1 – \phi_1 z – \phi_2 z^2$. The roots of this polynomial are the values of $z$ for which $P(z) = 0$. The roots of the AR(2) characteristic polynomial determine the stationarity of the time series process. For an AR(2) process to be stationary, the roots of its characteristic polynomial, when considered in the form $1 – \phi_1 z^{-1} – \phi_2 z^{-2} = 0$, must lie inside the unit circle. This is equivalent to saying that the roots of $z^2 – \phi_1 z – \phi_2 = 0$ must lie outside the unit circle. Alternatively, and more commonly when using functions like R’s `polyroot` on the polynomial $1 – \phi_1 y – \phi_2 y^2$, the roots found, let’s call them $r_1$ and $r_2$, must satisfy $|r_1| < 1$ and $|r_2| < 1$ for stationarity. The `polyroot` function in R typically solves for the roots of a polynomial given its coefficients in descending order of power. For $1 - \phi_1 y - \phi_2 y^2$, the coefficients are $(1, -\phi_1, -\phi_2)$.

The condition for stationarity can be expressed in terms of the coefficients $\phi_1$ and $\phi_2$ directly:

  • $|\phi_2| < 1$
  • $|\phi_1| < 1 + \phi_2$
  • $|\phi_1| < 1 - \phi_2$

These conditions ensure that the roots of the characteristic equation lie within the unit circle, guaranteeing that the time series process is stable and its variance is finite.

Variable Explanations

Variable Meaning Unit Typical Range
$Y_t$ Value of the time series at time $t$ Depends on data (e.g., USD, Index points, °C) Varies
$\phi_1$ Autoregressive coefficient for lag 1 Unitless Typically between -2 and 2, but stationarity imposes tighter bounds. For AR(2), must satisfy stationarity conditions.
$\phi_2$ Autoregressive coefficient for lag 2 Unitless Typically between -1 and 1, but stationarity imposes tighter bounds. For AR(2), must satisfy stationarity conditions.
$\epsilon_t$ Error term (white noise) at time $t$ Same unit as $Y_t$ Mean 0, constant variance
$z$ Variable in the characteristic polynomial (representing $L$) Unitless Complex numbers
$r_i$ Root of the characteristic polynomial Unitless Complex numbers. For stationarity, $|r_i| < 1$.

Practical Examples (Real-World Use Cases)

Understanding the roots of the characteristic polynomial is key to assessing the stationarity and predictive power of an AR(2) model. Let’s look at two examples.

Example 1: Stationary AR(2) Model

Consider a time series model for monthly sales, where the current sales depend on the sales of the previous two months. Let the estimated coefficients be $\phi_1 = 0.7$ and $\phi_2 = -0.4$.
The characteristic polynomial is $1 – 0.7z – (-0.4)z^2 = 1 – 0.7z + 0.4z^2$.
We input `phi1 = 0.7` and `phi2 = -0.4` into the calculator.

Inputs:

  • $\phi_1 = 0.7$
  • $\phi_2 = -0.4$

Calculator Output (simulated):

  • Polynomial Coefficients (for polyroot): `c(1, -0.7, 0.4)`
  • Roots (z⁻¹): `0.875 + 0.878i`, `0.875 – 0.878i` (approximately)
  • Magnitude of Roots: `~1.24` for both roots
  • Stationarity Check (All |root| < 1): `False`

Interpretation: Although the individual coefficients seem reasonable ($\phi_1$ is positive, $\phi_2$ is negative), the magnitudes of the roots are greater than 1. This indicates that the AR(2) model with these coefficients is not stationary. Time series models that are not stationary tend to exhibit increasing variance over time, making long-term forecasts unreliable. The model might require differencing or a different specification.

Example 2: Non-Stationary AR(2) Model

Suppose we are modeling daily stock prices, and the estimated coefficients are $\phi_1 = 1.2$ and $\phi_2 = -0.5$.
The characteristic polynomial is $1 – 1.2z – (-0.5)z^2 = 1 – 1.2z + 0.5z^2$.
We input `phi1 = 1.2` and `phi2 = -0.5` into the calculator.

Inputs:

  • $\phi_1 = 1.2$
  • $\phi_2 = -0.5$

Calculator Output (simulated):

  • Polynomial Coefficients (for polyroot): `c(1, -1.2, 0.5)`
  • Roots (z⁻¹): `1.2` (real root), `0` (repeated root) – This example is simplified; `polyroot` finds complex roots. Let’s recalculate using the formula $z^2 – 1.2z + 0.5 = 0$. Roots are $\frac{1.2 \pm \sqrt{1.44 – 4(0.5)}}{2} = \frac{1.2 \pm \sqrt{1.44 – 2}}{2} = \frac{1.2 \pm \sqrt{-0.56}}{2} = \frac{1.2 \pm i\sqrt{0.56}}{2} = 0.6 \pm i\frac{\sqrt{0.56}}{2}$. Magnitudes are $\sqrt{0.6^2 + (\frac{\sqrt{0.56}}{2})^2} = \sqrt{0.36 + \frac{0.56}{4}} = \sqrt{0.36 + 0.14} = \sqrt{0.5}$.
  • Roots (z⁻¹): `0.6 + 0.374i`, `0.6 – 0.374i` (approximately)
  • Magnitude of Roots: `~0.707` for both roots
  • Stationarity Check (All |root| < 1): `True`

Interpretation: In this case, the magnitudes of both roots are approximately 0.707, which is less than 1. This means the AR(2) process is stationary. A stationary model is preferred for reliable forecasting and analysis as its statistical properties (like mean and variance) remain constant over time. This model suggests that past shocks to stock prices have a decaying influence.

How to Use This AR(2) Characteristic Polynomial Calculator

Using the AR(2) Characteristic Polynomial Root Calculator is straightforward and designed for quick analysis of time series model stationarity. Follow these simple steps:

  1. Identify Coefficients: Determine the estimated coefficients $\phi_1$ and $\phi_2$ for your AR(2) time series model. These are typically obtained from statistical software after fitting the model to your data.
  2. Input Coefficients: Enter the value of $\phi_1$ into the “Coefficient φ₁” input field and the value of $\phi_2$ into the “Coefficient φ₂” input field. The calculator accepts decimal numbers.
  3. Calculate Roots: Click the “Calculate Roots” button. The calculator will process the inputs and display the results.
  4. Understand the Results:
    • Primary Result: This highlights whether the AR(2) model is likely stationary based on the calculated root magnitudes.
    • Polynomial Coefficients (for polyroot): Shows the array `c(1, -phi1, -phi2)` that would be used in R’s `polyroot` function.
    • Roots (z⁻¹): Displays the complex roots of the characteristic polynomial $1 – \phi_1 z – \phi_2 z^2 = 0$.
    • Magnitude of Roots: Shows the absolute value (magnitude) of each complex root.
    • Stationarity Check: A clear indication (‘True’ or ‘False’) if all root magnitudes are less than 1, signifying stationarity.
    • Formula Explanation: A brief description of the mathematical basis for the calculation.
    • Table: Provides a detailed breakdown of each root, its magnitude, and whether it lies within the unit circle.
    • Chart: Visually represents the roots in the complex plane relative to the unit circle. Roots inside the circle indicate stationarity.
  5. Interpret for Decision-Making:
    • If the “Stationarity Check” is `True` and all roots are inside the unit circle (magnitudes < 1), your AR(2) model is stationary. This is generally desirable for stable forecasting and analysis.
    • If the “Stationarity Check” is `False` and one or more roots are outside the unit circle (magnitudes ≥ 1), the model is non-stationary. You may need to consider differencing the data or using a different model specification (e.g., an ARIMA model).
  6. Reset or Copy: Use the “Reset” button to clear the fields and start over with default values. Use the “Copy Results” button to copy all displayed results for documentation or further analysis.

Key Factors That Affect AR(2) Results

Several factors influence the roots of the characteristic polynomial and, consequently, the stationarity and behavior of an AR(2) model. Understanding these is key to interpreting the results correctly:

  1. Values of Coefficients ($\phi_1, \phi_2$): This is the most direct factor. Small changes in $\phi_1$ and $\phi_2$ can shift the roots’ positions in the complex plane, potentially crossing the unit circle boundary and changing the stationarity property. For instance, if $\phi_1$ is close to 1 or -1, or if $\phi_2$ is close to 1, stationarity might be compromised.
  2. Magnitude of Coefficients: Larger absolute values for $\phi_1$ or $\phi_2$ generally push the roots further from the origin in the complex plane. If these magnitudes are too large, the roots may fall outside the unit circle, leading to non-stationarity. Conversely, coefficients close to zero often lead to stationary processes.
  3. Interplay Between $\phi_1$ and $\phi_2$: The stationarity conditions for an AR(2) model involve complex interactions between $\phi_1$ and $\phi_2$: $|\phi_2| < 1$, $|\phi_1| < 1 + \phi_2$, and $|\phi_1| < 1 - \phi_2$. Violating any of these inequalities means the model is non-stationary. For example, a large positive $\phi_1$ might be permissible if $\phi_2$ is sufficiently negative, and vice-versa.
  4. Data Generating Process: The true underlying process that generated the data dictates the ‘correct’ $\phi_1$ and $\phi_2$ values. If the data truly follows a non-stationary process (like a random walk), any fitted AR(2) model aiming for stationarity might yield coefficients that result in roots outside the unit circle.
  5. Estimation Method: The method used to estimate $\phi_1$ and $\phi_2$ (e.g., Maximum Likelihood Estimation, Ordinary Least Squares) can affect their precise values. Different estimators might yield slightly different coefficients, potentially altering the calculated root magnitudes and the stationarity conclusion, especially for borderline cases.
  6. Sample Size: With small sample sizes, the estimated coefficients might have larger standard errors, meaning the estimated values could deviate significantly from the true underlying coefficients. This uncertainty can lead to inaccurate conclusions about stationarity based on the calculated roots. Larger sample sizes generally yield more reliable estimates.
  7. Model Misspecification: If an AR(2) model is incorrectly specified for the data (e.g., the true process is AR(3) or ARIMA(1,1,0)), the estimated $\phi_1$ and $\phi_2$ might not accurately reflect the underlying dynamics, leading to misleading root calculations and stationarity assessments.

Frequently Asked Questions (FAQ)

Q1: What does it mean for an AR(2) model to be stationary?

A stationary time series has statistical properties (like mean, variance, and autocorrelation) that are constant over time. For an AR(2) model, stationarity requires the roots of its characteristic polynomial to lie inside the unit circle (magnitudes less than 1). This ensures that shocks to the system eventually die out and the series doesn’t explode or exhibit changing variability.

Q2: How is the characteristic polynomial $1 – \phi_1 z – \phi_2 z^2 = 0$ related to the AR(2) process $Y_t = \phi_1 Y_{t-1} + \phi_2 Y_{t-2} + \epsilon_t$?

The polynomial arises from rewriting the AR(2) equation using the lag operator $L$, yielding $(1 – \phi_1 L – \phi_2 L^2)Y_t = \epsilon_t$. The characteristic polynomial is formed by replacing $L$ with a variable $z$. The roots of this polynomial determine the stability and dynamics of the process.

Q3: What are the specific conditions on $\phi_1$ and $\phi_2$ for AR(2) stationarity?

The AR(2) process is stationary if and only if all three conditions are met: $|\phi_2| < 1$, $|\phi_1| < 1 + \phi_2$, and $|\phi_1| < 1 - \phi_2$. These conditions ensure the roots of the characteristic polynomial lie within the unit circle.

Q4: Why does the calculator use coefficients `c(1, -phi1, -phi2)` for `polyroot` in R?

The `polyroot` function in R expects coefficients of a polynomial ordered from the highest power to the lowest. For the polynomial $1 – \phi_1 y – \phi_2 y^2$, the highest power is $y^2$ (coefficient $-\phi_2$), followed by $y^1$ (coefficient $-\phi_1$), and then the constant term $y^0$ (coefficient $1$). However, the common convention is to define the polynomial with the constant term first when listing coefficients for functions like `polyroot`. The polynomial $1 – \phi_1 z – \phi_2 z^2$ has coefficients $(1, -\phi_1, -\phi_2)$ when ordered by descending powers of $z$. The calculator uses this standard representation.

Q5: What if the roots are complex? Does that affect stationarity?

Complex roots do not inherently affect stationarity. Stationarity depends only on the magnitude (absolute value) of the roots. As long as the magnitude of each complex root is less than 1, the AR(2) process remains stationary. Complex roots often indicate oscillatory behavior in the time series.

Q6: Can this calculator be used for AR models of higher orders (AR(3), AR(4), etc.)?

This specific calculator is designed exclusively for AR(2) models. For higher-order AR processes, the characteristic polynomial will have more terms (e.g., $1 – \phi_1 z – \phi_2 z^2 – \phi_3 z^3$ for AR(3)). While the principle of finding roots and checking magnitudes remains the same, the polynomial coefficients and the number of roots increase, requiring a generalized calculator or specific software functions like R’s `polyroot` with a longer coefficient vector.

Q7: What happens if I get roots exactly on the unit circle?

Roots exactly on the unit circle (magnitude = 1) represent a boundary case between stationarity and non-stationarity. Models with roots exactly on the unit circle are typically considered marginally stationary or unit root processes. While they don’t explode like non-stationary processes, their statistical properties are not constant in the same way as strictly stationary processes, and they may require special handling, such as differencing, for analysis and forecasting (similar to ARIMA models).

Q8: How do I interpret the chart?

The chart displays the complex roots in the complex plane. The horizontal axis represents the real part, and the vertical axis represents the imaginary part. A circle is drawn to represent the unit circle (all points with a magnitude of 1). If all calculated roots (plotted as points) fall strictly *inside* this circle, the AR(2) model is stationary. If any root falls *on* or *outside* the circle, the model is not strictly stationary.

Q9: Is the condition $|r| < 1$ for roots equivalent to the coefficient conditions like $|\phi_2|<1$?

Yes, the conditions on the coefficients ($|\phi_2| < 1$, $|\phi_1| < 1 + \phi_2$, $|\phi_1| < 1 - \phi_2$) are derived precisely to ensure that the roots of the characteristic polynomial $1 - \phi_1 z - \phi_2 z^2 = 0$ lie inside the unit circle (i.e., $|z| < 1$). Finding the roots directly and checking their magnitudes is a computational way to verify these conditions.



Leave a Reply

Your email address will not be published. Required fields are marked *