regression
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| regression [2023/05/23 23:53] – [Slope test] hkimscil | regression [2026/05/26 22:23] (current) – [잔차의 (나머지의) 표준편차 (standard deviation of residual)] hkimscil | ||
|---|---|---|---|
| Line 23: | Line 23: | ||
| 상관관계에서 살펴 본것처럼, | 상관관계에서 살펴 본것처럼, | ||
| - | + | \begin{eqnarray*} | |
| - | $$b = \displaystyle \frac{SP}{SS_X}$$ | + | b & = & \displaystyle \frac{SP}{SS_X} |
| - | $$a = \displaystyle \overline{Y} - b \overline{X} | + | a & = & \displaystyle \overline{Y} - b \overline{X} |
| + | \end{eqnarray*} | ||
| + | 참조: [[deriviation of a and b in a simple regression|리그레션에서 a와 b 구하기]] | ||
| [{{: | [{{: | ||
| Line 107: | Line 109: | ||
| 이 회귀공식은 X값의 범위에 속한 데이터들 중 각각의 X< | 이 회귀공식은 X값의 범위에 속한 데이터들 중 각각의 X< | ||
| - | ========== 표준오차 잔여변량 | + | ========== |
| [{{ : | [{{ : | ||
| Line 133: | Line 135: | ||
| 모든 케이스에 대한 총편차와 설명된 편차, 설명되지 않은 편차 값을 구해서 각각 더해 보면 그 합은 모두 0이 된다. 따라서, 각각의 총편차 값와 설명편차값, | 모든 케이스에 대한 총편차와 설명된 편차, 설명되지 않은 편차 값을 구해서 각각 더해 보면 그 합은 모두 0이 된다. 따라서, 각각의 총편차 값와 설명편차값, | ||
| - | $$SS_{total} = \sum (Y_i-\overline{Y})^2$$ | + | \begin{eqnarray*} |
| + | \text{SS}_{\text{total}} & = & \sum (Y_i-\overline{Y})^2 | ||
| + | \end{eqnarray*} | ||
| 그리고 총편차는 설명된 편차와 설명되지 않은 편차의 합이므로: | 그리고 총편차는 설명된 편차와 설명되지 않은 편차의 합이므로: | ||
| - | + | \begin{eqnarray*} | |
| - | $$SS_{explained} = \sum (\hat Y-\overline{Y})^2 = SS_{reg} $$ | + | \text{SS}_{\text{explained}} & = & \sum (\hat Y-\overline{Y})^2 = \text{SS}_{\text{reg}} \\ |
| - | $$SS_{unexplained} = \sum (Y_i-\hat {Y})^2 = SS_{res} $$ | + | \text{SS}_{\text{unexplained}} & = & \sum (Y_i-\hat {Y})^2 = \text{SS}_{\text{res}} \\ |
| + | \end{eqnarray*} | ||
| 을 합한 점수와 같다. | 을 합한 점수와 같다. | ||
| 따라서 $\text{Total variablity of Y = Explained variablility + Unexplained variability} $ 라고 표현할 수 있다. | 따라서 $\text{Total variablity of Y = Explained variablility + Unexplained variability} $ 라고 표현할 수 있다. | ||
| - | $SS_{unexplained} = \sum (Y_i-\hat {Y})^2$ 의 값에 df 값인 (N-2) 을 나누어 준 후 루트를 씌워 준 값을 __추정치에 대한 | + | $SS_{unexplained} = \sum (Y_i-\hat {Y})^2$ 의 값에 df 값인 (N-2) 을 나누어 준 후 루트를 씌워 준 값을 __나머지의 (잔차의) |
| - | 이 값을 제곱한 값을 __잔여 변량 (residual variance)__ 혹은 __오차 변량(error variance)__이라고 부른다 | + | * RSE residual standard error |
| + | * RMSE root mean square error | ||
| + | * standard deviation of the residual | ||
| 이에 대한 부연설명은 아래에서 다시 하도록 하겠다. | 이에 대한 부연설명은 아래에서 다시 하도록 하겠다. | ||
| Line 301: | Line 307: | ||
| 위의 표에서 (Anova table), | 위의 표에서 (Anova table), | ||
| - | | for SS | for degrees of freedom | + | | @grey: |
| | @white: white \\ = explained error (E) \\ = $SS{reg}$ | | @white: white \\ = explained error (E) \\ = $SS{reg}$ | ||
| | @orange: orange \\ = unexplained error (U) \\ = $SS{res}$ | | @orange: orange \\ = unexplained error (U) \\ = $SS{res}$ | ||
| Line 350: | Line 356: | ||
| {{: | {{: | ||
| {{: | {{: | ||
| + | |||
| + | <file csv acidity.csv> | ||
| + | stream spec83 ph83 | ||
| + | Moss 6 6.30 | ||
| + | Orcutt 9 6.30 | ||
| + | Ellinwood 6 6.30 | ||
| + | Jacks 3 6.20 | ||
| + | Riceville 5 6.20 | ||
| + | Lyons 3 6.10 | ||
| + | Osgood 5 5.80 | ||
| + | Whetstone 4 5.70 | ||
| + | UpperKeyup 1 5.70 | ||
| + | West 7 5.70 | ||
| + | Boyce 4 5.60 | ||
| + | MormonHollow 4 5.50 | ||
| + | Lawrence 5 5.40 | ||
| + | Wilder 0 4.70 | ||
| + | Templeton 0 4.50 | ||
| + | </ | ||
| + | < | ||
| + | df <- read.csv(" | ||
| + | </ | ||
| < | < | ||
| Line 741: | Line 769: | ||
| * 기울기에 대한 표준오차는 (se) 아래와 같이 구한다 | * 기울기에 대한 표준오차는 (se) 아래와 같이 구한다 | ||
| + | standard error of b | ||
| + | <wrap # | ||
| \begin{eqnarray*} | \begin{eqnarray*} | ||
| \displaystyle s_{b_{1}} & = & \sqrt {\frac {MSE}{SS_{X}}} \\ | \displaystyle s_{b_{1}} & = & \sqrt {\frac {MSE}{SS_{X}}} \\ | ||
| Line 761: | Line 791: | ||
| \begin{eqnarray*} | \begin{eqnarray*} | ||
| - | se_{\beta} & = & \frac {\sqrt{SSE/n-2}}{\sqrt{SSX}} \\ | + | \displaystyle s_{b_{1}} & = & \sqrt {\frac {\text{MSE}}{SS_{X}}} \\ |
| - | & = & \frac {\sqrt{1.1/3}}{\sqrt{10}} \\ | + | & = & \displaystyle |
| - | & = & 0.191485 | + | & = & \displaystyle \sqrt { \frac{1}{5-2} * \frac{1.1}{10}} \\ |
| \end{eqnarray*} | \end{eqnarray*} | ||
| + | |||
| 그리고 b = 0.7 | 그리고 b = 0.7 | ||
| 따라서 t = b / se = 3.655631 | 따라서 t = b / se = 3.655631 | ||
| - | < | ||
| - | y <- c(1, 1, 2, 2, 4) | ||
| - | mody <- lm(y ~ x) | ||
| - | </ | ||
| - | < | ||
| - | > x <- c(1, 2, 3, 4, 5) | ||
| - | > y <- c(1, 1, 2, 2, 4) | ||
| - | > mody <- lm(y ~ x) | ||
| - | > summary(mody) | ||
| - | |||
| - | Call: | ||
| - | lm(formula = y ~ x) | ||
| - | |||
| - | Residuals: | ||
| - | | ||
| - | | ||
| - | |||
| - | Coefficients: | ||
| - | Estimate Std. Error t value Pr(> | ||
| - | (Intercept) | ||
| - | x | ||
| - | --- | ||
| - | Signif. codes: | ||
| - | |||
| - | Residual standard error: 0.6055 on 3 degrees of freedom | ||
| - | Multiple R-squared: | ||
| - | F-statistic: | ||
| - | |||
| - | > | ||
| - | </ | ||
| ====== E.g., 4. Simple regression ====== | ====== E.g., 4. Simple regression ====== | ||
| Another example of simple regression: from {{: | Another example of simple regression: from {{: | ||
regression.1684885994.txt.gz · Last modified: by hkimscil
