(numbers <- seq(from = 1, to = 10))
## [1] 1 2 3 4 5 6 7 8 9 10
# sample without replacement
rerun(5, sample(numbers, replace = FALSE))
## [[1]]
## [1] 6 4 1 10 9 7 5 2 3 8
##
## [[2]]
## [1] 9 8 7 1 4 5 3 10 6 2
##
## [[3]]
## [1] 2 4 7 1 10 8 3 5 6 9
##
## [[4]]
## [1] 4 6 3 1 7 10 5 8 2 9
##
## [[5]]
## [1] 8 6 7 5 9 3 10 1 4 2
# sample with replacement
rerun(5, sample(numbers, replace = TRUE))
## [[1]]
## [1] 5 4 2 3 10 1 5 3 5 8
##
## [[2]]
## [1] 8 10 2 9 9 10 9 1 5 3
##
## [[3]]
## [1] 6 3 1 10 4 3 7 8 1 7
##
## [[4]]
## [1] 2 3 7 2 4 10 8 5 4 8
##
## [[5]]
## [1] 3 3 4 9 9 1 10 2 1 7
caret
tidyverse
(yet)scikit-learn
for Pythontrain()
library(caret)
titanic_clean <- titanic %>%
filter(!is.na(Survived), !is.na(Age))
caret_glm <- train(Survived ~ Age, data = titanic_clean,
method = "glm",
family = binomial,
trControl = trainControl(method = "none"))
summary(caret_glm)
##
## Call:
## NULL
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.1488 -1.0361 -0.9544 1.3159 1.5908
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.05672 0.17358 -0.327 0.7438
## Age -0.01096 0.00533 -2.057 0.0397 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 964.52 on 713 degrees of freedom
## Residual deviance: 960.23 on 712 degrees of freedom
## AIC: 964.23
##
## Number of Fisher Scoring iterations: 4
age_sex_rf <- train(Survived ~ Age + Sex, data = titanic_rf_data,
method = "rf",
ntree = 200,
trControl = trainControl(method = "oob"))
## note: only 1 unique complexity parameters in default grid. Truncating the grid to 1 .
age_sex_rf
## Random Forest
##
## 714 samples
## 2 predictor
## 2 classes: 'Died', 'Survived'
##
## No pre-processing
## Resampling results:
##
## Accuracy Kappa
## 0.7492997 0.4725343
##
## Tuning parameter 'mtry' was held constant at a value of 2
train()
object## List of 24
## $ method : chr "rf"
## $ modelInfo :List of 15
## $ modelType : chr "Classification"
## $ results :'data.frame': 1 obs. of 3 variables:
## $ pred : NULL
## $ bestTune :'data.frame': 1 obs. of 1 variable:
## $ call : language train.formula(form = Survived ~ Age + Sex, data = titanic_rf_data, method = "rf", ntree = 200, trControl = t| __truncated__
## $ dots :List of 1
## $ metric : chr "Accuracy"
## $ control :List of 26
## $ finalModel :List of 23
## ..- attr(*, "class")= chr "randomForest"
## $ preProcess : NULL
## $ trainingData:Classes 'tbl_df', 'tbl' and 'data.frame': 714 obs. of 3 variables:
## $ resample : NULL
## $ resampledCM : NULL
## $ perfNames : chr [1:2] "Accuracy" "Kappa"
## $ maximize : logi TRUE
## $ yLimits : NULL
## $ times :List of 3
## $ levels : atomic [1:2] Died Survived
## ..- attr(*, "ordered")= logi FALSE
## $ terms :Classes 'terms', 'formula' language Survived ~ Age + Sex
## .. ..- attr(*, "variables")= language list(Survived, Age, Sex)
## .. ..- attr(*, "factors")= int [1:3, 1:2] 0 1 0 0 0 1
## .. .. ..- attr(*, "dimnames")=List of 2
## .. ..- attr(*, "term.labels")= chr [1:2] "Age" "Sex"
## .. ..- attr(*, "order")= int [1:2] 1 1
## .. ..- attr(*, "intercept")= int 1
## .. ..- attr(*, "response")= int 1
## .. ..- attr(*, ".Environment")=<environment: R_GlobalEnv>
## .. ..- attr(*, "predvars")= language list(Survived, Age, Sex)
## .. ..- attr(*, "dataClasses")= Named chr [1:3] "factor" "numeric" "factor"
## .. .. ..- attr(*, "names")= chr [1:3] "Survived" "Age" "Sex"
## $ coefnames : chr [1:2] "Age" "Sexmale"
## $ contrasts :List of 1
## $ xlevels :List of 1
## - attr(*, "class")= chr [1:2] "train" "train.formula"
##
## Call:
## randomForest(x = x, y = y, ntree = 200, mtry = param$mtry)
## Type of random forest: classification
## Number of trees: 200
## No. of variables tried at each split: 2
##
## OOB estimate of error rate: 24.79%
## Confusion matrix:
## Died Survived class.error
## Died 352 72 0.1698113
## Survived 105 185 0.3620690
## left daughter right daughter split var split point status prediction
## 1 2 3 Sexmale 0.500 1 <NA>
## 2 4 5 Age 3.500 1 <NA>
## 3 6 7 Age 5.500 1 <NA>
## 4 8 9 Age 1.375 1 <NA>
## 5 10 11 Age 32.250 1 <NA>
## 6 12 13 Age 0.960 1 <NA>
## 7 14 15 Age 77.000 1 <NA>
## 8 0 0 <NA> 0.000 -1 Survived
## 9 16 17 Age 2.500 1 <NA>
## 10 18 19 Age 24.500 1 <NA>
## 11 20 21 Age 38.500 1 <NA>
## 12 0 0 <NA> 0.000 -1 Survived
## 13 22 23 Age 2.000 1 <NA>
## 14 24 25 Age 50.500 1 <NA>
## 15 0 0 <NA> 0.000 -1 Survived
## 16 0 0 <NA> 0.000 -1 Died
## 17 0 0 <NA> 0.000 -1 Died
## 18 26 27 Age 5.500 1 <NA>
## 19 28 29 Age 25.500 1 <NA>
## 20 0 0 <NA> 0.000 -1 Survived
## 21 30 31 Age 50.500 1 <NA>
## 22 0 0 <NA> 0.000 -1 Survived
## 23 32 33 Age 3.500 1 <NA>
## 24 34 35 Age 47.500 1 <NA>
## 25 36 37 Age 56.500 1 <NA>
## 26 0 0 <NA> 0.000 -1 Survived
## 27 38 39 Age 12.000 1 <NA>
## 28 0 0 <NA> 0.000 -1 Died
## 29 40 41 Age 30.250 1 <NA>
## 30 42 43 Age 49.500 1 <NA>
## 31 0 0 <NA> 0.000 -1 Survived
## 32 0 0 <NA> 0.000 -1 Survived
## 33 0 0 <NA> 0.000 -1 Survived
## 34 44 45 Age 45.250 1 <NA>
## 35 46 47 Age 48.500 1 <NA>
## 36 48 49 Age 55.500 1 <NA>
## 37 0 0 <NA> 0.000 -1 Died
## 38 50 51 Age 8.500 1 <NA>
## 39 52 53 Age 19.500 1 <NA>
## 40 54 55 Age 28.500 1 <NA>
## 41 56 57 Age 31.500 1 <NA>
## 42 58 59 Age 41.500 1 <NA>
## 43 0 0 <NA> 0.000 -1 Died
## 44 60 61 Age 43.500 1 <NA>
## 45 0 0 <NA> 0.000 -1 Died
## 46 0 0 <NA> 0.000 -1 Survived
## 47 62 63 Age 49.500 1 <NA>
## 48 0 0 <NA> 0.000 -1 Died
## 49 0 0 <NA> 0.000 -1 Died
## 50 64 65 Age 6.500 1 <NA>
## 51 0 0 <NA> 0.000 -1 Died
## 52 66 67 Age 18.500 1 <NA>
## 53 68 69 Age 20.500 1 <NA>
## 54 70 71 Age 27.500 1 <NA>
## 55 72 73 Age 29.500 1 <NA>
## 56 0 0 <NA> 0.000 -1 Died
## 57 0 0 <NA> 0.000 -1 Survived
## 58 74 75 Age 39.500 1 <NA>
## 59 76 77 Age 46.000 1 <NA>
## 60 78 79 Age 32.250 1 <NA>
## 61 80 81 Age 44.500 1 <NA>
## 62 0 0 <NA> 0.000 -1 Died
## 63 0 0 <NA> 0.000 -1 Died
## 64 0 0 <NA> 0.000 -1 Died
## 65 82 83 Age 7.500 1 <NA>
## 66 84 85 Age 13.500 1 <NA>
## 67 0 0 <NA> 0.000 -1 Survived
## 68 0 0 <NA> 0.000 -1 Died
## 69 86 87 Age 22.500 1 <NA>
## 70 88 89 Age 26.500 1 <NA>
## 71 0 0 <NA> 0.000 -1 Died
## 72 0 0 <NA> 0.000 -1 Survived
## 73 0 0 <NA> 0.000 -1 Survived
## 74 0 0 <NA> 0.000 -1 Survived
## 75 90 91 Age 40.500 1 <NA>
## 76 0 0 <NA> 0.000 -1 Survived
## 77 92 93 Age 47.500 1 <NA>
## 78 94 95 Age 30.500 1 <NA>
## 79 96 97 Age 35.500 1 <NA>
## 80 0 0 <NA> 0.000 -1 Died
## 81 0 0 <NA> 0.000 -1 Survived
## 82 0 0 <NA> 0.000 -1 Survived
## 83 0 0 <NA> 0.000 -1 Survived
## 84 0 0 <NA> 0.000 -1 Survived
## 85 98 99 Age 14.500 1 <NA>
## 86 100 101 Age 21.500 1 <NA>
## 87 102 103 Age 23.500 1 <NA>
## 88 0 0 <NA> 0.000 -1 Died
## 89 0 0 <NA> 0.000 -1 Survived
## 90 0 0 <NA> 0.000 -1 Survived
## 91 0 0 <NA> 0.000 -1 Survived
## 92 0 0 <NA> 0.000 -1 Died
## 93 0 0 <NA> 0.000 -1 Survived
## 94 104 105 Age 24.500 1 <NA>
## 95 106 107 Age 31.500 1 <NA>
## 96 0 0 <NA> 0.000 -1 Died
## 97 108 109 Age 41.500 1 <NA>
## 98 0 0 <NA> 0.000 -1 Survived
## 99 110 111 Age 16.500 1 <NA>
## 100 0 0 <NA> 0.000 -1 Survived
## 101 0 0 <NA> 0.000 -1 Survived
## 102 0 0 <NA> 0.000 -1 Survived
## 103 0 0 <NA> 0.000 -1 Survived
## 104 112 113 Age 21.500 1 <NA>
## 105 114 115 Age 27.500 1 <NA>
## 106 0 0 <NA> 0.000 -1 Died
## 107 0 0 <NA> 0.000 -1 Died
## 108 116 117 Age 40.250 1 <NA>
## 109 118 119 Age 42.500 1 <NA>
## 110 120 121 Age 15.500 1 <NA>
## 111 122 123 Age 17.500 1 <NA>
## 112 124 125 Age 9.500 1 <NA>
## 113 126 127 Age 22.500 1 <NA>
## 114 128 129 Age 26.500 1 <NA>
## 115 130 131 Age 28.750 1 <NA>
## 116 132 133 Age 38.500 1 <NA>
## 117 0 0 <NA> 0.000 -1 Died
## 118 0 0 <NA> 0.000 -1 Died
## 119 0 0 <NA> 0.000 -1 Died
## 120 0 0 <NA> 0.000 -1 Survived
## 121 0 0 <NA> 0.000 -1 Survived
## 122 0 0 <NA> 0.000 -1 Survived
## 123 0 0 <NA> 0.000 -1 Survived
## 124 134 135 Age 7.500 1 <NA>
## 125 136 137 Age 15.500 1 <NA>
## 126 0 0 <NA> 0.000 -1 Died
## 127 138 139 Age 23.250 1 <NA>
## 128 140 141 Age 25.500 1 <NA>
## 129 0 0 <NA> 0.000 -1 Died
## 130 142 143 Age 28.250 1 <NA>
## 131 144 145 Age 29.500 1 <NA>
## 132 146 147 Age 36.250 1 <NA>
## 133 148 149 Age 39.500 1 <NA>
## 134 0 0 <NA> 0.000 -1 Died
## 135 150 151 Age 8.500 1 <NA>
## 136 0 0 <NA> 0.000 -1 Died
## 137 152 153 Age 20.250 1 <NA>
## 138 0 0 <NA> 0.000 -1 Died
## 139 154 155 Age 23.750 1 <NA>
## 140 0 0 <NA> 0.000 -1 Died
## 141 0 0 <NA> 0.000 -1 Died
## 142 0 0 <NA> 0.000 -1 Died
## 143 0 0 <NA> 0.000 -1 Died
## 144 0 0 <NA> 0.000 -1 Died
## 145 0 0 <NA> 0.000 -1 Died
## 146 0 0 <NA> 0.000 -1 Died
## 147 156 157 Age 37.500 1 <NA>
## 148 0 0 <NA> 0.000 -1 Died
## 149 0 0 <NA> 0.000 -1 Died
## 150 0 0 <NA> 0.000 -1 Died
## 151 0 0 <NA> 0.000 -1 Survived
## 152 158 159 Age 18.500 1 <NA>
## 153 160 161 Age 20.750 1 <NA>
## 154 0 0 <NA> 0.000 -1 Died
## 155 0 0 <NA> 0.000 -1 Died
## 156 0 0 <NA> 0.000 -1 Died
## 157 0 0 <NA> 0.000 -1 Died
## 158 162 163 Age 17.500 1 <NA>
## 159 164 165 Age 19.500 1 <NA>
## 160 0 0 <NA> 0.000 -1 Died
## 161 0 0 <NA> 0.000 -1 Died
## 162 166 167 Age 16.500 1 <NA>
## 163 0 0 <NA> 0.000 -1 Died
## 164 0 0 <NA> 0.000 -1 Died
## 165 0 0 <NA> 0.000 -1 Died
## 166 0 0 <NA> 0.000 -1 Died
## 167 0 0 <NA> 0.000 -1 Died
\[MSE = \frac{1}{n} \sum_{i = 1}^{n}{(y_i - \hat{f}(x_i))^2}\]
set.seed(1234)
auto_split <- resample_partition(Auto, c(test = 0.5, train = 0.5))
auto_train <- as_tibble(auto_split$train)
auto_test <- as_tibble(auto_split$test)
auto_lm <- glm(mpg ~ horsepower, data = auto_train)
summary(auto_lm)
##
## Call:
## glm(formula = mpg ~ horsepower, data = auto_train)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -12.892 -2.864 -0.545 2.793 13.298
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 38.005404 0.921129 41.26 <2e-16 ***
## horsepower -0.140459 0.007968 -17.63 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 20.48452)
##
## Null deviance: 10359.4 on 196 degrees of freedom
## Residual deviance: 3994.5 on 195 degrees of freedom
## AIC: 1157.9
##
## Number of Fisher Scoring iterations: 2
mse(auto_lm, auto_test)
## [1] 28.57255
survive_age_woman_x <- glm(Survived ~ Age * Sex, data = titanic,
family = binomial)
summary(survive_age_woman_x)
##
## Call:
## glm(formula = Survived ~ Age * Sex, family = binomial, data = titanic)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.9401 -0.7136 -0.5883 0.7626 2.2455
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.59380 0.31032 1.913 0.05569 .
## Age 0.01970 0.01057 1.863 0.06240 .
## Sexmale -1.31775 0.40842 -3.226 0.00125 **
## Age:Sexmale -0.04112 0.01355 -3.034 0.00241 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 964.52 on 713 degrees of freedom
## Residual deviance: 740.40 on 710 degrees of freedom
## (177 observations deleted due to missingness)
## AIC: 748.4
##
## Number of Fisher Scoring iterations: 4
titanic_split <- resample_partition(titanic, c(test = 0.3, train = 0.7))
map(titanic_split, dim)
## $test
## [1] 267 12
##
## $train
## [1] 624 12
train_model <- glm(Survived ~ Age * Sex, data = titanic_split$train,
family = binomial)
summary(train_model)
##
## Call:
## glm(formula = Survived ~ Age * Sex, family = binomial, data = titanic_split$train)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.0901 -0.6520 -0.6507 0.7352 1.8223
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.37929 0.35668 1.063 0.287607
## Age 0.02957 0.01287 2.297 0.021612 *
## Sexmale -1.82897 0.49728 -3.678 0.000235 ***
## Age:Sexmale -0.02931 0.01642 -1.785 0.074193 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 667.64 on 491 degrees of freedom
## Residual deviance: 500.14 on 488 degrees of freedom
## (132 observations deleted due to missingness)
## AIC: 508.14
##
## Number of Fisher Scoring iterations: 4
x_test_accuracy <- titanic_split$test %>%
as_tibble() %>%
add_predictions(train_model) %>%
mutate(pred = logit2prob(pred),
pred = as.numeric(pred > .5))
mean(x_test_accuracy$Survived != x_test_accuracy$pred, na.rm = TRUE)
## [1] 0.2387387
\[CV_{(n)} = \frac{1}{n} \sum_{i = 1}^{n}{MSE_i}\]
(loocv_data <- crossv_kfold(Auto, k = nrow(Auto)))
## # A tibble: 392 x 3
## train test .id
## <list> <list> <chr>
## 1 <S3: resample> <S3: resample> 001
## 2 <S3: resample> <S3: resample> 002
## 3 <S3: resample> <S3: resample> 003
## 4 <S3: resample> <S3: resample> 004
## 5 <S3: resample> <S3: resample> 005
## 6 <S3: resample> <S3: resample> 006
## 7 <S3: resample> <S3: resample> 007
## 8 <S3: resample> <S3: resample> 008
## 9 <S3: resample> <S3: resample> 009
## 10 <S3: resample> <S3: resample> 010
## # ... with 382 more rows
(loocv_models <- map(loocv_data$train, ~ lm(mpg ~ horsepower, data = .)))
## $`1`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8759 -0.1574
##
##
## $`2`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9329 -0.1578
##
##
## $`3`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9261 -0.1578
##
##
## $`4`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8891 -0.1575
##
##
## $`5`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8551 -0.1573
##
##
## $`6`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9366 -0.1578
##
##
## $`7`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.7980 -0.1568
##
##
## $`8`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9336 -0.1578
##
##
## $`9`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8643 -0.1574
##
##
## $`10`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9345 -0.1578
##
##
## $`11`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9170 -0.1577
##
##
## $`12`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9351 -0.1578
##
##
## $`13`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9322 -0.1578
##
##
## $`14`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9400 -0.1578
##
##
## $`15`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9383 -0.1579
##
##
## $`16`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8884 -0.1575
##
##
## $`17`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9319 -0.1579
##
##
## $`18`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8823 -0.1575
##
##
## $`19`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9226 -0.1576
##
##
## $`20`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8868 -0.1575
##
##
## $`21`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.968 -0.158
##
##
## $`22`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.963 -0.158
##
##
## $`23`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9532 -0.1581
##
##
## $`24`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9523 -0.1579
##
##
## $`25`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.957 -0.158
##
##
## $`26`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.946 -0.158
##
##
## $`27`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.971 -0.158
##
##
## $`28`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8616 -0.1573
##
##
## $`29`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9137 -0.1577
##
##
## $`30`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9230 -0.1577
##
##
## $`31`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9307 -0.1578
##
##
## $`32`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9429 -0.1578
##
##
## $`33`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9234 -0.1578
##
##
## $`34`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 40.0854 -0.1595
##
##
## $`35`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9453 -0.1579
##
##
## $`36`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9447 -0.1579
##
##
## $`37`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.962 -0.158
##
##
## $`38`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9247 -0.1578
##
##
## $`39`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9445 -0.1578
##
##
## $`40`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9505 -0.1579
##
##
## $`41`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9362 -0.1579
##
##
## $`42`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.976 -0.158
##
##
## $`43`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9084 -0.1577
##
##
## $`44`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8647 -0.1573
##
##
## $`45`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9215 -0.1576
##
##
## $`46`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9680 -0.1581
##
##
## $`47`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9682 -0.1581
##
##
## $`48`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9220 -0.1578
##
##
## $`49`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 40.0504 -0.1586
##
##
## $`50`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9148 -0.1577
##
##
## $`51`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9330 -0.1578
##
##
## $`52`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9320 -0.1578
##
##
## $`53`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9257 -0.1578
##
##
## $`54`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9532 -0.1579
##
##
## $`55`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9477 -0.1578
##
##
## $`56`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9431 -0.1579
##
##
## $`57`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 40.0019 -0.1586
##
##
## $`58`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 40.0279 -0.1589
##
##
## $`59`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9603 -0.1581
##
##
## $`60`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.949 -0.158
##
##
## $`61`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9241 -0.1578
##
##
## $`62`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9464 -0.1579
##
##
## $`63`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9430 -0.1578
##
##
## $`64`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9093 -0.1577
##
##
## $`65`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9205 -0.1577
##
##
## $`66`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9035 -0.1576
##
##
## $`67`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8583 -0.1573
##
##
## $`68`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9293 -0.1578
##
##
## $`69`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8952 -0.1576
##
##
## $`70`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9520 -0.1579
##
##
## $`71`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9566 -0.1579
##
##
## $`72`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9347 -0.1578
##
##
## $`73`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9375 -0.1578
##
##
## $`74`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9536 -0.1581
##
##
## $`75`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8909 -0.1575
##
##
## $`76`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 40.0066 -0.1583
##
##
## $`77`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.966 -0.158
##
##
## $`78`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9433 -0.1579
##
##
## $`79`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9326 -0.1578
##
##
## $`80`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8918 -0.1576
##
##
## $`81`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9076 -0.1577
##
##
## $`82`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9346 -0.1578
##
##
## $`83`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9150 -0.1577
##
##
## $`84`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9387 -0.1579
##
##
## $`85`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8433 -0.1572
##
##
## $`86`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9680 -0.1582
##
##
## $`87`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8732 -0.1574
##
##
## $`88`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9817 -0.1581
##
##
## $`89`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9216 -0.1577
##
##
## $`90`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9346 -0.1578
##
##
## $`91`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9402 -0.1578
##
##
## $`92`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9188 -0.1577
##
##
## $`93`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9219 -0.1578
##
##
## $`94`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9361 -0.1578
##
##
## $`95`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9283 -0.1578
##
##
## $`96`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 40.0504 -0.1586
##
##
## $`97`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9682 -0.1581
##
##
## $`98`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9583 -0.1581
##
##
## $`99`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8956 -0.1577
##
##
## $`100`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9165 -0.1576
##
##
## $`101`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9230 -0.1577
##
##
## $`102`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8700 -0.1574
##
##
## $`103`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8627 -0.1573
##
##
## $`104`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 40.0605 -0.1592
##
##
## $`105`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9532 -0.1579
##
##
## $`106`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9035 -0.1576
##
##
## $`107`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9287 -0.1577
##
##
## $`108`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9306 -0.1578
##
##
## $`109`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9444 -0.1579
##
##
## $`110`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9461 -0.1579
##
##
## $`111`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9019 -0.1576
##
##
## $`112`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9112 -0.1577
##
##
## $`113`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9429 -0.1579
##
##
## $`114`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9321 -0.1579
##
##
## $`115`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9438 -0.1578
##
##
## $`116`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8735 -0.1574
##
##
## $`117`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9527 -0.1579
##
##
## $`118`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9419 -0.1579
##
##
## $`119`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9226 -0.1576
##
##
## $`120`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9271 -0.1577
##
##
## $`121`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8916 -0.1576
##
##
## $`122`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 40.0000 -0.1586
##
##
## $`123`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 40.0085 -0.1587
##
##
## $`124`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9540 -0.1578
##
##
## $`125`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9411 -0.1579
##
##
## $`126`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9194 -0.1577
##
##
## $`127`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 40.1919 -0.1606
##
##
## $`128`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 40.0240 -0.1585
##
##
## $`129`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9389 -0.1578
##
##
## $`130`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.945 -0.158
##
##
## $`131`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9360 -0.1578
##
##
## $`132`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9524 -0.1579
##
##
## $`133`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8775 -0.1575
##
##
## $`134`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9461 -0.1578
##
##
## $`135`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9088 -0.1577
##
##
## $`136`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9310 -0.1578
##
##
## $`137`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9157 -0.1576
##
##
## $`138`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9188 -0.1577
##
##
## $`139`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9429 -0.1579
##
##
## $`140`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9804 -0.1581
##
##
## $`141`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9491 -0.1578
##
##
## $`142`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8801 -0.1576
##
##
## $`143`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.970 -0.158
##
##
## $`144`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9363 -0.1578
##
##
## $`145`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9229 -0.1577
##
##
## $`146`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9329 -0.1578
##
##
## $`147`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8550 -0.1573
##
##
## $`148`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9285 -0.1578
##
##
## $`149`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9482 -0.1579
##
##
## $`150`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.952 -0.158
##
##
## $`151`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9287 -0.1577
##
##
## $`152`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9235 -0.1576
##
##
## $`153`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9422 -0.1578
##
##
## $`154`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.971 -0.158
##
##
## $`155`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9220 -0.1577
##
##
## $`156`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9699 -0.1581
##
##
## $`157`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9321 -0.1578
##
##
## $`158`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9612 -0.1579
##
##
## $`159`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9998 -0.1583
##
##
## $`160`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9356 -0.1578
##
##
## $`161`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9420 -0.1578
##
##
## $`162`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.969 -0.158
##
##
## $`163`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9566 -0.1579
##
##
## $`164`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9441 -0.1579
##
##
## $`165`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9441 -0.1579
##
##
## $`166`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9367 -0.1579
##
##
## $`167`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9348 -0.1578
##
##
## $`168`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9618 -0.1579
##
##
## $`169`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9133 -0.1577
##
##
## $`170`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8731 -0.1574
##
##
## $`171`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.966 -0.158
##
##
## $`172`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 40.1249 -0.1599
##
##
## $`173`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9173 -0.1576
##
##
## $`174`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 40.1249 -0.1599
##
##
## $`175`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9120 -0.1577
##
##
## $`176`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9484 -0.1579
##
##
## $`177`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.7873 -0.1567
##
##
## $`178`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9427 -0.1579
##
##
## $`179`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8929 -0.1576
##
##
## $`180`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9268 -0.1576
##
##
## $`181`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8772 -0.1575
##
##
## $`182`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.968 -0.158
##
##
## $`183`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.975 -0.158
##
##
## $`184`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9362 -0.1578
##
##
## $`185`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9374 -0.1578
##
##
## $`186`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9230 -0.1577
##
##
## $`187`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.7826 -0.1567
##
##
## $`188`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 40.0346 -0.1586
##
##
## $`189`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9445 -0.1578
##
##
## $`190`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 40.0783 -0.1594
##
##
## $`191`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9213 -0.1578
##
##
## $`192`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.964 -0.158
##
##
## $`193`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9210 -0.1576
##
##
## $`194`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9399 -0.1579
##
##
## $`195`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9085 -0.1577
##
##
## $`196`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9287 -0.1577
##
##
## $`197`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9300 -0.1578
##
##
## $`198`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9497 -0.1579
##
##
## $`199`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9349 -0.1578
##
##
## $`200`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.975 -0.158
##
##
## $`201`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9375 -0.1578
##
##
## $`202`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9324 -0.1578
##
##
## $`203`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9241 -0.1578
##
##
## $`204`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8866 -0.1575
##
##
## $`205`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9309 -0.1577
##
##
## $`206`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9490 -0.1579
##
##
## $`207`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9354 -0.1578
##
##
## $`208`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9618 -0.1579
##
##
## $`209`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9412 -0.1579
##
##
## $`210`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9566 -0.1579
##
##
## $`211`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9399 -0.1578
##
##
## $`212`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9673 -0.1581
##
##
## $`213`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.960 -0.158
##
##
## $`214`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9548 -0.1579
##
##
## $`215`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9816 -0.1581
##
##
## $`216`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9299 -0.1578
##
##
## $`217`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9147 -0.1577
##
##
## $`218`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8975 -0.1576
##
##
## $`219`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9279 -0.1578
##
##
## $`220`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9578 -0.1579
##
##
## $`221`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9379 -0.1579
##
##
## $`222`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9450 -0.1579
##
##
## $`223`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 40.0071 -0.1586
##
##
## $`224`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9262 -0.1578
##
##
## $`225`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9341 -0.1579
##
##
## $`226`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.969 -0.158
##
##
## $`227`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9326 -0.1579
##
##
## $`228`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.7714 -0.1567
##
##
## $`229`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9347 -0.1577
##
##
## $`230`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.967 -0.158
##
##
## $`231`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9106 -0.1577
##
##
## $`232`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9427 -0.1579
##
##
## $`233`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9165 -0.1576
##
##
## $`234`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9344 -0.1578
##
##
## $`235`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9842 -0.1584
##
##
## $`236`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 40.0240 -0.1585
##
##
## $`237`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9379 -0.1579
##
##
## $`238`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9247 -0.1577
##
##
## $`239`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8277 -0.1571
##
##
## $`240`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9344 -0.1578
##
##
## $`241`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9086 -0.1577
##
##
## $`242`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9633 -0.1579
##
##
## $`243`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9339 -0.1578
##
##
## $`244`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.931 -0.158
##
##
## $`245`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9356 -0.1578
##
##
## $`246`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.954 -0.158
##
##
## $`247`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9261 -0.1577
##
##
## $`248`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.956 -0.158
##
##
## $`249`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9349 -0.1578
##
##
## $`250`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9427 -0.1578
##
##
## $`251`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9491 -0.1578
##
##
## $`252`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9412 -0.1579
##
##
## $`253`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.946 -0.158
##
##
## $`254`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9366 -0.1578
##
##
## $`255`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8784 -0.1574
##
##
## $`256`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9084 -0.1577
##
##
## $`257`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9474 -0.1579
##
##
## $`258`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9630 -0.1582
##
##
## $`259`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9287 -0.1577
##
##
## $`260`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8733 -0.1574
##
##
## $`261`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9148 -0.1577
##
##
## $`262`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 40.1008 -0.1596
##
##
## $`263`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9261 -0.1577
##
##
## $`264`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.957 -0.158
##
##
## $`265`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9230 -0.1578
##
##
## $`266`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9448 -0.1579
##
##
## $`267`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9540 -0.1578
##
##
## $`268`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9340 -0.1578
##
##
## $`269`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8547 -0.1573
##
##
## $`270`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8864 -0.1575
##
##
## $`271`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9360 -0.1578
##
##
## $`272`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9478 -0.1579
##
##
## $`273`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9294 -0.1578
##
##
## $`274`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9532 -0.1579
##
##
## $`275`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9392 -0.1578
##
##
## $`276`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9171 -0.1575
##
##
## $`277`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.953 -0.158
##
##
## $`278`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9352 -0.1578
##
##
## $`279`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8312 -0.1572
##
##
## $`280`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9491 -0.1578
##
##
## $`281`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8943 -0.1576
##
##
## $`282`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9433 -0.1578
##
##
## $`283`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9368 -0.1579
##
##
## $`284`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9599 -0.1579
##
##
## $`285`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.945 -0.158
##
##
## $`286`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9064 -0.1578
##
##
## $`287`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9688 -0.1585
##
##
## $`288`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9338 -0.1579
##
##
## $`289`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9804 -0.1581
##
##
## $`290`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9758 -0.1583
##
##
## $`291`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9743 -0.1581
##
##
## $`292`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9247 -0.1577
##
##
## $`293`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 40.0068 -0.1586
##
##
## $`294`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8807 -0.1576
##
##
## $`295`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9532 -0.1579
##
##
## $`296`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.965 -0.158
##
##
## $`297`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9205 -0.1577
##
##
## $`298`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.969 -0.158
##
##
## $`299`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8550 -0.1573
##
##
## $`300`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.7941 -0.1568
##
##
## $`301`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9241 -0.1578
##
##
## $`302`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9345 -0.1577
##
##
## $`303`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9498 -0.1579
##
##
## $`304`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9346 -0.1578
##
##
## $`305`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9383 -0.1579
##
##
## $`306`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9498 -0.1579
##
##
## $`307`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9391 -0.1579
##
##
## $`308`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9532 -0.1581
##
##
## $`309`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9454 -0.1579
##
##
## $`310`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9422 -0.1579
##
##
## $`311`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9025 -0.1577
##
##
## $`312`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9182 -0.1577
##
##
## $`313`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9570 -0.1579
##
##
## $`314`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9287 -0.1578
##
##
## $`315`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9410 -0.1578
##
##
## $`316`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9306 -0.1578
##
##
## $`317`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9299 -0.1578
##
##
## $`318`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9173 -0.1576
##
##
## $`319`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9993 -0.1583
##
##
## $`320`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9273 -0.1577
##
##
## $`321`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9401 -0.1579
##
##
## $`322`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.944 -0.158
##
##
## $`323`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9689 -0.1581
##
##
## $`324`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9146 -0.1577
##
##
## $`325`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8451 -0.1572
##
##
## $`326`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9249 -0.1578
##
##
## $`327`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9063 -0.1577
##
##
## $`328`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9230 -0.1577
##
##
## $`329`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9173 -0.1576
##
##
## $`330`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9173 -0.1576
##
##
## $`331`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9764 -0.1582
##
##
## $`332`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9391 -0.1579
##
##
## $`333`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9913 -0.1582
##
##
## $`334`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9363 -0.1578
##
##
## $`335`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9322 -0.1577
##
##
## $`336`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9285 -0.1577
##
##
## $`337`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9901 -0.1581
##
##
## $`338`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9399 -0.1579
##
##
## $`339`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.961 -0.158
##
##
## $`340`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9287 -0.1577
##
##
## $`341`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9331 -0.1578
##
##
## $`342`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9727 -0.1581
##
##
## $`343`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9293 -0.1578
##
##
## $`344`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9394 -0.1579
##
##
## $`345`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9336 -0.1579
##
##
## $`346`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9349 -0.1578
##
##
## $`347`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9633 -0.1579
##
##
## $`348`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9344 -0.1578
##
##
## $`349`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9380 -0.1579
##
##
## $`350`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9200 -0.1577
##
##
## $`351`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8908 -0.1575
##
##
## $`352`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.964 -0.158
##
##
## $`353`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9916 -0.1585
##
##
## $`354`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9301 -0.1577
##
##
## $`355`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9292 -0.1578
##
##
## $`356`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9767 -0.1581
##
##
## $`357`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.961 -0.158
##
##
## $`358`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9349 -0.1578
##
##
## $`359`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9152 -0.1577
##
##
## $`360`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9250 -0.1578
##
##
## $`361`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8863 -0.1576
##
##
## $`362`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9287 -0.1577
##
##
## $`363`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9258 -0.1578
##
##
## $`364`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.7933 -0.1569
##
##
## $`365`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9287 -0.1577
##
##
## $`366`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9337 -0.1578
##
##
## $`367`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9461 -0.1578
##
##
## $`368`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9059 -0.1574
##
##
## $`369`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9398 -0.1578
##
##
## $`370`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9306 -0.1578
##
##
## $`371`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9195 -0.1576
##
##
## $`372`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9326 -0.1578
##
##
## $`373`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9303 -0.1578
##
##
## $`374`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9429 -0.1579
##
##
## $`375`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9230 -0.1577
##
##
## $`376`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8660 -0.1575
##
##
## $`377`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.960 -0.158
##
##
## $`378`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.952 -0.158
##
##
## $`379`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9221 -0.1577
##
##
## $`380`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9230 -0.1577
##
##
## $`381`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9581 -0.1579
##
##
## $`382`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8929 -0.1575
##
##
## $`383`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9526 -0.1579
##
##
## $`384`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9306 -0.1578
##
##
## $`385`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9451 -0.1579
##
##
## $`386`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9383 -0.1578
##
##
## $`387`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8899 -0.1575
##
##
## $`388`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9307 -0.1578
##
##
## $`389`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9344 -0.1579
##
##
## $`390`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.8443 -0.1572
##
##
## $`391`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9667 -0.1579
##
##
## $`392`
##
## Call:
## lm(formula = mpg ~ horsepower, data = .)
##
## Coefficients:
## (Intercept) horsepower
## 39.9860 -0.1584
(loocv_mse <- map2_dbl(loocv_models, loocv_data$test, mse))
## 1 2 3 4 5
## 3.213342e+01 2.020010e+00 1.250857e+00 2.849248e+01 6.484768e+01
## 6 7 8 9 10
## 9.584908e-03 1.172437e+02 1.759818e-01 6.139599e+01 7.341613e-02
## 11 12 13 14 15
## 7.297568e+00 8.428034e+00 3.924368e+00 7.181963e+00 3.926033e-01
## 16 17 18 19 20
## 2.241539e+01 1.529641e+01 3.580449e+01 4.146999e+01 4.490646e+01
## 21 22 23 24 25
## 3.437743e+01 9.357612e+00 2.910330e+00 1.483044e+01 9.995138e+00
## 26 27 28 29 30
## 4.679773e+00 3.291832e+01 6.880037e+01 7.917981e+00 5.166911e+00
## 31 32 33 34 35
## 2.613037e-01 8.233947e+00 6.724508e+00 6.075519e+01 3.367885e+00
## 36 37 38 39 40
## 5.377148e-01 1.914019e+01 2.069744e+01 3.122004e+01 4.656941e+00
## 41 42 43 44 45
## 1.103363e-02 6.009991e+01 9.782282e+00 5.420830e+01 1.874967e+01
## 46 47 48 49 50
## 1.403014e+01 1.692639e+01 7.171493e+00 1.857938e+02 5.330425e+00
## 51 52 53 54 55
## 3.451690e-01 2.871244e-01 1.907775e+00 2.667455e+01 5.764925e+01
## 56 57 58 59 60
## 4.652496e+00 2.634304e+01 4.135667e+01 2.767354e+00 5.083533e+00
## 61 62 63 64 65
## 5.183800e+00 2.165397e+00 2.102111e+01 1.616981e+01 2.715686e+00
## 66 67 68 69 70
## 1.478994e+01 5.766164e+01 1.622758e+00 2.147951e+01 5.366573e+00
## 71 72 73 74 75
## 3.803600e+01 1.017226e+00 1.157220e+00 3.674287e+00 2.422052e+01
## 76 77 78 79 80
## 9.332138e+01 2.724249e+01 2.056389e+00 7.082556e-01 6.365750e+01
## 81 82 83 84 85
## 1.042080e+01 1.837023e-01 1.111564e+01 5.283052e-01 1.115532e+02
## 86 87 88 89 90
## 1.476578e+01 5.106756e+01 3.555996e+01 4.046029e+00 1.150586e-01
## 91 92 93 94 95
## 4.209601e+00 2.074089e+00 4.719855e+00 3.006473e-02 8.090347e-01
## 96 97 98 99 100
## 1.857938e+02 1.692639e+01 5.865479e+00 6.072868e+01 1.656735e+01
## 101 102 103 104 105
## 5.166911e+00 5.005465e+01 5.720928e+01 5.141271e+01 2.667455e+01
## 106 107 108 109 110
## 1.696762e+01 1.605078e+00 9.165497e-01 2.403135e+00 6.926842e+00
## 111 112 113 114 115
## 1.866232e+01 7.038055e+00 4.826153e-01 5.921415e+00 2.586927e+01
## 116 117 118 119 120
## 6.295836e+01 9.331482e+00 2.464358e+00 4.146999e+01 2.110725e+00
## 121 122 123 124 125
## 3.164374e+01 1.583746e+01 3.181246e+01 5.447911e+01 8.994396e-01
## 126 127 128 129 130
## 3.262850e+00 1.625041e+02 4.531854e+01 3.912844e+00 1.250924e+00
## 131 132 133 134 135
## 8.093849e-02 7.440905e+00 8.749214e+01 4.342942e+01 1.128019e+01
## 136 137 138 139 140
## 4.819221e-01 7.300693e+00 2.074089e+00 4.826153e-01 6.512312e+01
## 141 142 143 144 145
## 2.890009e+01 1.349922e+02 4.421187e+01 2.643188e-02 1.166297e+00
## 146 147 148 149 150
## 5.171868e-01 7.539327e+01 6.423470e-01 1.340184e+01 4.435387e+00
## 151 152 153 154 155
## 1.605078e+00 4.352799e+01 1.667557e+01 4.555565e+01 2.529958e+00
## 156 157 158 159 160
## 2.154283e+01 4.106222e-01 3.548262e+01 5.782504e+01 3.546176e-03
## 161 162 163 164 165
## 1.586678e+01 4.030122e+01 3.803600e+01 3.786435e+00 3.786435e+00
## 166 167 168 169 170
## 1.033653e+01 2.749188e-02 4.412290e+01 5.458248e+00 4.376707e+01
## 171 172 173 174 175
## 3.302308e+01 9.704988e+01 1.075349e+01 9.704988e+01 7.748422e+00
## 176 177 178 179 180
## 8.694181e+00 1.528278e+02 2.011132e+00 4.472444e+01 1.964564e+01
## 181 182 183 184 185
## 7.092852e+01 5.566352e+01 4.994053e+01 6.653002e-02 2.048085e-01
## 186 187 188 189 190
## 5.166911e+00 1.449052e+02 7.175958e+01 3.122004e+01 6.714948e+01
## 191 192 193 194 195
## 5.432293e+00 3.122569e+01 1.486748e+01 8.895572e-01 1.014678e+01
## 196 197 198 199 200
## 7.581236e+00 2.813085e-01 9.653262e+00 1.066789e-02 4.994053e+01
## 201 202 203 204 205
## 1.157220e+00 5.561744e-01 5.183800e+00 2.174016e+01 5.880433e+00
## 206 207 208 209 210
## 2.358597e+00 4.636272e-01 4.412290e+01 2.324873e-01 3.803600e+01
## 211 212 213 214 215
## 6.654632e+00 1.140456e+01 2.250222e+01 1.982618e+01 5.690043e+01
## 216 217 218 219 220
## 4.133647e-01 8.334101e+00 2.269988e+01 1.053729e+01 3.180794e+01
## 221 222 223 224 225
## 1.511906e-01 1.723940e+00 1.679054e+01 2.702564e+00 1.432359e+01
## 226 227 228 229 230
## 3.677007e+01 2.530169e+01 2.894490e+02 2.032089e+01 2.892397e+01
## 231 232 233 234 235
## 1.033955e+01 1.457053e+00 1.656735e+01 6.799020e-02 1.140418e+01
## 236 237 238 239 240
## 4.531854e+01 1.724878e-01 3.231044e+00 1.250516e+02 6.799020e-02
## 241 242 243 244 245
## 2.020818e+01 6.679005e+01 1.264151e-01 4.949936e+01 3.546176e-03
## 246 247 248 249 250
## 5.717027e+00 4.241411e+00 1.136904e+01 1.066789e-02 7.668633e+00
## 251 252 253 254 255
## 2.890009e+01 2.324873e-01 3.068052e+00 9.584908e-03 2.758466e+01
## 256 257 258 259 260
## 8.728675e+00 1.478825e+01 8.566786e+00 1.605078e+00 6.048098e+01
## 261 262 263 264 265
## 1.666316e+01 8.137554e+01 4.241411e+00 1.411405e+01 1.771618e+00
## 266 267 268 269 270
## 3.009836e+00 5.447911e+01 1.497268e-01 5.899216e+01 3.180083e+01
## 271 272 273 274 275
## 3.393771e-02 2.657232e+00 2.299575e-01 2.667455e+01 1.864996e+00
## 276 277 278 279 280
## 2.362534e+01 4.326951e+00 8.472761e-03 1.853442e+02 2.890009e+01
## 281 282 283 284 285
## 1.990884e+01 1.519954e+01 1.198846e-02 5.140783e+01 2.073870e+00
## 286 287 288 289 290
## 7.693554e+01 1.863862e+02 1.040145e+01 6.512312e+01 9.620669e+00
## 291 292 293 294 295
## 4.018772e+01 3.231044e+00 1.853546e+01 9.969267e+01 2.667455e+01
## 296 297 298 299 300
## 4.843384e+01 2.715686e+00 3.065622e+01 7.539327e+01 1.238847e+02
## 301 302 303 304 305
## 5.183800e+00 3.036942e+01 1.732348e+01 1.150586e-01 3.926033e-01
## 306 307 308 309 310
## 1.732348e+01 7.861988e+00 2.910330e+00 1.146842e+01 2.654407e+00
## 311 312 313 314 315
## 2.852183e+01 2.898726e+00 2.454227e+01 8.211334e-01 1.822059e+01
## 316 317 318 319 320
## 9.165497e-01 4.133647e-01 1.075349e+01 3.601165e+01 4.129160e+00
## 321 322 323 324 325
## 5.556481e-01 4.905186e+00 7.551530e+00 7.680024e+00 8.493035e+01
## 326 327 328 329 330
## 6.586063e+00 5.236824e+01 5.166911e+00 1.075349e+01 1.075349e+01
## 331 332 333 334 335
## 1.041250e+01 6.160147e-01 4.355852e+01 5.953056e-03 1.034145e+01
## 336 337 338 339 340
## 2.423504e+00 8.006204e+01 8.895572e-01 8.410440e+00 1.605078e+00
## 341 342 343 344 345
## 8.941908e-02 1.215199e+01 1.622758e+00 1.235372e-01 2.047146e+00
## 346 347 348 349 350
## 1.294907e-02 6.679005e+01 6.799020e-02 2.061807e-01 4.278732e+00
## 351 352 353 354 355
## 2.638785e+01 3.075798e+01 2.538815e+01 2.758083e+00 5.999879e-01
## 356 357 358 359 360
## 4.543656e+01 1.480422e+01 1.294907e-02 4.559232e+00 3.843146e+00
## 361 362 363 364 365
## 8.066902e+01 3.408942e+00 6.666276e+00 2.345776e+02 1.605078e+00
## 366 367 368 369 370
## 5.072715e-02 1.741235e+01 2.800088e+01 1.066612e+01 9.165497e-01
## 371 372 373 374 375
## 6.186339e+00 2.754308e-01 6.313349e-01 4.826153e-01 5.166911e+00
## 376 377 378 379 380
## 1.326611e+02 9.672737e+00 4.435387e+00 6.707682e+00 5.166911e+00
## 381 382 383 384 385
## 3.579356e+01 1.977894e+01 1.049286e+01 9.165497e-01 6.118529e+00
## 386 387 388 389 390
## 2.487076e+00 2.255236e+01 4.707417e-01 8.639328e-01 7.008530e+01
## 391 392
## 8.418264e+01 2.054254e+01
mean(loocv_mse)
## [1] 24.23151
titanic_loocv <- crossv_kfold(titanic, k = nrow(titanic))
titanic_models <- map(titanic_loocv$train, ~ glm(Survived ~ Age * Sex,
data = .,
family = binomial))
titanic_mse <- map2_dbl(titanic_models, titanic_loocv$test, mse.glm)
mean(titanic_mse, na.rm = TRUE)
## [1] 0.1703518
\[CV_{(k)} = \frac{1}{k} \sum_{i = 1}^{k}{MSE_i}\]
cv10_data <- crossv_kfold(Auto, k = 10)
titanic_kfold <- crossv_kfold(titanic, k = 10)
titanic_models <- map(titanic_kfold$train, ~ glm(Survived ~ Age * Sex,
data = .,
family = binomial))
titanic_mse <- map2_dbl(titanic_models, titanic_kfold$test, mse.glm)
mean(titanic_mse, na.rm = TRUE)
## [1] 0.1709727