Session Ready
Exercise

Fitting linear models with lags

So far, you've seen how to generate lags and add them to a data.table. Next, let's try to use those lags in a linear model!

A data.table called aluminumDT has been loaded in this session. It holds daily aluminum prices. In this exercise, you'll build linear models to help explain the price in terms of past prices.

Instructions 1/3
undefined XP
  • 1
  • 2
  • 3
  • Add columns with the 1-period and 2-period lags of "price". Call them "lag1" and "lag2", respectively.