Follow Model Basics: fit a linear model to modelr's sim1 data, then use it to predict.

  1. Fit y ~ x to sim1 with lm().
  2. Print the intercept and slope, rounded to 3 decimal places, as Intercept: … and Slope: ….
  3. The program reads some x values on one line, separated by spaces. Put them in a tibble with a column x, add predictions with add_predictions(), and print each as x = … -> y = … with y rounded to 2 decimal places.

For the input 1 5 the last two lines are:

x = 1 -> y = 6.27
x = 5 -> y = 14.48

Try an x well outside the data, like 50. Should you trust that prediction?

You do not have permission to attempt this activity.