python - Reading coef value from OLS regression results -
i use pandas , statsmodels linear regression. however, can't find possible way read results. results displayed need further calculations using coef values. there possible way store coef values new variable?
import statsmodels.api sm import numpy ones = numpy.ones(len(x[0])) t = sm.add_constant(numpy.column_stack((x[0], ones))) m in x[1:]: t = sm.add_constant(numpy.column_stack((m, t))) results = sm.ols(y, t).fit()
according docs, instance of regressionresults returned.
you can see available attributes there.
maybe interested in:
params
the linear coefficients minimize least squares criterion. called beta classical linear model.
example:
model = sm.ols(y,x) results = model.fit() print(results.params)
Comments
Post a Comment