Since \(\beta_1\) captures the relationship between X and Y , we would like to be able to do inference on this parameter.
Confidence interval or test about \(\beta_1\), (not \(\hat\beta_1\))
Result: If \(Y | X = x\) has a normal distribution and \(S_{\hat \beta_1}\) is the estimated standard error of \(\hat \beta _1\), then
\[ {\hat \beta_1-\beta_1\over S_{\hat \beta_1}}\sim T_{n-2} \]
\(S_{\hat \beta_1}\) is the standard error of \(\hat \beta_1\). depend on \(\sigma_\epsilon^2\). You will not required to calculate the value by hand in this course.
This holds approximately if \(Y | X = x\) is not normal, but \(n \geq 30\).
A \((1-\alpha)100\)% confidence interval for \(\beta_1\) is
\[ \hat \beta_1\pm t_{n-1,\alpha/2}S_{\hat \beta_1} \]
In R:
confint(model, level =0.95)
## 2.5 % 97.5 %
## (Intercept) 26.7346495 33.1002241
## Mheight 0.4908201 0.5926739
The intercept is \(\alpha_1\), Mheight is \(\beta_1\)
\[ H_0:\beta_1=\beta_{1,0},H_0:\beta_1=\beta_{1,0},H_0:\beta_1=\beta_{1,0}\\ H_a:\beta_1>\beta_{1,0},H_a:\beta_1<\beta_{1,0},H_a:\beta_1\neq\beta_{1,0} \]
\(H_a:\beta_1\neq\beta_{1,0}\) means there is no linear relationship between Y and X.
\(H_a:\beta_1>\beta_{1,0}\) means Y and X are positively correlated, or Y will increase as X increases.
\(H_a:\beta_1<\beta_{1,0}\) means Y and X are negatively correlated, or Y will decrease as X increases.
\[ T_{H_0}={\hat\beta_1-\beta_{1,0}\over S_{\hat\beta_1}} \]
If \(H_0\) is true, \(T_{H_0}\sim T_{n-2}\)
We can find rejection rules and p-values using the same method as our previous T tests.
Example: Test whether mothers’ height and daughters’ height have a positive linear relationship using \(\alpha = 0.05\).
summary(model)
##
## Call:
## lm(formula = Dheight ~ Mheight, data = heights)
##
## Residuals:
## Min 1Q Median 3Q Max
## -7.397 -1.529 0.036 1.492 9.053
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 29.91744 1.62247 18.44 <2e-16 ***
## Mheight 0.54175 0.02596 20.87 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.266 on 1373 degrees of freedom
## Multiple R-squared: 0.2408, Adjusted R-squared: 0.2402
## F-statistic: 435.5 on 1 and 1373 DF, p-value: < 2.2e-16
\(\hat\beta_1=0.54175>0\), standard error of \(\hat \beta_1\) is 0.02596
\(T_{H_0}=20.87\), p-value is realllly small.
The p-value is two-sided by default in R.
\(H_0:\beta_1=0\), \(H_a:\beta_1>0\)
$T_{H_0}={ 0.54175 }=20.87 $
\(p-value=2\div (2\times 10^{-16})<0.05\)
Reject \(H_0\) p-value is smaller than \(\alpha\)
The estimated regression line is
\[ \hat Y=\hat \alpha_1+\hat \beta_1 x \]
We can use this regression line to predict values of Y for specific values of x. We will denote this predicted value with \(\hat \mu_{Y|X}(x)\).
Example: What is the predicted height for a woman whose mother is 69 inches tall?
\(\hat y=\hat \alpha_1+\hat\beta_1x=29.917+0.542\times 69=67.315\)
\(\hat \mu_{Y|X=69}=\hat E(Y|X=69)=67.315\) inches.
This value represents two types of prediction.
Average height of all women whose mothers are 69 inches
Smaller error due to averaging
The height of an individual (future observation) women whose mother is 69 inches.
Higher error for individual prediction
The errors and intervals associated with these two cases are different.