Đánh giá và chọn mô hình

Mô hình hóa với dữ liệu trong Tidyverse

Albert Y. Kim

Assistant Professor of Statistical and Data Sciences

Ôn tập: Hồi quy bội

Hai mô hình với các cặp biến giải thích/dự báo khác nhau:

# Model 1 - Hai biến số:
model_price_1 <- lm(log10_price ~ log10_size + yr_built, 
                    data = house_prices)

# Model 3 - Một biến số & một biến phân loại: model_price_3 <- lm(log10_price ~ log10_size + condition, data = house_prices)
Mô hình hóa với dữ liệu trong Tidyverse

Ôn tập: Tổng bình phương phần dư

Mô hình hóa với dữ liệu trong Tidyverse

Ôn tập: Tổng bình phương phần dư

# Model 1
model_price_1 <- lm(log10_price ~ log10_size + yr_built, 
                    data = house_prices)
get_regression_points(model_price_1) %>%
  mutate(sq_residuals = residual^2) %>%
  summarize(sum_sq_residuals = sum(sq_residuals))
# A tibble: 1 x 1
  sum_sq_residuals
             <dbl>
1             585.
Mô hình hóa với dữ liệu trong Tidyverse

Ôn tập: Tổng bình phương phần dư

# Model 3
model_price_3 <- lm(log10_price ~ log10_size + condition, 
                    data = house_prices)

get_regression_points(model_price_3) %>%
  mutate(sq_residuals = residual^2) %>%
  summarize(sum_sq_residuals = sum(sq_residuals))
# A tibble: 1 x 1
  sum_sq_residuals
             <dbl>
1             608.
Mô hình hóa với dữ liệu trong Tidyverse

Cùng luyện tập nào!

Mô hình hóa với dữ liệu trong Tidyverse

Preparing Video For Download...