How to extract a particular value from the OLS-summary in Pandas?

后端 未结 2 1539
孤独总比滥情好
孤独总比滥情好 2021-01-12 02:11

is it possible to get other values (currently I know only a way to get beta and intercept) from the summary of linear regression in pandas? I need to get R-squared. Here is

2条回答
  •  死守一世寂寞
    2021-01-12 02:39

    Docs handling the results of the regression - this will allow you to extract a number of values from your regression results:

    # Given
    model = ols(y=rets['AAPL'], x=rets.ix[:, ['GOOG']])
    

    In the case of r-squared use:

    # retrieving model's r-squared value
    model.rsquared
    

    and in the case of p-values use:

    # return p-values and corresponding coefficients in model
    model.pvalues
    

    For more parameters (fvalues ess) please refer to the doc

提交回复
热议问题