Regression回归
回归分析
–解释一组变量对另一个感兴趣变量结果的影响
–结果/因变量
–输入/独立变量
线性回归 Linear Regression
一种分析技术,用来模拟几个输入变量和一个连续的结果变量之间的关系。
关键假设:关系是线性的。
Linear regression assumes
– There is a linear relationship between the input variables and the outcome variable
β0, β1 … βp-1 是未知的模型参数-如何获得他们的值呢?
Ordinary Least Squares (OLS) 用普通最小二乘法来估算参数的取值
– A common technique to estimate the parameters.
– Find the line best approximating the relationship.
How to work? 假设针对结果变量y 只有一个输入变量 x。
我们的目标是找到最接近结果变量与输入变量之间关系的一条直线。借助于 OLS,目标变
成找到通过这些点的直线,使得每个点与这条直线在垂直方向的差值的平方和最小。换句话说,
求得 ß 0 和 ß 1 的值,使得公式的总和最小。
然而OSL——对误差项𝜀没有进行假设
Linear regression model– Making additional assumptions on top of the OLS–>Common assumption: the error term is a normally distributed random variable.
The regression model estimates the expected value of y for the given value of x.
当定义个x值时,y的期望值在一个区间内
IE,x=8, y = 15—25
The normality assumption on the error terms
– helps hypothesis testing on the regression model
– Provides confidence intervals on β 0 and E(y).
残差(Residuals)是 n 个结果观测值中每一个的误差项的观测值, 从 R 的输出来看,残差在大约−37~+37 之间变化,中位数接近 0。前面讲到,残差被假定为均值为零和方差恒定的正态分布
截距(Intercept)项β0被隐式地包含在模型中, 一般情况下,截距(Intercept)对应的是在所有输入变量等于 0 时结果值的估算。(Age, education, gender 的参数都是0)
Age 的系数接近于 1,这个系数的解释如下:年龄每增加一岁,个人收入预计将增加$995。
教育年限每增加一年,个人收入预计增加大约$1,758。
对 Gender 的系数的解释稍微有一些区别。当 Gender 等于 0 的时候,Gender 系数对于预期
收入的预测没有贡献。当 Gender 等于 1 的时候,预期的 Income 则会下降大约$934。
系数列右边的 Std.Error(标准误差)列提供了每个系数相关的抽样误差,并且可以用来使用 T 分布(t-distribution)执行假设检验,以确定每个系数是否在统计意义上不为零.如果一个系数