прогнозирование серий с использованием stlf в rpy2 - PullRequest
0 голосов
/ 03 августа 2020

Я пытаюсь использовать stlf, чтобы подогнать и предсказать таймсерии под r2py:

pandas2ri.activate()
with localconverter(ro.default_converter + pandas2ri.converter):
    r_df = ro.conversion.py2rpy(wk_frames[1]['flow_rate']) # already a date-indexed dataframe
ro.globalenv['flow'] = r_df
res = ro.r("stlf(flow,h=52,method='arima',s.window='periodic',level=30)")

Затем он возвращает мне ошибку:

R[write to console]: Error in stlf(flow, h = 52, method = "arima", s.window = "periodic", level = 30) :    
y is not a seasonal ts object

Я также пробовал:

r_start = IntVector((wk_frames[1].index[0].year,wk_frames[1].index[0].month,wk_frames[1].index[0].day))
r_end = IntVector((wk_frames[1].index[-1].year,wk_frames[1].index[-1].month,wk_frames[1].index[-1].day)) 
ts = stats.ts(FloatVector(wk_frames[1]['flow_rate'].values), start=r_start, end=r_end,frequency=52)
ro.globalenv['flow'] = ts
res = ro.r("stlf(flow,h=52,method='arima',s.window='periodic',level=30)")

Что возвращает

R[write to console]: Error in if (ncol(x) == 1L) { : missing Value where TRUE/FALSE needed

Есть идеи?

...