快速浏览模型拟合情况
在本练习中,您将使用 glance() 来计算每个国家的线性模型对数据的拟合优度。
本练习是课程的一部分
Tidyverse 中的机器学习
练习说明
- 在
gap_models数据框中追加一列(fit),包含每个模型的拟合统计量,并将结果保存为model_perf_nested。 - 使用
unnest()展开该数据框,提取各模型的拟合统计量,并将结果保存为model_perf。 - 最后,使用
head()快速查看model_perf。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Extract the fit statistics of each model into data frames
model_perf_nested <- gap_models %>%
mutate(fit = map(model, ~___(.x)))
# Simplify the fit data frames for each model
model_perf <- model_perf_nested %>%
unnest(___)
# Look at the first six rows of model_perf
head(___)