Curvilnear Relationship
当我们用 scatter diagram 来看的时候,发现 x y 的关系不完全是一条直线
另外把 residual 和 y 做一个 plot,也看到,是一个弧形的:
所以,我们用二次模型, second order model. 结果就比较好,r square 也高。
Interaction
怎么发现 x1 和 x2 之间有 interaction?
我们发现:广告花费 50000和100000所产生的平均销售区别,依赖于产品的价格。
在更高的价格,增加广告花费所带来的销售变化更小。
Transformation involving dependent variable
当我们用正常的 regression 得到的式子,发现:standardized residuals 和 y 画出来的图是一个三角形:
The variability in the residuals appears to increase as the value of y increase.
Problem : Nonconstant variance
If we work with the logarithm of the dependent variable instead of the original dependent variable, the effect will be to compress the values of the dependent variable and thus diminish the effects of nonconstant variance.
用因变量的对数代替原来的因变量,这样做的效果是压缩了因变量的数量,从而达到减少非常数方差的影响。
Nonlinear Model 用 linear 来做
16.2 Determining when to add or delete variables
问题: Does adding the variable x2 lead to a significant reduction in SSE?
Variable Selection Procedures
- Stepwise Regression
- 看现在 model 里面,delete 哪一个。 If the p-value for any inependent variable is greater than Alpha to remove, the independent variable with the largest p-value is removed from the model and the stepwise regression procedure begins a new step.
- 从未在 model 中,候选的变量选一个 p-value 最低的,但是要小区 Alpha to enter. It does so by first computing an F statistic and corresponding p-value for each independent variable that is not in the model.
问题:怎么一个个添加 Variable,用 f test 来做?
- Forward Regression
- Variables 一个个进入,进入的条件和 stepwise 一样
- 但是进去了之后就不会再考察了,进去之后不会再出来
- Backward Regression
- Variables 先全部进去,一个个剔除,剔除的条件和 stepwise 一样
- 剔除了之后,就不会再出来了
- Best-subsets Regression
- 把所有 model 都列出来
- 把所有 model 都列出来
虽然6个的有最高的 r square, 但是 a simpler model with fewer variables is usually preferred. 所以选4个 Variables, r-sq 是88.1%的那个。