Exercise 14: Housing Starts (Pg. 325) Use the Holt-Winters no-trend model to find the best model to find forecasts for the next 12 months in the Excel file Housing Starts.
data <- read.csv("./data/housing_starts.csv")
data
library(ggplot2)
library(forecast)
myts <- ts(data$Number, start=c(1990, 1), end=c(2008, 5), frequency=12)
myts
## Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov
## 1990 99.2 86.9 108.5 119.0 121.1 117.8 111.2 102.8 93.1 94.2 81.4
## 1991 52.5 59.1 73.8 99.7 97.7 103.4 103.5 94.7 86.6 101.8 75.6
## 1992 71.6 78.8 111.6 107.6 115.2 117.8 106.2 109.9 106.0 111.8 84.5
## 1993 70.5 74.6 95.5 117.8 120.9 128.5 115.3 121.8 118.5 123.3 102.3
## 1994 76.2 83.5 134.3 137.6 148.8 136.4 127.8 139.8 130.1 130.6 113.4
## 1995 84.5 81.6 103.8 116.9 130.5 123.4 129.1 135.8 122.4 126.2 107.2
## 1996 90.7 95.9 116.0 146.6 143.9 138.0 137.5 144.2 128.7 130.8 111.5
## 1997 82.2 94.7 120.4 142.3 136.3 140.4 134.6 126.5 139.2 139.0 112.4
## 1998 91.2 101.1 132.6 144.9 143.3 159.6 156.0 147.5 141.5 155.5 124.2
## 1999 106.8 110.2 147.3 144.6 153.2 149.4 152.6 152.9 140.3 142.9 127.4
## 2000 104.0 119.7 133.4 149.5 152.9 146.3 135.0 141.4 128.9 139.7 117.1
## 2001 106.4 108.2 133.2 151.3 154.0 155.2 154.6 141.5 133.1 139.8 121.0
## 2002 110.4 120.4 138.2 148.8 165.5 160.3 155.9 147.0 155.6 146.8 133.0
## 2003 117.8 109.7 147.2 151.2 165.0 174.5 175.8 163.8 171.3 173.5 153.7
## 2004 124.5 126.4 173.8 179.5 187.6 172.3 182.0 185.9 164.0 181.3 138.1
## 2005 142.9 149.1 156.2 184.6 197.9 192.8 187.6 192.0 187.9 180.4 160.7
## 2006 153.0 145.1 165.9 160.5 190.2 170.2 160.9 146.8 150.1 130.6 115.2
## 2007 95.0 103.1 123.8 135.6 136.5 137.8 127.9 121.2 101.5 115.0 88.8
## 2008 70.8 78.4 82.2 89.5 91.7
## Dec
## 1990 57.4
## 1991 65.6
## 1992 78.6
## 1993 98.7
## 1994 98.5
## 1995 92.8
## 1996 93.1
## 1997 106.0
## 1998 119.6
## 1999 113.6
## 2000 100.7
## 2001 104.6
## 2002 123.1
## 2003 144.2
## 2004 140.2
## 2005 136.0
## 2006 112.4
## 2007 68.9
## 2008
autoplot(decompose(myts))
fit <- HoltWinters(myts,gamma=FALSE)
plot(forecast(fit))
forecast(fit, h=19)
## Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
## Jun 2008 90.10370 70.842857 109.3645 60.646782 119.5606
## Jul 2008 88.50740 60.652181 116.3626 45.906516 131.1083
## Aug 2008 86.91111 52.035807 121.7864 33.573939 140.2483
## Sep 2008 85.31481 44.161612 126.4680 22.376425 148.2532
## Oct 2008 83.71851 36.715348 130.7217 11.833376 155.6036
## Nov 2008 82.12221 29.539819 134.7046 1.704381 162.5400
## Dec 2008 80.52592 22.543983 138.5078 -8.149798 169.2016
## Jan 2009 78.92962 15.670050 142.1892 -17.817542 175.6768
## Feb 2009 77.33332 8.878958 145.7877 -27.358593 182.0252
## Mar 2009 75.73702 2.143059 149.3310 -36.815233 188.2893
## Apr 2009 74.14073 -4.557907 152.8394 -46.218447 194.4999
## May 2009 72.54443 -11.239198 156.3281 -55.591570 200.6804
## Jun 2009 70.94813 -17.912555 159.8088 -64.952560 206.8488
## Jul 2009 69.35183 -24.587178 163.2908 -74.315486 213.0192
## Aug 2009 67.75553 -31.270377 166.7814 -83.691528 219.2026
## Sep 2009 66.15924 -37.968034 170.2865 -93.089682 225.4082
## Oct 2009 64.56294 -44.684926 173.8108 -102.517253 231.6431
## Nov 2009 62.96664 -51.424968 177.3583 -111.980229 237.9135
## Dec 2009 61.37034 -58.191389 180.9321 -121.483547 244.2242