Skip to content
DeepForgeby svx
All problems
EasyTime Seriests-016

AR(1) Stationarity Condition

Problem

An AR(1) process x[t] = c + phi * x[t-1] + e[t] is stationary exactly when abs(phi) < 1. Return True when that condition holds and False otherwise.

This guarantees the effect of past shocks decays geometrically instead of accumulating.

Hint

The boundary abs(phi) = 1 is a random walk and is not stationary.

Test cases

case 1
in: [0.5]
expected: true
case 2
in: [-0.9]
expected: true
case 3
in: [1]
expected: false
case 4
in: [1.2]
expected: false
case 5
in: [-1]
expected: false
Starter codePython
def is_stationary_ar1(phi):
    # Your code here
    pass

5 test cases · run your code against them in the editor