我尝试了季节性https://github.com/welch/seasonal的“示例用法”。代码如下。
import math
from seasonal import fit_seasons,adjust_seasons
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
s = [10 * math.sin(i * 2 * math.pi / 25) + i * i /100.0 for i in range(100)]
seasons,trend = fit_seasons(s)
adjusted = adjust_seasons(s,seasons=seasons)
residual = adjusted -trend
调整和趋势有什么区别?
这是“经季节性调整”的数据;即提取季节性成分的数据。如果信号是Y
并且分解被写为Y = S + T + R
,其中S
是季节性成分,T
是趋势,R
是残差,那么“经季节性调整”的结果只是T + R
。