12 Day 12 (June 18)
12.1 Announcements
- Questions about assignment 3
- Assignment 3 is graded
- Read Ch. 2 in linear models with R (estimation)
- Read Ch. 3 in linear models with R (inference)
12.3 Confidence intervals for paramters
Example
y <- c(63, 68, 61, 44, 103, 90, 107, 105, 76, 46, 60, 66, 58, 39, 64, 29, 37, 27, 38, 14, 38, 52, 84, 112, 112, 97, 131, 168, 70, 91, 52, 33, 33, 27, 18, 14, 5, 22, 31, 23, 14, 18, 23, 27, 44, 18, 19) year <- 1965:2011 df <- data.frame(y = y, year = year) plot(x = df$year, y = df$y, xlab = "Year", ylab = "Annual count", main = "", col = "brown", pch = 20, xlim = c(1965, 2040))
- Is the population size really decreasing?
- Write out the model we should use answer this question
- How can we assess the uncertainty in our estimate of ?
- Confidence intervals in R
## (Intercept) year ## 2356.48797 -1.15784
## 2.5 % 97.5 % ## (Intercept) 929.80699 3783.1689540 ## year -1.87547 -0.4402103
- Note and let where and . In R we can extract using
vcov()
.
## (Intercept) year ## (Intercept) 501753.2825 -252.3792372 ## year -252.3792 0.1269513
Note that
## (Intercept) year ## 708.3454542 0.3563023
corresponds to the column
Std. Error
fromsummary()
## ## Call: ## lm(formula = y ~ year, data = df) ## ## Residuals: ## Min 1Q Median 3Q Max ## -45.333 -20.597 -9.754 14.035 117.929 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 2356.4880 708.3455 3.327 0.00176 ** ## year -1.1578 0.3563 -3.250 0.00219 ** ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 33.13 on 45 degrees of freedom ## Multiple R-squared: 0.1901, Adjusted R-squared: 0.1721 ## F-statistic: 10.56 on 1 and 45 DF, p-value: 0.00219
- When is known
- When is estimated where
- Deriving the confidence interval for
- What is ?
- “By hand” in R
## [1] -2.014103
## [1] 2.014103
## year ## -1.87547
## year ## -0.4402103
## 2.5 % 97.5 % ## -1.8754696 -0.4402103