我正在查看python主题的统计信息。我被一只手抓住了。在
问题陈述:
Perform ANOVA on the first linear model obtained while working with mtcars data set. Display the F-statistic value.
我在问题陈述中所做的:
import statsmodels.api as sm
import statsmodels.formula.api as smf
from statsmodels.stats import anova
mtcars_data = sm.datasets.get_rdataset("mtcars").data
print(mtcars_data.columns)
mt_model1 = smf.ols('mpg ~ cyl', mtcars_data ).fit()
print(anova.anova_lm(mt_model1))
如何显示上述问题的F-统计信息?在
所以如果你想从anova表中得到cyl属性的F统计值,那么如下所示
由于您已经在mt_model1中使用了所需的变量来拟合模型,您可以通过以下方式直接调用F-statistic
当模型中有多个预测因子时,也可以使用此方法。在
经过多次试验才得到这个。在
相关问题 更多 >
编程相关推荐