简体   繁体   English

在 python 中使用面板 ols 进行 Wald 测试

[英]Wald test with panel ols in python

I am trying to test hypothesis that all intercepts coefficients in pooled OLS are equal to zero with: F-test, Likelihood Ratio and Wald-test.我正在尝试使用以下方法测试以下假设:合并 OLS 中的所有截距系数都为零:F 检验、似然比和 Wald 检验。 I have some problems with the last one.我对最后一个有一些问题。

Here is the code PanelOLS((table1['Return']-table1['RF']), sm.add_constant(table1[['Mkt_RF','SMB','HML']])).fit().wald_test() in statsmodels you can put your hypothesis in wald_test method in string format, however it seems not to work in liner_model PanelOLS package.这是代码PanelOLS((table1['Return']-table1['RF']), sm.add_constant(table1[['Mkt_RF','SMB','HML']])).fit().wald_test()在 statsmodels 中,您可以将您的假设以字符串格式放入 wald_test 方法中,但是它似乎不适用于 liner_model PanelOLS 包。 Am I doing it in a wrong way?我是否以错误的方式做这件事?

Thanks!谢谢!

I found it.我找到了。 The problem is in syntax.问题出在语法上。

For example if I want to check if SMB=0 I do:例如,如果我想检查 SMB=0,我会这样做:

PanelOLS((table1['Return']-table1['RF']), sm.add_constant(table1[['Mkt_RF','SMB','HML']]), entity_effects=True).fit().wald_test(formula='SMB = 0')

which is a bit different from statsmodels这与 statsmodels 有点不同

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM