regression
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
regression [2018/10/30 08:30] – [표준오차 잔여변량 (standard error residual)] hkimscil | regression [2019/09/11 18:53] – hkimscil | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Regression ====== | + | ====== Regression |
SA [[Multiple Regression]] | SA [[Multiple Regression]] | ||
Line 152: | Line 152: | ||
====== E.g., 1. Simple regression & F-test for goodness of fit ====== | ====== E.g., 1. Simple regression & F-test for goodness of fit ====== | ||
Data file: {{: | Data file: {{: | ||
+ | {{: | ||
+ | < | ||
아래는 어느 책에서 쓰인 가상 데이터이다. 통장수와 수입, 그리고 가족 구성원의 숫자가 변인이며 총 10 가구에 대한 정보가 수집된 것이다. 여기서는 이 데이터를 이용하여 위에서 언급된 SS< | 아래는 어느 책에서 쓰인 가상 데이터이다. 통장수와 수입, 그리고 가족 구성원의 숫자가 변인이며 총 10 가구에 대한 정보가 수집된 것이다. 여기서는 이 데이터를 이용하여 위에서 언급된 SS< | ||
Line 185: | Line 187: | ||
^ __ prediction for y values with__ $\overline{Y}$ | ^ __ prediction for y values with__ $\overline{Y}$ | ||
- | | bankaccount | + | | bankaccount |
- | | 6 | -2 | 4 | | + | | 6 | 8 |
- | | 5 | -3 | 9 | | + | | 5 | 8 |
- | | 7 | -1 | 1 | | + | | 7 | 8 |
- | | 7 | -1 | 1 | | + | | 7 | 8 |
- | | 8 | 0 | 0 | | + | | 8 | 8 |
- | | 10 | 2 | 4 | | + | | 10 | 8 |
- | | 8 | 0 | 0 | | + | | 8 | 8 |
- | | 11 | 3 | 9 | | + | | 11 | 8 |
- | | 9 | 1 | 1 | | + | | 9 | 8 |
- | | 9 | 1 | 1 | | + | | 9 | 8 |
- | | $\overline{Y}=8$ | + | | $\overline{Y}=8$ |
<WRAP clear /> | <WRAP clear /> | ||
위에서 제곱한 값의 합은? 30이다. 이는 사실, SS (Sum of Square)값이 30이라는 이야기이다. 그리고, 위에서 설명한 것처럼, 이 값은 $ SS_{total} $ 이라고 할 수 있으며 __전체에러__ 변량이라고 할 수 있겠다. | 위에서 제곱한 값의 합은? 30이다. 이는 사실, SS (Sum of Square)값이 30이라는 이야기이다. 그리고, 위에서 설명한 것처럼, 이 값은 $ SS_{total} $ 이라고 할 수 있으며 __전체에러__ 변량이라고 할 수 있겠다. | ||
Line 202: | Line 204: | ||
__SS< | __SS< | ||
< | < | ||
+ | > head(datavar) | ||
+ | . . . . | ||
+ | > mod <- lm(bankaccount ~ income, data = datavar) | ||
+ | > summary(mod) | ||
+ | |||
Residuals: | Residuals: | ||
Min 1Q Median | Min 1Q Median | ||
Line 279: | Line 286: | ||
| Model | | Model | ||
| 1.000 | Regression | | 1.000 | Regression | ||
- | | | + | | |
| | | | ||
| a Predictors: (Constant), bankIncome | | a Predictors: (Constant), bankIncome | ||
+ | |||
+ | * 1.383 = SS< | ||
+ | * standard error = 표준오차는 [[: | ||
+ | * 따라서 MS< | ||
<WRAP clear /> | <WRAP clear /> | ||
+ | |||
__ SS< | __ SS< | ||
Line 339: | Line 351: | ||
- | ====== E.g., 2. Simple regression ====== | + | ====== E.g., Simple regression ====== |
data: | data: | ||
{{: | {{: | ||
Line 576: | Line 588: | ||
| | ||
| | ||
+ | |||
+ | ====== e.g. Simple Regression ====== | ||
+ | {{: | ||
+ | |||
+ | < | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | > summary(mod) | ||
+ | |||
+ | Call: | ||
+ | lm(formula = Y ~ X, data = datavar) | ||
+ | |||
+ | Residuals: | ||
+ | Min 1Q Median | ||
+ | -250.22 -132.28 | ||
+ | |||
+ | Coefficients: | ||
+ | Estimate Std. Error t value Pr(> | ||
+ | (Intercept) | ||
+ | X | ||
+ | --- | ||
+ | Signif. codes: | ||
+ | |||
+ | Residual standard error: 170.5 on 10 degrees of freedom | ||
+ | Multiple R-squared: | ||
+ | F-statistic: | ||
+ | |||
+ | </ | ||
+ | < | ||
+ | Analysis of Variance Table | ||
+ | |||
+ | Response: Y | ||
+ | Df Sum Sq Mean Sq F value | ||
+ | X 1 316874 | ||
+ | Residuals 10 290824 | ||
+ | --- | ||
+ | Signif. codes: | ||
+ | > </ | ||
+ | |||
+ | < | ||
+ | > ss_total <- var(datavar$Y)*11 | ||
+ | > round(ss_total) | ||
+ | [1] 607698 | ||
+ | > 316874 + 290824 | ||
+ | [1] 607698 | ||
+ | </ | ||
+ | <WRAP box help> | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
====== E.g., 3. Simple regression: Adjusted R squared & Slope test ====== | ====== E.g., 3. Simple regression: Adjusted R squared & Slope test ====== | ||
Line 636: | Line 700: | ||
* Therefore, the Adjusted r< | * Therefore, the Adjusted r< | ||
+ | **__Slope test__** | ||
If we take a look at the ANOVA result: | If we take a look at the ANOVA result: | ||
Line 903: | Line 968: | ||
<WRAP clear /> | <WRAP clear /> | ||
- | {{tag> statistics " | + | {{tag> statistics " |
regression.txt · Last modified: 2024/05/22 08:19 by hkimscil