Exercise

Manually engineering a feature

After doing some research with your team, you recall that the gravitational force of attraction between two bodies obeys Newton's formula:

$$F = G\frac{m_1m_2}{r^2}$$.

You can't use the formula directly because the masses are unknown, but you can fit a regression model of force as a function of inv_square_distance. The augmented dataset df you built in the previous exercise has been loaded for you.

Instructions

100 XP
  • Create a new variable inv_square_distance defined as the reciprocal of the squared distance and add it to the df data frame.
  • Build a simple regression model using lm() of force versus inv_square_distance and save it as lr_force_2.
  • Bind your predictions to df_inverse.