2 모형

\[ Y_{i} = \alpha + \beta X_{i} + e_{i} \]

2.1 모형 가정

\[ The \ variable \ e_{i} \ is \ random \ (= stochastic) \\ E(e_{i}) = 0, \ \ var(e_{i}^2) = \sigma^2, \ \ cov(e_{j},e_{k}) =0 \\ The \ variable \ X_{i} \ is \ not \ random \ (= nonstochastic) \\ E(X_{i} \ e_{i}) = 0 \\ e_{i} \sim N(0,\sigma^2) \\ \]

2.2 변수

x = food[,2]   # Income
y = food[,1]   # Food Expenditure

2.3 추정

reg <- lm(y ~ x)

2.4 추정 결과

summary(reg)  
## 
## Call:
## lm(formula = y ~ x)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -223.025  -50.816   -6.324   67.879  212.044 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   83.416     43.410   1.922   0.0622 .  
## x             10.210      2.093   4.877 1.95e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 89.52 on 38 degrees of freedom
## Multiple R-squared:  0.385,  Adjusted R-squared:  0.3688 
## F-statistic: 23.79 on 1 and 38 DF,  p-value: 1.946e-05

2.5 b1, b2

b1 <- coef(reg)[[1]] 
b2 <- coef(reg)[[2]]

b1
## [1] 83.416
b2
## [1] 10.20964