Question: In a case like this, I can also use the handy modelr::gather_predictions function - this is, essentially, a short way of adding predictions for several

In a case like this, I can also use the handy modelr::gather_predictions function - this is, essentially, a short way of adding predictions for several models to a data frame and then "pivoting" so the result is a tidy, "long" dataset that's easily plottable. train_df |> gather_predictions(linear_mod, smooth_mod, wiggly_mod) |> mutate(model = fct_inorder(model)) |> ggplot(aes(x = range, y = logratio)) + geom_point() + geom_line(aes(y = pred), color = "red") + facet_wrap(~model) A quick visual inspection suggests that the linear model is too simple, the standard gam fit is pretty good, and the wiggly gam fit is too complex. Put differently, the linear model is too simple and, no matter what training data we use, will never capture the true relationship between variables - it will be consistently wrong due to its simplicity, and is therefore biased. The wiggly fit, on the other hand, is chasing data points and will change a lot from one training dataset to the the next - it will be consistently wrong due to its complexity, and is therefore highly variable. Both are bad! As a next step in my CV procedure, I'll compute root mean squared errors (RMSEs) for each model. rmse(linear_mod, test_df) rmse(smooth_mod, test_df) rmse(wiggly_mod, test_df)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!