Skip to content
DeepForgeby svx
All problems
HardStatisticsst-043

Covariance Stationary Check Lite

Problem

Split data into two halves at n//2 and check a simple weak-stationarity condition: |mean1 - mean2| <= 0.10 * overall_std and |var1 - var2| <= 0.25 * overall_var, with population variances. Return False when n < 4 and True for constant data. Return a boolean.

Hint

Compare the two halves on level and spread with the stated tolerances.

Test cases

case 1
in: [[2,4,2,4,2,4,2,4]]
expected: true
case 2
in: [[1,2,3,4,5,6,7,8]]
expected: false
case 3
in: [[5,5,5,5,5,5,5,5]]
expected: true
case 4
in: [[1,2,3]]
expected: false
case 5
in: [[3,1,3,1,3,1,3,1]]
expected: true
Starter codePython
def covariance_stationary_lite(data):
    # Your code here
    pass

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