6 Remedies and Miscellaneous Topics
More Diagnostics for Residuals
Review Residual Plots
Should do EDA first. Use
1 | |
to get a smoothed curve fit to see the relation ship between and .
Let see some examples:

- No obvious violation
- Nonlinearity. Because at some the residuals are all negative or positive.
- Non-constant variance. Note that the residual plot below uses absolute residual as the y-label, aiming to see the scale of residuals.
Built-in diagnostic plots in R
1 | |
R will show four diagnostic plots one by one:
- Residuals vs Fitted
- Normal Q-Q
- Scale-Location
- Residuals vs Leverage
Points with numbers next to them in each plot are extreme values. The numbers are the index of them, letting us to check the original data.
Residuals vs Fitted

- Why ? To combine all explanatory variables' influences, easy to move to multiple linear regression.
- Used to check if the residuals have non-linear patterns.
- It’s good if residuals equally spread around a horizontal line without distinct patterns.
Normal Q-Q

- Used to check if the residuals are normally distributed.
- It’s good if residuals are lined well on the straight dashed line.
Standardized residual is defined as
where , the leverage. It will be discussed in the next lecture.
Note that
The reason why standardized residual is used is that are not i.i.d. so they cannot be directly used to delegate the real . Pre-process needed.
Scale-Location

- It shows if residuals are spread equally along the ranges of predictors
- Check the assumption of equal variance (homoscedasticity)
- It’s good if you see a horizontal line with equally (randomly) spread points
Residuals vs Leverage

Leverage, also known as the observation self-sensitivity or self-influence
For design matrix , . Cook's distance is defined as
where is the fitted response value obtained when excluding the -th observation. It measures the influence of -th case on all predicted values.
给定 和 ,可以解出标准化残差的平方,故可以画出两条对称的等值线。

F-Test for Lack of Fit
When we have repeat observations at various values of , the error term will be partitioned into pure error (error within replicates) and a lack of fit error.

Use GLT, the basic idea is to compare two models -- the full one and the reduced one. Then here comes the question, what are the two models?
Suppose there are different observed values of : . So there are groups, and within each group , there are observations. Let be the -th response in the -th group.
If holds, then the mean response . The reduced model is
Run regression and get . Its df is .
Suppose that can take values . Then the full model is
Run regression and get (Pure Error). Note that this model has as many parameters as the number of the groups. So its df is .
And we can get
There is a relationship

Let's Have a Deeper Look at DF (Cont'd)
Look at this before going on.
Remember that . Below we show can continue to be divided into two orthogonal vectors.
Let . Then there is another design matrix
The full model can be written as
note that there is not an all-one column in , and (there exists a matrix satisfying ) where is the projection matrix of .
Rewrite as
We can verify that . The core is .
Note that
Remedies
Nonlinear Relationships
Do transformations like etc. Then we may get linear relationship. But many of the times, such transformations may not exist. Then, nonlinear regression analysis is required.
Non-Constant Variance
Use a weighted analysis.
Box-Cox Transformations
- Also called power transformations.
- Designed for strictly positive responses.
- Adjust for non-Normality and non-constant variance
- .


Putting it simple, in order to find the best , we can fix other parameters and optimize only.


Why we concern the confidence interval:
- Interpretability
- Check if 1 lies in the CI -- that means a linear relationship cannot be rejected.
Other Topics
and , two fitted lines. Their relationship is: the ratio of their slopes equals to the squared sample correlation.

第一节课没咋听
失拟 lack of fit,用 GLT 检验
- 区分 full model 和 reduced model
- 三个模型,最细的是 4,1、3 次一级,2 最粗
- 跟上一级比,线性是不是足够
- 以前是检验是不是线性,往下比
- SSE=SSPE+SSLF, pure error, lack of fit, 必须有重复
补救
- power transformation
- 可用 MLE 估计 .
- pdf 的 transformation
- 不硬碰硬优化 likelihood function,做变换搞成 LS 之形式解之
- 关注 的置信区间
- 找一个好算的
- 可解释性
- 1 在不在区间里,很重要(不做变换)
Regression through the origin (过原点回归)
- 很多东西会崩溃,比如 将不再为零
反向预测
- .
- 校准
- 为啥不 ?意义不同
- 两条回归线的夹角越小,相关系数越大
:
- 啥也不代表,拟合程度、预测能力
- 不能用比较 来评价模型
- 没有因果理解
- Adjusted R2 一样的