import numpy as np from scipy import stats # 生成随机数据 x = np.random.randn(100) y = 2 * x + np.random.randn(100) # 进行线性回归 slope, intercept, r_value, p_value, std_err = stats.linregress(x, y) # 打印回归结果 print("斜率:", slope) print("截距:", 安装和疑难解答:Scipy库的指南 intercept) print("相关系数:", r_value) print("p值:", p_value) print("标准误差:", std_err)
登录后复制