1

不知道这属于哪里,所以也在交叉验证中询问这个。我正在运行以下回归: from patsy import dmatrices import statsmodels.api as sm

y, X = dmatrices('M ~ I(4.8*(Q**0.8)) ', data=DF, return_type='dataframe')
res = sm.OLS(y, X).fit()

现在我需要检验intercept=0 和beta=1 的联合假设。我试过这样做:

hyp='Intercept = 0, 4.8*(Q**0.8) = 1'
t=res.f_test(hyp)

但出现以下错误:

PatsyError: unrecognized token in constraint
    Intercept = 0, 4.8*(Q**0.8) = 1

我也试过

hyp='Intercept = 0, I(4.8*(Q**0.8)) = 1'

但得到了

PatsyError: unrecognized token in constraint
    Intercept = 0, I(4.8*(Q**0.8)) = 1

这样做的正确方法是什么?

4

0 回答 0