我正在使用软件包rpy2在Python环境中使用R语言。我正在使用仅在R上的MSGARCH程序包。该程序包显然是假定包含有属性predict。 https://rdrr.io/cran/MSGARCH/man/predict.html 我不明白为什么会有这个错误。你有个主意吗?
完整的错误消息是:
Traceback (most recent call last):
File "markov.py", line 165, in <module>
pred = ms.predict(object = fitMCMC, newdata = None, nahead = '30L')
AttributeError: module 'MSGARCH' has no attribute 'predict'
代码是:
ms = importr('MSGARCH')
from rpy2.robjects import r, pandas2ri, numpy2ri, vectors
pandas2ri.activate()
numpy2ri.activate()
base = importr('base')
stats = importr('stats')
pred = ms.predict(object = fitMCMC, newdata = None, nahead = '30L')