我无法在线性回归模型上执行annova。我附上了下面的简化代码。请让我知道如何解决它。
import statsmodels.api as sm
import numpy as np
# define the data
x1 = np.random.rand(100)
x2 = np.random.rand(100)
y = 2*x1 + 3*x2 + np.random.normal(size=100)
# build the model with all independent variables
X = sm.add_constant(np.column_stack((x1, x2)))
model = sm.OLS(y, X).fit()
# perform the F-test
f_value, p_value, _ = sm.stats.anova_lm(model, typ=1)