【问题标题】:Typeerror : Newey West for OLS in python类型错误:Newey West 用于 Python 中的 OLS
【发布时间】:2020-11-14 12:03:45
【问题描述】:

我正在尝试使用 Newey West t-在 python 中使用 statsmodels 进行 OLS 回归。

我的代码是这样的:

import pandas as pd
import statsmodels.formula.api as smf
df = pd.DataFrame({'a':[1,3,5,7,4,5,6,4,7,8,9],
                   'b':[3,5,6,2,4,6,7,8,7,8,9]})
reg = smf.ols('a ~ b',data = df).fit(cov_type='HAC',cov_kwds={'maxlags':1})

当我运行它时,它给出了错误: TypeError: float() 参数必须是字符串或数字,而不是 '_NoValueType'

我很难弄清楚我的代码有什么问题。由于 'a' 和 'b' 的长度相同,所以没有 NoValueType。

请帮帮我。

【问题讨论】:

    标签: python pandas statistics statsmodels statistical-test


    【解决方案1】:

    代码运行完美,可能还有其他问题。看图:

    【讨论】:

    • 好的。可能是什么问题?我正在使用间谍。你也在用jupyter notebook吗?
    猜你喜欢
    • 2014-06-18
    • 1970-01-01
    • 2016-01-24
    • 2018-11-15
    • 1970-01-01
    • 2014-10-13
    • 2018-11-17
    • 2015-10-08
    • 1970-01-01
    相关资源
    最近更新 更多