####################
# #
# Exercise 1 #
# #
####################
auto <- read.csv("D:/forecasting-tutorial/vehicle.csv")
plot(auto$sales,
type = "n",
ylim = c(0, 5000),
ylab = "Sales, '000 units",
xlab = "Period",
main = "US light vehicle sales in 1976-2016")
lines(auto$sales)
#plot of chunk forecasting-part-4
####################
# #
# Exercise 2 #
# #
####################
auto$trend <- seq(1:nrow(auto))
auto$income_lag <- c(NA, auto$income[1:nrow(auto)-1])
auto$unemp_lag <- c(NA, auto$unemp[1:nrow(auto)-1])
auto$rate_lag <- c(NA, auto$rate[1:nrow(auto)-1])
####################
# #
# Exercise 3 #
# #
####################
regressions_result <- regsubsets(sales ~ ., data = auto)
plot(regressions_result, col = colorRampPalette(c("darkgreen", "grey"))(10))
plot(regressions_result, col = colorRampPalette(c("darkgreen", "grey"))(10))
Error in plot.new() : figure margins too large`enter code here`