data <- read.csv("MORTGAGE30US-1-1.csv")
summary(data)
##        DATE      MORTGAGE30US   
##  1/1/1972:  1   Min.   : 3.345  
##  1/1/1973:  1   1st Qu.: 5.753  
##  1/1/1974:  1   Median : 7.604  
##  1/1/1975:  1   Mean   : 8.013  
##  1/1/1976:  1   3rd Qu.: 9.742  
##  1/1/1977:  1   Max.   :18.454  
##  (Other) :577
mortgageRates <- ts(data$MORTGAGE30US, frequency=12, start=c(1971, 4), end=c(2019, 10))
plot(mortgageRates)

time <- data$DATE
#Classical Decomposition using Multiplicative method
deMortgageRates = decompose(mortgageRates, type = "multiplicative")
plot(deMortgageRates)

#Seasonal Component
s = deMortgageRates$seasonal
#Trend Component
tr = deMortgageRates$trend
s
##            Jan       Feb       Mar       Apr       May       Jun       Jul
## 1971                               1.0025061 1.0057304 1.0075053 1.0070414
## 1972 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1973 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1974 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1975 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1976 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1977 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1978 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1979 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1980 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1981 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1982 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1983 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1984 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1985 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1986 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1987 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1988 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1989 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1990 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1991 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1992 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1993 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1994 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1995 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1996 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1997 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1998 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1999 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2000 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2001 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2002 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2003 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2004 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2005 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2006 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2007 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2008 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2009 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2010 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2011 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2012 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2013 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2014 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2015 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2016 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2017 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2018 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2019 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
##            Aug       Sep       Oct       Nov       Dec
## 1971 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1972 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1973 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1974 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1975 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1976 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1977 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1978 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1979 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1980 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1981 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1982 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1983 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1984 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1985 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1986 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1987 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1988 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1989 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1990 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1991 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1992 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1993 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1994 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1995 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1996 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1997 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1998 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1999 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2000 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2001 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2002 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2003 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2004 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2005 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2006 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2007 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2008 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2009 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2010 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2011 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2012 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2013 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2014 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2015 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2016 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2017 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2018 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2019 1.0074431 1.0032564 1.0003765
tr
##            Jan       Feb       Mar       Apr       May       Jun       Jul
## 1971                                      NA        NA        NA        NA
## 1972  7.469792  7.448687  7.425146  7.405333  7.391562  7.384875  7.383292
## 1973  7.508042  7.581000  7.684792  7.799167  7.903521  7.997271  8.088854
## 1974  8.658833  8.755500  8.848521  8.946438  9.047000  9.142146  9.224208
## 1975  9.338917  9.295833  9.234521  9.168646  9.110458  9.062104  9.023208
## 1976  8.948042  8.952292  8.948354  8.929750  8.903646  8.877063  8.852104
## 1977  8.830583  8.828417  8.822521  8.818812  8.823083  8.834667  8.853854
## 1978  9.164958  9.233417  9.304458  9.379250  9.467583  9.574708  9.689750
## 1979 10.309604 10.420500 10.539375 10.677875 10.865479 11.085333 11.295396
## 1980 12.991750 13.098667 13.238812 13.407646 13.554708 13.690750 13.853937
## 1981 14.764187 15.154375 15.558021 15.959042 16.304125 16.544792 16.742167
## 1982 17.333625 17.290667 17.134625 16.860625 16.533708 16.228625 15.913646
## 1983 13.854208 13.610292 13.436792 13.321083 13.260125 13.235375 13.231875
## 1984 13.663979 13.743375 13.796875 13.847667 13.880917 13.879375 13.857188
## 1985 13.383917 13.178958 12.993896 12.820875 12.660500 12.503250 12.332042
## 1986 11.105625 10.959333 10.785542 10.604458 10.427375 10.259083 10.107750
## 1987  9.822229  9.818083  9.860167  9.950417 10.043792 10.139000 10.243521
## 1988 10.453708 10.471271 10.465437 10.408562 10.352625 10.335417 10.348729
## 1989 10.569979 10.521562 10.481292 10.451750 10.416229 10.359333 10.288375
## 1990 10.075062 10.086208 10.093042 10.104667 10.124521 10.131813 10.118104
## 1991  9.752167  9.697333  9.613021  9.509271  9.399917  9.296708  9.197521
## 1992  8.777625  8.664458  8.566375  8.489208  8.440292  8.411188  8.380729
## 1993  7.807333  7.732979  7.655062  7.560833  7.460667  7.369667  7.287729
## 1994  7.524750  7.641750  7.771958  7.930958  8.102042  8.270417  8.441813
## 1995  8.569521  8.500396  8.431375  8.329125  8.194021  8.036083  7.864604
## 1996  7.626563  7.659042  7.689708  7.732792  7.761146  7.787729  7.837375
## 1997  7.865146  7.812250  7.757167  7.697958  7.654875  7.616729  7.561208
## 1998  7.181187  7.135229  7.082521  7.028708  6.990208  6.961167  6.937583
## 1999  6.957792  7.028625  7.116958  7.210375  7.294313  7.379583  7.487875
## 2000  8.073896  8.098917  8.106187  8.107542  8.105479  8.083708  8.012562
## 2001  7.409667  7.322271  7.231771  7.137104  7.042750  6.984250  6.969583
## 2002  6.854938  6.800667  6.742958  6.691708  6.646083  6.579104  6.491646
## 2003  5.891604  5.855000  5.856208  5.851813  5.839479  5.826688  5.811063
## 2004  5.933021  5.934146  5.901229  5.875271  5.857271  5.843667  5.838396
## 2005  5.760333  5.743312  5.742167  5.757271  5.796542  5.843208  5.883000
## 2006  6.249854  6.323667  6.379187  6.417562  6.426000  6.416542  6.413854
## 2007  6.345479  6.344667  6.345833  6.345729  6.345125  6.342125  6.321312
## 2008  6.176000  6.160854  6.142542  6.120875  6.108562  6.069833  6.006521
## 2009  5.515000  5.411292  5.316917  5.224083  5.121563  5.056208  5.040646
## 2010  4.967542  4.908250  4.846729  4.786792  4.732542  4.699583  4.679125
## 2011  4.591500  4.584146  4.567583  4.551021  4.531646  4.487333  4.420833
## 2012  3.965292  3.896000  3.842812  3.788917  3.733687  3.681458  3.635042
## 2013  3.558458  3.628208  3.705146  3.780229  3.851583  3.935562  4.024333
## 2014  4.322458  4.298250  4.270396  4.250250  4.233021  4.197562  4.141083
## 2015  3.908958  3.896708  3.876604  3.855250  3.842958  3.844833  3.857437
## 2016  3.770000  3.725167  3.687667  3.656167  3.635396  3.637958  3.659271
## 2017  3.875771  3.916292  3.949208  3.981292  4.005333  4.001333  3.986104
## 2018  4.177458  4.228708  4.290896  4.364125  4.442417  4.510396  4.557021
## 2019  4.397771  4.327083  4.245562  4.155375        NA        NA        NA
##            Aug       Sep       Oct       Nov       Dec
## 1971        NA        NA  7.496875  7.493854  7.485083
## 1972  7.388083  7.399542  7.416729  7.438917  7.465667
## 1973  8.177083  8.258875  8.341708  8.440021  8.551292
## 1974  9.288458  9.336229  9.366813  9.373958  9.363188
## 1975  8.993688  8.975354  8.965458  8.955833  8.948083
## 1976  8.833938  8.825188  8.823292  8.826813  8.829833
## 1977  8.885833  8.927062  8.973625  9.029792  9.096271
## 1978  9.799646  9.903250 10.001854 10.096021 10.197917
## 1979 11.508729 11.820771 12.265937 12.657583 12.876167
## 1980 14.025562 14.117646 14.091500 14.149625 14.404833
## 1981 16.952417 17.128458 17.256458 17.322604 17.334187
## 1982 15.547292 15.175833 14.822917 14.483125 14.155104
## 1983 13.244792 13.277125 13.337812 13.428667 13.547667
## 1984 13.831979 13.809958 13.781896 13.719979 13.585417
## 1985 12.148750 11.927917 11.663437 11.412292 11.233021
## 1986  9.969854  9.858500  9.810583  9.825042  9.837833
## 1987 10.326375 10.397417 10.450104 10.459625 10.450521
## 1988 10.394563 10.471833 10.553083 10.601646 10.603875
## 1989 10.234937 10.184458 10.124292 10.083667 10.070042
## 1990 10.072687 10.006000  9.937437  9.858979  9.794208
## 1991  9.122187  9.073542  9.023333  8.963333  8.883958
## 1992  8.317417  8.212417  8.094896  7.987083  7.891271
## 1993  7.226792  7.212208  7.254875  7.337229  7.425250
## 1994  8.598583  8.701167  8.734125  8.707521  8.646104
## 1995  7.703354  7.595417  7.544042  7.532375  7.568583
## 1996  7.894417  7.929771  7.950229  7.954042  7.922542
## 1997  7.501313  7.443917  7.370062  7.294958  7.232771
## 1998  6.919083  6.905646  6.892667  6.883375  6.906438
## 1999  7.610479  7.723708  7.825229  7.933833  8.021667
## 2000  7.910375  7.803583  7.705125  7.603250  7.499167
## 2001  6.961563  6.957583  6.956313  6.938333  6.902958
## 2002  6.402833  6.306208  6.204479  6.100542  5.986292
## 2003  5.793937  5.772792  5.761021  5.794500  5.871313
## 2004  5.837979  5.857792  5.878958  5.857083  5.804771
## 2005  5.927167  5.969708  6.013396  6.077146  6.159542
## 2006  6.418229  6.412583  6.391938  6.364313  6.349312
## 2007  6.286854  6.263792  6.245104  6.224750  6.201271
## 2008  5.944104  5.870979  5.784521  5.689271  5.602667
## 2009  5.034083  5.026792  5.037333  5.050583  5.023396
## 2010  4.666104  4.659062  4.642833  4.621667  4.601771
## 2011  4.341562  4.260542  4.185042  4.111312  4.041542
## 2012  3.599271  3.568167  3.532583  3.502292  3.507833
## 2013  4.098833  4.163312  4.232896  4.297417  4.328604
## 2014  4.084646  4.036104  3.984521  3.942125  3.919958
## 2015  3.863792  3.858542  3.852583  3.839792  3.812521
## 2016  3.691979  3.734042  3.773292  3.808708  3.839792
## 2017  3.987979  4.005083  4.033021  4.074625  4.126375
## 2018  4.576667  4.570875  4.549875  4.514917  4.461521
## 2019        NA        NA        NA
plot(s)

plot(tr)

summary(s)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.9873  0.9955  1.0025  1.0001  1.0070  1.0075
summary(tr)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##   3.502   5.843   7.685   8.062   9.831  17.334      12
#Regress rates on trend and seasonal indicies
summary(lm(s ~ zlag(s)))
## 
## Call:
## lm(formula = s ~ zlag(s))
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.007884 -0.002688  0.001048  0.002927  0.006140 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.20247    0.02504   8.085 3.65e-15 ***
## zlag(s)      0.79753    0.02504  31.848  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.004062 on 580 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.6362, Adjusted R-squared:  0.6356 
## F-statistic:  1014 on 1 and 580 DF,  p-value: < 2.2e-16
summary(lm(tr ~ zlag(tr)))
## 
## Call:
## lm(formula = tr ~ zlag(tr))
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.37168 -0.04922 -0.00515  0.05113  0.44798 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -0.01243    0.01144  -1.086    0.278    
## zlag(tr)     1.00081    0.00132 758.347   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.09979 on 568 degrees of freedom
##   (13 observations deleted due to missingness)
## Multiple R-squared:  0.999,  Adjusted R-squared:  0.999 
## F-statistic: 5.751e+05 on 1 and 568 DF,  p-value: < 2.2e-16
dataWithOultlierStart <- read.csv("MORTGAGE30US-1-1-outlier-start.csv")
mortgageRatesOutlierStart <- ts(data$MORTGAGE30US, frequency=12, start=c(1971, 4), end=c(2019, 10))
demortgageRatesOutlierStart = decompose(mortgageRatesOutlierStart, type = "multiplicative")
plot(mortgageRatesOutlierStart)

#Season Component
s = demortgageRatesOutlierStart$seasonal
s
##            Jan       Feb       Mar       Apr       May       Jun       Jul
## 1971                               1.0025061 1.0057304 1.0075053 1.0070414
## 1972 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1973 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1974 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1975 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1976 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1977 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1978 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1979 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1980 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1981 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1982 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1983 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1984 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1985 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1986 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1987 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1988 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1989 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1990 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1991 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1992 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1993 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1994 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1995 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1996 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1997 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1998 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1999 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2000 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2001 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2002 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2003 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2004 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2005 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2006 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2007 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2008 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2009 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2010 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2011 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2012 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2013 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2014 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2015 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2016 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2017 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2018 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2019 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
##            Aug       Sep       Oct       Nov       Dec
## 1971 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1972 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1973 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1974 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1975 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1976 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1977 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1978 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1979 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1980 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1981 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1982 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1983 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1984 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1985 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1986 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1987 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1988 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1989 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1990 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1991 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1992 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1993 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1994 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1995 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1996 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1997 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1998 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1999 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2000 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2001 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2002 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2003 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2004 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2005 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2006 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2007 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2008 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2009 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2010 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2011 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2012 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2013 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2014 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2015 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2016 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2017 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2018 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2019 1.0074431 1.0032564 1.0003765
#Trend Component
tr = demortgageRatesOutlierStart$trend
tr
##            Jan       Feb       Mar       Apr       May       Jun       Jul
## 1971                                      NA        NA        NA        NA
## 1972  7.469792  7.448687  7.425146  7.405333  7.391562  7.384875  7.383292
## 1973  7.508042  7.581000  7.684792  7.799167  7.903521  7.997271  8.088854
## 1974  8.658833  8.755500  8.848521  8.946438  9.047000  9.142146  9.224208
## 1975  9.338917  9.295833  9.234521  9.168646  9.110458  9.062104  9.023208
## 1976  8.948042  8.952292  8.948354  8.929750  8.903646  8.877063  8.852104
## 1977  8.830583  8.828417  8.822521  8.818812  8.823083  8.834667  8.853854
## 1978  9.164958  9.233417  9.304458  9.379250  9.467583  9.574708  9.689750
## 1979 10.309604 10.420500 10.539375 10.677875 10.865479 11.085333 11.295396
## 1980 12.991750 13.098667 13.238812 13.407646 13.554708 13.690750 13.853937
## 1981 14.764187 15.154375 15.558021 15.959042 16.304125 16.544792 16.742167
## 1982 17.333625 17.290667 17.134625 16.860625 16.533708 16.228625 15.913646
## 1983 13.854208 13.610292 13.436792 13.321083 13.260125 13.235375 13.231875
## 1984 13.663979 13.743375 13.796875 13.847667 13.880917 13.879375 13.857188
## 1985 13.383917 13.178958 12.993896 12.820875 12.660500 12.503250 12.332042
## 1986 11.105625 10.959333 10.785542 10.604458 10.427375 10.259083 10.107750
## 1987  9.822229  9.818083  9.860167  9.950417 10.043792 10.139000 10.243521
## 1988 10.453708 10.471271 10.465437 10.408562 10.352625 10.335417 10.348729
## 1989 10.569979 10.521562 10.481292 10.451750 10.416229 10.359333 10.288375
## 1990 10.075062 10.086208 10.093042 10.104667 10.124521 10.131813 10.118104
## 1991  9.752167  9.697333  9.613021  9.509271  9.399917  9.296708  9.197521
## 1992  8.777625  8.664458  8.566375  8.489208  8.440292  8.411188  8.380729
## 1993  7.807333  7.732979  7.655062  7.560833  7.460667  7.369667  7.287729
## 1994  7.524750  7.641750  7.771958  7.930958  8.102042  8.270417  8.441813
## 1995  8.569521  8.500396  8.431375  8.329125  8.194021  8.036083  7.864604
## 1996  7.626563  7.659042  7.689708  7.732792  7.761146  7.787729  7.837375
## 1997  7.865146  7.812250  7.757167  7.697958  7.654875  7.616729  7.561208
## 1998  7.181187  7.135229  7.082521  7.028708  6.990208  6.961167  6.937583
## 1999  6.957792  7.028625  7.116958  7.210375  7.294313  7.379583  7.487875
## 2000  8.073896  8.098917  8.106187  8.107542  8.105479  8.083708  8.012562
## 2001  7.409667  7.322271  7.231771  7.137104  7.042750  6.984250  6.969583
## 2002  6.854938  6.800667  6.742958  6.691708  6.646083  6.579104  6.491646
## 2003  5.891604  5.855000  5.856208  5.851813  5.839479  5.826688  5.811063
## 2004  5.933021  5.934146  5.901229  5.875271  5.857271  5.843667  5.838396
## 2005  5.760333  5.743312  5.742167  5.757271  5.796542  5.843208  5.883000
## 2006  6.249854  6.323667  6.379187  6.417562  6.426000  6.416542  6.413854
## 2007  6.345479  6.344667  6.345833  6.345729  6.345125  6.342125  6.321312
## 2008  6.176000  6.160854  6.142542  6.120875  6.108562  6.069833  6.006521
## 2009  5.515000  5.411292  5.316917  5.224083  5.121563  5.056208  5.040646
## 2010  4.967542  4.908250  4.846729  4.786792  4.732542  4.699583  4.679125
## 2011  4.591500  4.584146  4.567583  4.551021  4.531646  4.487333  4.420833
## 2012  3.965292  3.896000  3.842812  3.788917  3.733687  3.681458  3.635042
## 2013  3.558458  3.628208  3.705146  3.780229  3.851583  3.935562  4.024333
## 2014  4.322458  4.298250  4.270396  4.250250  4.233021  4.197562  4.141083
## 2015  3.908958  3.896708  3.876604  3.855250  3.842958  3.844833  3.857437
## 2016  3.770000  3.725167  3.687667  3.656167  3.635396  3.637958  3.659271
## 2017  3.875771  3.916292  3.949208  3.981292  4.005333  4.001333  3.986104
## 2018  4.177458  4.228708  4.290896  4.364125  4.442417  4.510396  4.557021
## 2019  4.397771  4.327083  4.245562  4.155375        NA        NA        NA
##            Aug       Sep       Oct       Nov       Dec
## 1971        NA        NA  7.496875  7.493854  7.485083
## 1972  7.388083  7.399542  7.416729  7.438917  7.465667
## 1973  8.177083  8.258875  8.341708  8.440021  8.551292
## 1974  9.288458  9.336229  9.366813  9.373958  9.363188
## 1975  8.993688  8.975354  8.965458  8.955833  8.948083
## 1976  8.833938  8.825188  8.823292  8.826813  8.829833
## 1977  8.885833  8.927062  8.973625  9.029792  9.096271
## 1978  9.799646  9.903250 10.001854 10.096021 10.197917
## 1979 11.508729 11.820771 12.265937 12.657583 12.876167
## 1980 14.025562 14.117646 14.091500 14.149625 14.404833
## 1981 16.952417 17.128458 17.256458 17.322604 17.334187
## 1982 15.547292 15.175833 14.822917 14.483125 14.155104
## 1983 13.244792 13.277125 13.337812 13.428667 13.547667
## 1984 13.831979 13.809958 13.781896 13.719979 13.585417
## 1985 12.148750 11.927917 11.663437 11.412292 11.233021
## 1986  9.969854  9.858500  9.810583  9.825042  9.837833
## 1987 10.326375 10.397417 10.450104 10.459625 10.450521
## 1988 10.394563 10.471833 10.553083 10.601646 10.603875
## 1989 10.234937 10.184458 10.124292 10.083667 10.070042
## 1990 10.072687 10.006000  9.937437  9.858979  9.794208
## 1991  9.122187  9.073542  9.023333  8.963333  8.883958
## 1992  8.317417  8.212417  8.094896  7.987083  7.891271
## 1993  7.226792  7.212208  7.254875  7.337229  7.425250
## 1994  8.598583  8.701167  8.734125  8.707521  8.646104
## 1995  7.703354  7.595417  7.544042  7.532375  7.568583
## 1996  7.894417  7.929771  7.950229  7.954042  7.922542
## 1997  7.501313  7.443917  7.370062  7.294958  7.232771
## 1998  6.919083  6.905646  6.892667  6.883375  6.906438
## 1999  7.610479  7.723708  7.825229  7.933833  8.021667
## 2000  7.910375  7.803583  7.705125  7.603250  7.499167
## 2001  6.961563  6.957583  6.956313  6.938333  6.902958
## 2002  6.402833  6.306208  6.204479  6.100542  5.986292
## 2003  5.793937  5.772792  5.761021  5.794500  5.871313
## 2004  5.837979  5.857792  5.878958  5.857083  5.804771
## 2005  5.927167  5.969708  6.013396  6.077146  6.159542
## 2006  6.418229  6.412583  6.391938  6.364313  6.349312
## 2007  6.286854  6.263792  6.245104  6.224750  6.201271
## 2008  5.944104  5.870979  5.784521  5.689271  5.602667
## 2009  5.034083  5.026792  5.037333  5.050583  5.023396
## 2010  4.666104  4.659062  4.642833  4.621667  4.601771
## 2011  4.341562  4.260542  4.185042  4.111312  4.041542
## 2012  3.599271  3.568167  3.532583  3.502292  3.507833
## 2013  4.098833  4.163312  4.232896  4.297417  4.328604
## 2014  4.084646  4.036104  3.984521  3.942125  3.919958
## 2015  3.863792  3.858542  3.852583  3.839792  3.812521
## 2016  3.691979  3.734042  3.773292  3.808708  3.839792
## 2017  3.987979  4.005083  4.033021  4.074625  4.126375
## 2018  4.576667  4.570875  4.549875  4.514917  4.461521
## 2019        NA        NA        NA
plot(s)

plot(tr)

dataWithOultlierEnd <- read.csv("MORTGAGE30US-1-1-outlier-end.csv")
summary(dataWithOultlierEnd)
##       DATE      MORTGAGE30US   
##  1/1/00 :  1   Min.   : 3.345  
##  1/1/01 :  1   1st Qu.: 5.756  
##  1/1/02 :  1   Median : 7.607  
##  1/1/03 :  1   Mean   : 8.056  
##  1/1/04 :  1   3rd Qu.: 9.750  
##  1/1/05 :  1   Max.   :30.000  
##  (Other):577
mortgageRatesOutlierEnd <- ts(data$MORTGAGE30US, frequency=12, start=c(1971, 4), end=c(2019, 10))
plot(mortgageRatesOutlierEnd)

demortgageRatesOutlierEnd = decompose(mortgageRatesOutlierEnd, type = "multiplicative")
#Season Component
s = demortgageRatesOutlierEnd$seasonal
s
##            Jan       Feb       Mar       Apr       May       Jun       Jul
## 1971                               1.0025061 1.0057304 1.0075053 1.0070414
## 1972 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1973 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1974 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1975 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1976 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1977 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1978 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1979 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1980 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1981 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1982 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1983 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1984 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1985 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1986 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1987 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1988 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1989 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1990 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1991 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1992 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1993 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1994 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1995 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1996 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1997 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1998 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 1999 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2000 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2001 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2002 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2003 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2004 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2005 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2006 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2007 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2008 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2009 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2010 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2011 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2012 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2013 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2014 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2015 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2016 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2017 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2018 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
## 2019 0.9885739 0.9873114 0.9954333 1.0025061 1.0057304 1.0075053 1.0070414
##            Aug       Sep       Oct       Nov       Dec
## 1971 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1972 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1973 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1974 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1975 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1976 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1977 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1978 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1979 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1980 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1981 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1982 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1983 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1984 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1985 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1986 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1987 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1988 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1989 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1990 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1991 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1992 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1993 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1994 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1995 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1996 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1997 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1998 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 1999 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2000 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2001 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2002 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2003 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2004 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2005 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2006 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2007 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2008 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2009 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2010 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2011 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2012 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2013 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2014 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2015 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2016 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2017 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2018 1.0074431 1.0032564 1.0003765 0.9992738 0.9955483
## 2019 1.0074431 1.0032564 1.0003765
#Trend Component
tr = demortgageRatesOutlierEnd$trend
tr
##            Jan       Feb       Mar       Apr       May       Jun       Jul
## 1971                                      NA        NA        NA        NA
## 1972  7.469792  7.448687  7.425146  7.405333  7.391562  7.384875  7.383292
## 1973  7.508042  7.581000  7.684792  7.799167  7.903521  7.997271  8.088854
## 1974  8.658833  8.755500  8.848521  8.946438  9.047000  9.142146  9.224208
## 1975  9.338917  9.295833  9.234521  9.168646  9.110458  9.062104  9.023208
## 1976  8.948042  8.952292  8.948354  8.929750  8.903646  8.877063  8.852104
## 1977  8.830583  8.828417  8.822521  8.818812  8.823083  8.834667  8.853854
## 1978  9.164958  9.233417  9.304458  9.379250  9.467583  9.574708  9.689750
## 1979 10.309604 10.420500 10.539375 10.677875 10.865479 11.085333 11.295396
## 1980 12.991750 13.098667 13.238812 13.407646 13.554708 13.690750 13.853937
## 1981 14.764187 15.154375 15.558021 15.959042 16.304125 16.544792 16.742167
## 1982 17.333625 17.290667 17.134625 16.860625 16.533708 16.228625 15.913646
## 1983 13.854208 13.610292 13.436792 13.321083 13.260125 13.235375 13.231875
## 1984 13.663979 13.743375 13.796875 13.847667 13.880917 13.879375 13.857188
## 1985 13.383917 13.178958 12.993896 12.820875 12.660500 12.503250 12.332042
## 1986 11.105625 10.959333 10.785542 10.604458 10.427375 10.259083 10.107750
## 1987  9.822229  9.818083  9.860167  9.950417 10.043792 10.139000 10.243521
## 1988 10.453708 10.471271 10.465437 10.408562 10.352625 10.335417 10.348729
## 1989 10.569979 10.521562 10.481292 10.451750 10.416229 10.359333 10.288375
## 1990 10.075062 10.086208 10.093042 10.104667 10.124521 10.131813 10.118104
## 1991  9.752167  9.697333  9.613021  9.509271  9.399917  9.296708  9.197521
## 1992  8.777625  8.664458  8.566375  8.489208  8.440292  8.411188  8.380729
## 1993  7.807333  7.732979  7.655062  7.560833  7.460667  7.369667  7.287729
## 1994  7.524750  7.641750  7.771958  7.930958  8.102042  8.270417  8.441813
## 1995  8.569521  8.500396  8.431375  8.329125  8.194021  8.036083  7.864604
## 1996  7.626563  7.659042  7.689708  7.732792  7.761146  7.787729  7.837375
## 1997  7.865146  7.812250  7.757167  7.697958  7.654875  7.616729  7.561208
## 1998  7.181187  7.135229  7.082521  7.028708  6.990208  6.961167  6.937583
## 1999  6.957792  7.028625  7.116958  7.210375  7.294313  7.379583  7.487875
## 2000  8.073896  8.098917  8.106187  8.107542  8.105479  8.083708  8.012562
## 2001  7.409667  7.322271  7.231771  7.137104  7.042750  6.984250  6.969583
## 2002  6.854938  6.800667  6.742958  6.691708  6.646083  6.579104  6.491646
## 2003  5.891604  5.855000  5.856208  5.851813  5.839479  5.826688  5.811063
## 2004  5.933021  5.934146  5.901229  5.875271  5.857271  5.843667  5.838396
## 2005  5.760333  5.743312  5.742167  5.757271  5.796542  5.843208  5.883000
## 2006  6.249854  6.323667  6.379187  6.417562  6.426000  6.416542  6.413854
## 2007  6.345479  6.344667  6.345833  6.345729  6.345125  6.342125  6.321312
## 2008  6.176000  6.160854  6.142542  6.120875  6.108562  6.069833  6.006521
## 2009  5.515000  5.411292  5.316917  5.224083  5.121563  5.056208  5.040646
## 2010  4.967542  4.908250  4.846729  4.786792  4.732542  4.699583  4.679125
## 2011  4.591500  4.584146  4.567583  4.551021  4.531646  4.487333  4.420833
## 2012  3.965292  3.896000  3.842812  3.788917  3.733687  3.681458  3.635042
## 2013  3.558458  3.628208  3.705146  3.780229  3.851583  3.935562  4.024333
## 2014  4.322458  4.298250  4.270396  4.250250  4.233021  4.197562  4.141083
## 2015  3.908958  3.896708  3.876604  3.855250  3.842958  3.844833  3.857437
## 2016  3.770000  3.725167  3.687667  3.656167  3.635396  3.637958  3.659271
## 2017  3.875771  3.916292  3.949208  3.981292  4.005333  4.001333  3.986104
## 2018  4.177458  4.228708  4.290896  4.364125  4.442417  4.510396  4.557021
## 2019  4.397771  4.327083  4.245562  4.155375        NA        NA        NA
##            Aug       Sep       Oct       Nov       Dec
## 1971        NA        NA  7.496875  7.493854  7.485083
## 1972  7.388083  7.399542  7.416729  7.438917  7.465667
## 1973  8.177083  8.258875  8.341708  8.440021  8.551292
## 1974  9.288458  9.336229  9.366813  9.373958  9.363188
## 1975  8.993688  8.975354  8.965458  8.955833  8.948083
## 1976  8.833938  8.825188  8.823292  8.826813  8.829833
## 1977  8.885833  8.927062  8.973625  9.029792  9.096271
## 1978  9.799646  9.903250 10.001854 10.096021 10.197917
## 1979 11.508729 11.820771 12.265937 12.657583 12.876167
## 1980 14.025562 14.117646 14.091500 14.149625 14.404833
## 1981 16.952417 17.128458 17.256458 17.322604 17.334187
## 1982 15.547292 15.175833 14.822917 14.483125 14.155104
## 1983 13.244792 13.277125 13.337812 13.428667 13.547667
## 1984 13.831979 13.809958 13.781896 13.719979 13.585417
## 1985 12.148750 11.927917 11.663437 11.412292 11.233021
## 1986  9.969854  9.858500  9.810583  9.825042  9.837833
## 1987 10.326375 10.397417 10.450104 10.459625 10.450521
## 1988 10.394563 10.471833 10.553083 10.601646 10.603875
## 1989 10.234937 10.184458 10.124292 10.083667 10.070042
## 1990 10.072687 10.006000  9.937437  9.858979  9.794208
## 1991  9.122187  9.073542  9.023333  8.963333  8.883958
## 1992  8.317417  8.212417  8.094896  7.987083  7.891271
## 1993  7.226792  7.212208  7.254875  7.337229  7.425250
## 1994  8.598583  8.701167  8.734125  8.707521  8.646104
## 1995  7.703354  7.595417  7.544042  7.532375  7.568583
## 1996  7.894417  7.929771  7.950229  7.954042  7.922542
## 1997  7.501313  7.443917  7.370062  7.294958  7.232771
## 1998  6.919083  6.905646  6.892667  6.883375  6.906438
## 1999  7.610479  7.723708  7.825229  7.933833  8.021667
## 2000  7.910375  7.803583  7.705125  7.603250  7.499167
## 2001  6.961563  6.957583  6.956313  6.938333  6.902958
## 2002  6.402833  6.306208  6.204479  6.100542  5.986292
## 2003  5.793937  5.772792  5.761021  5.794500  5.871313
## 2004  5.837979  5.857792  5.878958  5.857083  5.804771
## 2005  5.927167  5.969708  6.013396  6.077146  6.159542
## 2006  6.418229  6.412583  6.391938  6.364313  6.349312
## 2007  6.286854  6.263792  6.245104  6.224750  6.201271
## 2008  5.944104  5.870979  5.784521  5.689271  5.602667
## 2009  5.034083  5.026792  5.037333  5.050583  5.023396
## 2010  4.666104  4.659062  4.642833  4.621667  4.601771
## 2011  4.341562  4.260542  4.185042  4.111312  4.041542
## 2012  3.599271  3.568167  3.532583  3.502292  3.507833
## 2013  4.098833  4.163312  4.232896  4.297417  4.328604
## 2014  4.084646  4.036104  3.984521  3.942125  3.919958
## 2015  3.863792  3.858542  3.852583  3.839792  3.812521
## 2016  3.691979  3.734042  3.773292  3.808708  3.839792
## 2017  3.987979  4.005083  4.033021  4.074625  4.126375
## 2018  4.576667  4.570875  4.549875  4.514917  4.461521
## 2019        NA        NA        NA
plot(s)

plot(tr)

#Forecast next 12 months

#Forecast; Simple Exponential Smoothing
fsmoothing = ses(mortgageRates)
summary(fsmoothing)
## 
## Forecast method: Simple exponential smoothing
## 
## Model Information:
## Simple exponential smoothing 
## 
## Call:
##  ses(y = mortgageRates) 
## 
##   Smoothing parameters:
##     alpha = 0.9999 
## 
##   Initial states:
##     l = 7.31 
## 
##   sigma:  0.276
## 
##      AIC     AICc      BIC 
## 2215.405 2215.447 2228.510 
## 
## Error measures:
##                        ME      RMSE       MAE        MPE     MAPE      MASE
## Training set -0.006213257 0.2754815 0.1759692 -0.1635561 2.191558 0.2090678
##                   ACF1
## Training set 0.4050074
## 
## Forecasts:
##          Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## Nov 2019       3.687992 3.334341 4.041643 3.147129 4.228854
## Dec 2019       3.687992 3.187879 4.188105 2.923135 4.452848
## Jan 2020       3.687992 3.075491 4.300492 2.751253 4.624730
## Feb 2020       3.687992 2.980743 4.395240 2.606348 4.769635
## Mar 2020       3.687992 2.897268 4.478716 2.478683 4.897300
## Apr 2020       3.687992 2.821800 4.554184 2.363265 5.012718
## May 2020       3.687992 2.752400 4.623584 2.257127 5.118856
## Jun 2020       3.687992 2.687803 4.688180 2.158336 5.217648
## Jul 2020       3.687992 2.627133 4.748850 2.065549 5.310435
## Aug 2020       3.687992 2.569750 4.806233 1.977789 5.398195
#Forecast; Holts Method
fc1 = holt(mortgageRates, h=12)
summary(fc1)
## 
## Forecast method: Holt's method
## 
## Model Information:
## Holt's method 
## 
## Call:
##  holt(y = mortgageRates, h = 12) 
## 
##   Smoothing parameters:
##     alpha = 0.9999 
##     beta  = 1e-04 
## 
##   Initial states:
##     l = 7.7454 
##     b = -0.0064 
## 
##   sigma:  0.2769
## 
##      AIC     AICc      BIC 
## 2221.587 2221.691 2243.428 
## 
## Error measures:
##                         ME      RMSE       MAE         MPE     MAPE      MASE
## Training set -0.0007426416 0.2759973 0.1762156 -0.08165987 2.190967 0.2093605
##                   ACF1
## Training set 0.4021392
## 
## Forecasts:
##          Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## Nov 2019       3.681525 3.326600 4.036449 3.138714 4.224335
## Dec 2019       3.675058 3.173119 4.176997 2.907408 4.442708
## Jan 2020       3.668592 3.053824 4.283359 2.728385 4.608798
## Feb 2020       3.662125 2.952223 4.372027 2.576423 4.747827
## Mar 2020       3.655658 2.861928 4.449389 2.441752 4.869565
## Apr 2020       3.649192 2.779663 4.518721 2.319362 4.979022
## May 2020       3.642725 2.703482 4.581969 2.206277 5.079174
## Jun 2020       3.636259 2.632117 4.640401 2.100557 5.171961
## Jul 2020       3.629792 2.564687 4.694898 2.000855 5.258730
## Aug 2020       3.623326 2.500552 4.746100 1.906191 5.340461
## Sep 2020       3.616859 2.439226 4.794493 1.815825 5.417894
## Oct 2020       3.610393 2.380334 4.840451 1.729181 5.491605
#Forecast; Holt-Winter's Method- Additive
fc2=hw(mortgageRates, seasonal="additive", h=12)
summary(fc2)
## 
## Forecast method: Holt-Winters' additive method
## 
## Model Information:
## Holt-Winters' additive method 
## 
## Call:
##  hw(y = mortgageRates, h = 12, seasonal = "additive") 
## 
##   Smoothing parameters:
##     alpha = 0.9975 
##     beta  = 1e-04 
##     gamma = 0.0024 
## 
##   Initial states:
##     l = 7.3988 
##     b = 0.0026 
##     s = -0.0404 -0.0725 -0.0651 -0.0039 0.0387 0.0924
##            0.0611 0.0278 -0.0145 -0.0243 -0.0085 0.0091
## 
##   sigma:  0.2784
## 
##      AIC     AICc      BIC 
## 2239.457 2240.541 2313.717 
## 
## Error measures:
##                        ME      RMSE       MAE        MPE     MAPE      MASE
## Training set -0.009120919 0.2745503 0.1769494 -0.2046608 2.231248 0.2102324
##                   ACF1
## Training set 0.4016255
## 
## Forecasts:
##          Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## Nov 2019       3.643358 3.286578 4.000138 3.097710 4.189006
## Dec 2019       3.599847 3.095873 4.103822 2.829084 4.370611
## Jan 2020       3.542944 2.925917 4.159971 2.599282 4.486605
## Feb 2020       3.534659 2.822278 4.247040 2.445166 4.624152
## Mar 2020       3.574072 2.777652 4.370492 2.356053 4.792091
## Apr 2020       3.624417 2.751998 4.496836 2.290167 4.958667
## May 2020       3.610569 2.668242 4.552895 2.169405 5.051732
## Jun 2020       3.592968 2.585558 4.600378 2.052267 5.133669
## Jul 2020       3.602115 2.533562 4.670667 1.967904 5.236325
## Aug 2020       3.644403 2.518007 4.770799 1.921729 5.367077
## Sep 2020       3.678170 2.496745 4.859594 1.871337 5.485002
## Oct 2020       3.711038 2.477023 4.945052 1.823775 5.598300
#Forecast; Holt-Winter's Method- Multiplicative
fc3=hw(mortgageRates, seasonal="multiplicative", h=12)
summary(fc3)
## 
## Forecast method: Holt-Winters' multiplicative method
## 
## Model Information:
## Holt-Winters' multiplicative method 
## 
## Call:
##  hw(y = mortgageRates, h = 12, seasonal = "multiplicative") 
## 
##   Smoothing parameters:
##     alpha = 0.9921 
##     beta  = 3e-04 
##     gamma = 0.0079 
## 
##   Initial states:
##     l = 7.4259 
##     b = -0.0229 
##     s = 0.9965 0.9903 0.995 0.9922 1.0013 1.0098
##            1.0039 0.9996 0.9927 0.999 1.0071 1.0126
## 
##   sigma:  0.0319
## 
##      AIC     AICc      BIC 
## 2047.066 2048.149 2121.325 
## 
## Error measures:
##                      ME      RMSE       MAE       MPE     MAPE      MASE
## Training set 0.01439511 0.2743907 0.1793612 0.1368576 2.237952 0.2130978
##                   ACF1
## Training set 0.4004224
## 
## Forecasts:
##          Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## Nov 2019       3.656130 3.506551 3.805708 3.427368 3.884891
## Dec 2019       3.602565 3.394289 3.810841 3.284034 3.921096
## Jan 2020       3.573305 3.319809 3.826801 3.185617 3.960994
## Feb 2020       3.550252 3.258671 3.841833 3.104317 3.996187
## Mar 2020       3.551106 3.224084 3.878128 3.050968 4.051243
## Apr 2020       3.574579 3.212871 3.936287 3.021394 4.127764
## May 2020       3.555781 3.165914 3.945649 2.959530 4.152033
## Jun 2020       3.510859 3.098001 3.923717 2.879448 4.142271
## Jul 2020       3.463736 3.030281 3.897191 2.800824 4.126649
## Aug 2020       3.452011 2.995124 3.908899 2.753262 4.150761
## Sep 2020       3.442745 2.963212 3.922277 2.709363 4.176126
## Oct 2020       3.442479 2.939932 3.945027 2.673899 4.211060

Upon plotting the time series of 30-year mortage rates it can be identified that there is a downward trend. It is difficult to determine based on that same plot if there are seasonal fluctuations however, there is a chance we are looking at spikes towards the end of every year

When working with multiplicative decomposition we see that all the seasonal indicies are close to 1. What this means is that based on these calculations, we do not have seasonality with the 30-year mortgage data. We can claim that mortgages in US do not have seasonalality.

Although we changed one of the observations to be an outlier; the output for the seasonally adjusted data seems to remain consistent as with no outlier included, based on the plots shown. Whether the outlier is near the end rather than the middle of the series seems to hold no significant effect on the results as the overall effect is similiar in both instances.

Based on the analyzing the RMSE of each method, we will go with the Holt-Winter multiplicative method as is has the lowest RMSE