python建模相关函数

1.np.linalg.lstsq

详见:

https://vimsky.com/examples/usage/python-numpy.linalg.lstsq.html

 

2.OLS,最小二乘回归

https://blog.csdn.net/kk185800961/article/details/79220724

OLS提取相关值的方法

# 提取回归系数
model.params

# 提取回归系数标准差
model.bse

# 提取回归系数p值
model.pvalues

# 提取回归系数t值
model.tvalues

# 提取回归系数置信区间 默认5%,括号中可填具体数字 比如0.05, 0.1
model.conf_int()  

# 提取模型预测值
model.fittedvalues

# 提取残差
model.resid

# 模型自由度(系数自由度)
model.df_model

# 残差自由度(样本自由度)
model.df_resid

# 模型样本数量
model.nobs

# 提取R方
model.rsquared

# 提取调整R方
model.rsquared_adj

# 提取AIC
model.aic

# 提取BIC
model.bic

# 提取F-statistic
model.fvalue

# 提取F-statistic 的pvalue
model.f_pvalue

# 模型mse
model.mse_model

# 残差mse
model.mse_resid

# 总体mse
model.mse_total
View Code

 

posted @ 2020-12-18 16:31  爬爬QQ  阅读(111)  评论(0)    收藏  举报