我刚刚开始尝试在Python中使用R,因为有一些有趣的软件包。我正在使用rpy2软件包在python环境中使用R。有人可以帮助我了解为什么我有此错误吗?我不在代码中使用$。错误发生在fitMCMC。
from rpy2.robjects.packages import importr
import rpy2.robjects as ro
ms = importr('MSGARCH')
from rpy2.robjects import r, pandas2ri, numpy2ri, vectors
pandas2ri.activate()
numpy2ri.activate()
base = importr('base')
stats = importr('stats')
spec = ms.CreateSpec(variance_spec = ro.ListVector( ro.StrVector(['sGARCH', 'sGARCH'])),
distribution_spec = ro.ListVector( ro.StrVector(['norm', 'norm']))
)
X = my_data
fitMCMC = ms.FitMCMC(spec = spec, data = X, ctr = ro.ListVector({'nburn' : '500L', 'nmcmc' : '500L', 'nthin' : '1L'}))
print(base.summary(fitMCMC))