#Data: currencies.RData
#Packaged: rugrach, rmgarch, vars
library(AER)
library(urca)
library(fUnitRoots)
library(car)
library(rugarch)
library(rmgarch)
library(vars)
library(forecast)
load("D:/Research Method in Fiance/Excel_file/currencies.RData")
spec = ugarchspec (mean.model = list(armaOrder =c(0,0)),variance.model = list(garchOrder =c(1,1),model ="sGARCH"))
ugarchfit(spec, data = currencies$rjpy)
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : sGARCH(1,1)
## Mean Model   : ARFIMA(0,0,0)
## Distribution : norm 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error  t value Pr(>|t|)
## mu      0.006403    0.004903   1.3059  0.19158
## omega   0.001640    0.000216   7.6027  0.00000
## alpha1  0.036849    0.001690  21.8038  0.00000
## beta1   0.956418    0.001184 808.0811  0.00000
## 
## Robust Standard Errors:
##         Estimate  Std. Error   t value Pr(>|t|)
## mu      0.006403    0.005947    1.0768  0.28157
## omega   0.001640    0.000608    2.6964  0.00701
## alpha1  0.036849    0.003673   10.0336  0.00000
## beta1   0.956418    0.000656 1457.4040  0.00000
## 
## LogLikelihood : -4344.782 
## 
## Information Criteria
## ------------------------------------
##                    
## Akaike       1.2180
## Bayes        1.2218
## Shibata      1.2180
## Hannan-Quinn 1.2193
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                         statistic p-value
## Lag[1]                      181.0       0
## Lag[2*(p+q)+(p+q)-1][2]     184.5       0
## Lag[4*(p+q)+(p+q)-1][5]     189.1       0
## d.o.f=0
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                         statistic   p-value
## Lag[1]                      20.79 5.114e-06
## Lag[2*(p+q)+(p+q)-1][5]     25.75 4.923e-07
## Lag[4*(p+q)+(p+q)-1][9]     31.56 1.634e-07
## d.o.f=2
## 
## Weighted ARCH LM Tests
## ------------------------------------
##             Statistic Shape Scale  P-Value
## ARCH Lag[3]     3.959 0.500 2.000 0.046614
## ARCH Lag[5]     8.886 1.440 1.667 0.012264
## ARCH Lag[7]    13.405 2.315 1.543 0.002842
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  1.1106
## Individual Statistics:             
## mu     0.1077
## omega  0.3804
## alpha1 0.4109
## beta1  0.5065
## 
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic:          1.07 1.24 1.6
## Individual Statistic:     0.35 0.47 0.75
## 
## Sign Bias Test
## ------------------------------------
##                    t-value      prob sig
## Sign Bias           1.1641 2.444e-01    
## Negative Sign Bias  6.0959 1.145e-09 ***
## Positive Sign Bias  0.9241 3.555e-01    
## Joint Effect       39.5060 1.356e-08 ***
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20      1911            0
## 2    30      2522            0
## 3    40      3038            0
## 4    50      3460            0
## 
## 
## Elapsed time : 0.663445

LjungBox Test: no auto correlated to itseft

spec = ugarchspec (mean.model = list(armaOrder =c(0,0)),variance.model = list(garchOrder =c(1,1),model ="eGARCH"))
ugarchfit(spec, data = currencies$rjpy)
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : eGARCH(1,1)
## Mean Model   : ARFIMA(0,0,0)
## Distribution : norm 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error   t value Pr(>|t|)
## mu      0.003186    0.004741   0.67207  0.50154
## omega  -0.011004    0.003004  -3.66269  0.00025
## alpha1 -0.028417    0.001212 -23.43837  0.00000
## beta1   0.986437    0.002677 368.53083  0.00000
## gamma1  0.102903    0.007283  14.12952  0.00000
## 
## Robust Standard Errors:
##         Estimate  Std. Error   t value Pr(>|t|)
## mu      0.003186    0.006297   0.50595 0.612894
## omega  -0.011004    0.009325  -1.18000 0.238001
## alpha1 -0.028417    0.009386  -3.02763 0.002465
## beta1   0.986437    0.007030 140.31135 0.000000
## gamma1  0.102903    0.026863   3.83062 0.000128
## 
## LogLikelihood : -4323 
## 
## Information Criteria
## ------------------------------------
##                    
## Akaike       1.2122
## Bayes        1.2170
## Shibata      1.2122
## Hannan-Quinn 1.2138
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                         statistic p-value
## Lag[1]                      182.6       0
## Lag[2*(p+q)+(p+q)-1][2]     185.7       0
## Lag[4*(p+q)+(p+q)-1][5]     189.8       0
## d.o.f=0
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                         statistic   p-value
## Lag[1]                      16.41 5.109e-05
## Lag[2*(p+q)+(p+q)-1][5]     22.55 3.845e-06
## Lag[4*(p+q)+(p+q)-1][9]     29.87 4.736e-07
## d.o.f=2
## 
## Weighted ARCH LM Tests
## ------------------------------------
##             Statistic Shape Scale   P-Value
## ARCH Lag[3]     4.453 0.500 2.000 0.0348425
## ARCH Lag[5]    10.646 1.440 1.667 0.0045694
## ARCH Lag[7]    16.477 2.315 1.543 0.0004957
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  1.8241
## Individual Statistics:              
## mu     0.09764
## omega  0.70287
## alpha1 0.17568
## beta1  0.57183
## gamma1 0.68365
## 
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic:          1.28 1.47 1.88
## Individual Statistic:     0.35 0.47 0.75
## 
## Sign Bias Test
## ------------------------------------
##                    t-value      prob sig
## Sign Bias            1.350 1.769e-01    
## Negative Sign Bias   5.095 3.575e-07 ***
## Positive Sign Bias   1.124 2.610e-01    
## Joint Effect        27.335 5.008e-06 ***
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20      1749            0
## 2    30      2308            0
## 3    40      2827            0
## 4    50      3225            0
## 
## 
## Elapsed time : 1.107285

gamma represent for leverage effect

spec = ugarchspec (mean.model = list(armaOrder =c(0,0)),variance.model = list(garchOrder =c(1,1),model ="gjrGARCH"))
ugarchfit(spec, data = currencies$rjpy)
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : gjrGARCH(1,1)
## Mean Model   : ARFIMA(0,0,0)
## Distribution : norm 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error  t value Pr(>|t|)
## mu      0.003522    0.004913   0.7169 0.473438
## omega   0.002037    0.000333   6.1231 0.000000
## alpha1  0.027579    0.003291   8.3791 0.000000
## beta1   0.950473    0.004008 237.1241 0.000000
## gamma1  0.026850    0.005349   5.0195 0.000001
## 
## Robust Standard Errors:
##         Estimate  Std. Error   t value Pr(>|t|)
## mu      0.003522    0.005938   0.59322 0.553036
## omega   0.002037    0.000764   2.66594 0.007677
## alpha1  0.027579    0.006218   4.43533 0.000009
## beta1   0.950473    0.006388 148.79911 0.000000
## gamma1  0.026850    0.010414   2.57816 0.009933
## 
## LogLikelihood : -4329.648 
## 
## Information Criteria
## ------------------------------------
##                    
## Akaike       1.2140
## Bayes        1.2188
## Shibata      1.2140
## Hannan-Quinn 1.2157
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                         statistic p-value
## Lag[1]                      185.1       0
## Lag[2*(p+q)+(p+q)-1][2]     188.2       0
## Lag[4*(p+q)+(p+q)-1][5]     192.4       0
## d.o.f=0
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                         statistic   p-value
## Lag[1]                      15.96 6.468e-05
## Lag[2*(p+q)+(p+q)-1][5]     23.44 2.163e-06
## Lag[4*(p+q)+(p+q)-1][9]     30.42 3.356e-07
## d.o.f=2
## 
## Weighted ARCH LM Tests
## ------------------------------------
##             Statistic Shape Scale   P-Value
## ARCH Lag[3]     5.856 0.500 2.000 0.0155276
## ARCH Lag[5]    12.548 1.440 1.667 0.0015551
## ARCH Lag[7]    17.377 2.315 1.543 0.0002948
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  1.5211
## Individual Statistics:              
## mu     0.05841
## omega  0.47122
## alpha1 0.47883
## beta1  0.63269
## gamma1 0.35973
## 
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic:          1.28 1.47 1.88
## Individual Statistic:     0.35 0.47 0.75
## 
## Sign Bias Test
## ------------------------------------
##                    t-value      prob sig
## Sign Bias           0.9567 3.388e-01    
## Negative Sign Bias  5.0233 5.202e-07 ***
## Positive Sign Bias  1.3087 1.907e-01    
## Joint Effect       27.4114 4.827e-06 ***
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20      1795            0
## 2    30      2328            0
## 3    40      2892            0
## 4    50      3214            0
## 
## 
## Elapsed time : 0.7462869

archm = T –> GARCH in mean

Using higher order for ARMA –> arma(2,3) Runing auto ARMA –> arma(5,3)

best_model <- auto.arima(currencies$rjpy)

# Hiển thị thông tin về mô hình tốt nhất
summary(best_model)
## Series: currencies$rjpy 
## ARIMA(5,0,3) with non-zero mean 
## 
## Coefficients:
##           ar1     ar2      ar3      ar4      ar5     ma1     ma2     ma3
##       -0.5434  0.0240  -0.1596  -0.0172  -0.0381  0.6758  0.0839  0.1691
## s.e.   0.3383  0.3039   0.4597   0.0695   0.0193  0.3383  0.3068  0.4669
##          mean
##       -0.0011
## s.e.   0.0061
## 
## sigma^2 = 0.2179:  log likelihood = -4687.96
## AIC=9395.92   AICc=9395.95   BIC=9464.65
## 
## Training set error measures:
##                       ME      RMSE      MAE MPE MAPE      MASE         ACF1
## Training set 0.000319364 0.4665194 0.315304 NaN  Inf 0.7222998 2.462168e-05
spec = ugarchspec (mean.model = list(armaOrder =c(5,3)),variance.model = list(garchOrder =c(1,1),model ="eGARCH"))
ugarchfit(spec, data = currencies$rjpy)
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : eGARCH(1,1)
## Mean Model   : ARFIMA(5,0,3)
## Distribution : norm 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error     t value Pr(>|t|)
## mu      0.002043    0.003182  6.4186e-01 0.520962
## ar1    -0.674212    0.002508 -2.6886e+02 0.000000
## ar2     0.096606    0.002895  3.3375e+01 0.000000
## ar3     0.612132    0.007636  8.0162e+01 0.000000
## ar4    -0.136416    0.005301 -2.5734e+01 0.000000
## ar5    -0.012144    0.000938 -1.2942e+01 0.000000
## ma1     0.865850    0.000183  4.7393e+03 0.000000
## ma2     0.071820    0.000120  5.9708e+02 0.000000
## ma3    -0.610346    0.000001 -1.0401e+06 0.000000
## omega  -0.012855    0.006328 -2.0316e+00 0.042195
## alpha1 -0.036833    0.006945 -5.3039e+00 0.000000
## beta1   0.986161    0.004814  2.0485e+02 0.000000
## gamma1  0.107242    0.014518  7.3870e+00 0.000000
## 
## Robust Standard Errors:
##         Estimate  Std. Error     t value Pr(>|t|)
## mu      0.002043    0.002628  7.7735e-01  0.43695
## ar1    -0.674212    0.003018 -2.2339e+02  0.00000
## ar2     0.096606    0.003479  2.7766e+01  0.00000
## ar3     0.612132    0.005255  1.1648e+02  0.00000
## ar4    -0.136416    0.003990 -3.4192e+01  0.00000
## ar5    -0.012144    0.000848 -1.4324e+01  0.00000
## ma1     0.865850    0.000115  7.5282e+03  0.00000
## ma2     0.071820    0.000620  1.1580e+02  0.00000
## ma3    -0.610346    0.000000 -1.9365e+06  0.00000
## omega  -0.012855    0.032297 -3.9804e-01  0.69061
## alpha1 -0.036833    0.037784 -9.7483e-01  0.32964
## beta1   0.986161    0.023714  4.1586e+01  0.00000
## gamma1  0.107242    0.079550  1.3481e+00  0.17762
## 
## LogLikelihood : -4210.115 
## 
## Information Criteria
## ------------------------------------
##                    
## Akaike       1.1828
## Bayes        1.1953
## Shibata      1.1828
## Hannan-Quinn 1.1871
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                          statistic p-value
## Lag[1]                      0.7912  0.3737
## Lag[2*(p+q)+(p+q)-1][23]    8.3292  1.0000
## Lag[4*(p+q)+(p+q)-1][39]   17.0633  0.8096
## d.o.f=8
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                         statistic   p-value
## Lag[1]                      12.22 4.721e-04
## Lag[2*(p+q)+(p+q)-1][5]     17.39 1.002e-04
## Lag[4*(p+q)+(p+q)-1][9]     23.14 3.054e-05
## d.o.f=2
## 
## Weighted ARCH LM Tests
## ------------------------------------
##             Statistic Shape Scale  P-Value
## ARCH Lag[3]     4.119 0.500 2.000 0.042395
## ARCH Lag[5]     8.802 1.440 1.667 0.012856
## ARCH Lag[7]    13.312 2.315 1.543 0.002993
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  13.9079
## Individual Statistics:              
## mu     0.10992
## ar1    0.06646
## ar2    0.06467
## ar3    0.12690
## ar4    0.29472
## ar5    0.23116
## ma1    0.06338
## ma2    0.06007
## ma3    0.12056
## omega  0.73560
## alpha1 0.20066
## beta1  0.55089
## gamma1 0.50904
## 
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic:          2.89 3.15 3.69
## Individual Statistic:     0.35 0.47 0.75
## 
## Sign Bias Test
## ------------------------------------
##                    t-value      prob sig
## Sign Bias           0.3538 7.235e-01    
## Negative Sign Bias  4.0134 6.046e-05 ***
## Positive Sign Bias  1.5270 1.268e-01    
## Joint Effect       19.5902 2.064e-04 ***
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20     837.9   1.868e-165
## 2    30     900.7   7.692e-171
## 3    40     923.0   2.728e-168
## 4    50     956.2   1.825e-168
## 
## 
## Elapsed time : 3.423373
meanmodel = list(armaOrder =c(0,0),archm =T, archpow =2)
varmodel = list(garchOrder =c(1,1),model ="sGARCH")
spec = ugarchspec(mean.model = meanmodel , variance.model = varmodel)
ugarchfit(spec , data = currencies$rjpy)
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : sGARCH(1,1)
## Mean Model   : ARFIMA(0,0,0)
## Distribution : norm 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error   t value Pr(>|t|)
## mu      0.011268    0.010089   1.11679  0.26409
## archm  -0.027702    0.050193  -0.55192  0.58101
## omega   0.001626    0.000156  10.44456  0.00000
## alpha1  0.036768    0.000379  96.99834  0.00000
## beta1   0.956565    0.001895 504.80735  0.00000
## 
## Robust Standard Errors:
##         Estimate  Std. Error   t value Pr(>|t|)
## mu      0.011268    0.012151   0.92732 0.353762
## archm  -0.027702    0.053756  -0.51533 0.606322
## omega   0.001626    0.000600   2.70965 0.006735
## alpha1  0.036768    0.003722   9.87807 0.000000
## beta1   0.956565    0.001787 535.35329 0.000000
## 
## LogLikelihood : -4344.631 
## 
## Information Criteria
## ------------------------------------
##                    
## Akaike       1.2182
## Bayes        1.2230
## Shibata      1.2182
## Hannan-Quinn 1.2199
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                         statistic p-value
## Lag[1]                      181.0       0
## Lag[2*(p+q)+(p+q)-1][2]     184.5       0
## Lag[4*(p+q)+(p+q)-1][5]     189.1       0
## d.o.f=0
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                         statistic   p-value
## Lag[1]                      21.08 4.414e-06
## Lag[2*(p+q)+(p+q)-1][5]     26.01 4.178e-07
## Lag[4*(p+q)+(p+q)-1][9]     31.82 1.382e-07
## d.o.f=2
## 
## Weighted ARCH LM Tests
## ------------------------------------
##             Statistic Shape Scale  P-Value
## ARCH Lag[3]     3.933 0.500 2.000 0.047344
## ARCH Lag[5]     8.835 1.440 1.667 0.012622
## ARCH Lag[7]    13.384 2.315 1.543 0.002875
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  1.2634
## Individual Statistics:              
## mu     0.08123
## archm  0.06069
## omega  0.38441
## alpha1 0.40883
## beta1  0.50746
## 
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic:          1.28 1.47 1.88
## Individual Statistic:     0.35 0.47 0.75
## 
## Sign Bias Test
## ------------------------------------
##                    t-value      prob sig
## Sign Bias            1.065 2.870e-01    
## Negative Sign Bias   6.068 1.358e-09 ***
## Positive Sign Bias   1.001 3.169e-01    
## Joint Effect        39.673 1.250e-08 ***
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20      1799            0
## 2    30      2339            0
## 3    40      2826            0
## 4    50      3161            0
## 
## 
## Elapsed time : 1.277665
View(currencies)
fit = ugarchfit(spec, data=currencies$rjpy, out.sample=700)
static_fc = ugarchforecast(fit, n.ahead=1, n.roll=699)
dynamic_fc = ugarchforecast(fit, n.ahead=700)
par ( lwd =2, cex.axis = 2)
x_axis = currencies$Date [ currencies$Date >= "2016-08-03"]
plot ( x_axis , static_fc@forecast$sigmaFor , type ="l", xlab ="", ylab ="", col ="blue3"
)
lines ( x_axis , dynamic_fc@forecast$sigmaFor , col ="brown1")
legend ("bottomleft", legend = c ("Static", "Dynamic") , col = c("blue3","brown1") ,
lty = 1)

static_fc@forecast$sigmaFor  ##Volatility
##     1987-08-21 1987-08-22 1987-08-23 1987-08-24 1987-08-25 1987-08-26
## T+1  0.6826303   0.678263  0.6641801  0.6505759  0.6434195  0.6299555
##     1987-08-27 1987-08-28 1987-08-29 1987-08-30 1987-08-31 1987-09-01
## T+1  0.6231143  0.6102896  0.6184922  0.6056829  0.5962448   0.589531
##     1987-09-02 1987-09-03 1987-09-04 1987-09-05 1987-09-06 1987-09-07
## T+1  0.5774568  0.5661485  0.5720892  0.5605903  0.5569587  0.5463362
##     1987-09-08 1987-09-09 1987-09-10 1987-09-11 1987-09-12 1987-09-13
## T+1  0.5354129  0.5247622  0.5184104  0.5132586  0.5041226   0.494981
##     1987-09-14 1987-09-15 1987-09-16 1987-09-17 1987-09-18 1987-09-19
## T+1   0.487564  0.5241105  0.5137614  0.5068199  0.4999974  0.5127762
##     1987-09-20 1987-09-21 1987-09-22 1987-09-23 1987-09-24 1987-09-25
## T+1  0.5039947  0.4956527  0.4909525  0.4814986  0.4791588  0.4782978
##     1987-09-26 1987-09-27 1987-09-28 1987-09-29 1987-09-30 1987-10-01
## T+1  0.5465182  0.5370277  0.5393924  0.5306867  0.5201619  0.5187172
##     1987-10-02 1987-10-03 1987-10-04 1987-10-05 1987-10-06 1987-10-07
## T+1  0.5093211  0.5155222  0.5112841  0.5034367  0.4946633  0.4851085
##     1987-10-08 1987-10-09 1987-10-10 1987-10-11 1987-10-12 1987-10-13
## T+1  0.4794534  0.4712405  0.4699986  0.4877799  0.4844847  0.4752462
##     1987-10-14 1987-10-15 1987-10-16 1987-10-17 1987-10-18 1987-10-19
## T+1  0.4662225  0.4632573  0.4557307  0.4478942  0.4601717   0.452094
##     1987-10-20 1987-10-21 1987-10-22 1987-10-23 1987-10-24 1987-10-25
## T+1  0.4447112  0.4365367  0.4288566   0.457448  0.4696097  0.4747271
##     1987-10-26 1987-10-27 1987-10-28 1987-10-29 1987-10-30 1987-10-31
## T+1  0.4663039  0.4754378  0.4664088   0.463269  0.4616188   0.453062
##     1987-11-01 1987-11-02 1987-11-03 1987-11-04 1987-11-05 1987-11-06
## T+1  0.4448626  0.4382886  0.4307612  0.4229812  0.4157362  0.4099633
##     1987-11-07 1987-11-08 1987-11-09 1987-11-10 1987-11-11 1987-11-12
## T+1  0.4083028  0.4021054  0.3968392  0.3903962  0.3837859  0.3787619
##     1987-11-13 1987-11-14 1987-11-15 1987-11-16 1987-11-17 1987-11-18
## T+1  0.3797603  0.3741547  0.3781163  0.3794811   0.383203  0.3768062
##     1987-11-19 1987-11-20 1987-11-21 1987-11-22 1987-11-23 1987-11-24
## T+1  0.3715973  0.3672546   0.417289    0.42419  0.4166041  0.4093869
##     1987-11-25 1987-11-26 1987-11-27 1987-11-28 1987-11-29 1987-11-30
## T+1  0.4022206   0.454197  0.4500036  0.4620435  0.6068672  0.6015014
##     1987-12-01 1987-12-02 1987-12-03 1987-12-04 1987-12-05 1987-12-06
## T+1   0.589392  0.5773214   0.595795  0.5978751  0.6044845  0.5920351
##     1987-12-07 1987-12-08 1987-12-09 1987-12-10 1987-12-11 1987-12-12
## T+1  0.6216099  0.6132946  0.6006045  0.5882856  0.5763394  0.5759664
##     1987-12-13 1987-12-14 1987-12-15 1987-12-16 1987-12-17 1987-12-18
## T+1  0.6196728  0.6082048  0.5956909  0.5834577  0.5956134  0.5835285
##     1987-12-19 1987-12-20 1987-12-21 1987-12-22 1987-12-23 1987-12-24
## T+1  0.5860833  0.6104056  0.6027306  0.5932877  0.5811158  0.5721012
##     1987-12-25 1987-12-26 1987-12-27 1987-12-28 1987-12-29 1987-12-30
## T+1  0.5605248  0.5497197  0.5410226  0.5532263  0.5538819  0.5427417
##     1987-12-31 1988-01-01 1988-01-02 1988-01-03 1988-01-04 1988-01-05
## T+1  0.5325126  0.5244241   0.514118  0.6629531  0.6514462  0.6385486
##     1988-01-06 1988-01-07 1988-01-08 1988-01-09 1988-01-10 1988-01-11
## T+1  0.6252091  0.6196652  0.6097664  0.5973745  0.5850986  0.5740843
##     1988-01-12 1988-01-13 1988-01-14 1988-01-15 1988-01-16 1988-01-17
## T+1  0.5625122  0.5511447  0.5400768  0.5293421  0.5198033  0.5317406
##     1988-01-18 1988-01-19 1988-01-20 1988-01-21 1988-01-22 1988-01-23
## T+1  0.5213064  0.5131527  0.5030973  0.4933136  0.4962347  0.4866364
##     1988-01-24 1988-01-25 1988-01-26 1988-01-27 1988-01-28 1988-01-29
## T+1  0.5324183  0.5225299   0.531903  0.5213459  0.5114069  0.5330815
##     1988-01-30 1988-01-31 1988-02-01 1988-02-02 1988-02-03 1988-02-04
## T+1  0.5230863  0.5694731  0.5599628   0.550732  0.5396751  0.5323597
##     1988-02-05 1988-02-06 1988-02-07 1988-02-08 1988-02-09 1988-02-10
## T+1  0.5369777   0.527452  0.5829762  0.5712142   0.561938  0.5505855
##     1988-02-11 1988-02-12 1988-02-13 1988-02-14 1988-02-15 1988-02-16
## T+1  0.5681389   0.560521  0.5548771  0.5452472  0.5670394  0.5559006
##     1988-02-17 1988-02-18 1988-02-19 1988-02-20 1988-02-21 1988-02-22
## T+1  0.5447071  0.5467009  0.5647557  0.5538555   0.550079  0.5396708
##     1988-02-23 1988-02-24 1988-02-25 1988-02-26 1988-02-27 1988-02-28
## T+1  0.5313057  0.5207646  0.5118213  0.5053268  0.4958756  0.4883479
##     1988-02-29 1988-03-01 1988-03-02 1988-03-03 1988-03-04 1988-03-05
## T+1  0.5159902  0.5086768  0.4987432  0.4978179  0.4882432  0.4925098
##     1988-03-06 1988-03-07 1988-03-08 1988-03-09 1988-03-10 1988-03-11
## T+1  0.4971039  0.4993747  0.4927152  0.4832148   0.476444  0.4739222
##     1988-03-12 1988-03-13 1988-03-14 1988-03-15 1988-03-16 1988-03-17
## T+1  0.4659558  0.4602569  0.4617943  0.4585968   0.450034  0.4423259
##     1988-03-18 1988-03-19 1988-03-20 1988-03-21 1988-03-22 1988-03-23
## T+1  0.4345447  0.4681733  0.4756273  0.4670454  0.4615089  0.4528644
##     1988-03-24 1988-03-25 1988-03-26 1988-03-27 1988-03-28 1988-03-29
## T+1  0.4453835  0.4376055  0.4302198   0.431659  0.4341363  0.4313294
##     1988-03-30 1988-03-31 1988-04-01 1988-04-02 1988-04-03 1988-04-04
## T+1  0.4235383  0.4161653  0.4092982   0.405272  0.4529917  0.4458293
##     1988-04-05 1988-04-06 1988-04-07 1988-04-08 1988-04-09 1988-04-10
## T+1  0.4442564  0.4360947  0.4283368  0.4227297  0.4557239  0.4485474
##     1988-04-11 1988-04-12 1988-04-13 1988-04-14 1988-04-15 1988-04-16
## T+1  0.4403067  0.4333807  0.4255268  0.4474445  0.4408751  0.4391777
##     1988-04-17 1988-04-18 1988-04-19 1988-04-20 1988-04-21 1988-04-22
## T+1   0.432446  0.4329429    0.43026  0.4224943   0.415633  0.4246301
##     1988-04-23 1988-04-24 1988-04-25 1988-04-26 1988-04-27 1988-04-28
## T+1  0.4196516  0.4138938  0.4067772  0.4034055  0.3964126  0.3905493
##     1988-04-29 1988-04-30 1988-05-01 1988-05-02 1988-05-03 1988-05-04
## T+1  0.4116402  0.4317127  0.4348856  0.4279216   0.422645  0.4150967
##     1988-05-05 1988-05-06 1988-05-07 1988-05-08 1988-05-09 1988-05-10
## T+1  0.4092702  0.4074795  0.4006308  0.3974821  0.3911792   0.385262
##     1988-05-11 1988-05-12 1988-05-13 1988-05-14 1988-05-15 1988-05-16
## T+1  0.3788039  0.4105523  0.4084922   0.431604  0.4238885  0.4164455
##     1988-05-17 1988-05-18 1988-05-19 1988-05-20 1988-05-21 1988-05-22
## T+1  0.4103062  0.4031133  0.3968271  0.3954502  0.3898469   0.393243
##     1988-05-23 1988-05-24 1988-05-25 1988-05-26 1988-05-27 1988-05-28
## T+1  0.3892493  0.3842738  0.3778451  0.3719643  0.3964503  0.3920499
##     1988-05-29 1988-05-30 1988-05-31 1988-06-01 1988-06-02 1988-06-03
## T+1   0.385924  0.3875727  0.3842706   0.377842    0.37244  0.3665433
##     1988-06-04 1988-06-05 1988-06-06 1988-06-07 1988-06-08 1988-06-09
## T+1  0.4290777  0.4648807  0.4603475  0.4524429  0.4440516   0.436135
##     1988-06-10 1988-06-11 1988-06-12 1988-06-13 1988-06-14 1988-06-15
## T+1  0.4283055  0.4324571  0.4252689   0.422179  0.4148964  0.4075708
##     1988-06-16 1988-06-17 1988-06-18 1988-06-19 1988-06-20 1988-06-21
## T+1  0.4004555   0.398861  0.3926951  0.3888089  0.3823703  0.4010424
##     1988-06-22 1988-06-23 1988-06-24 1988-06-25 1988-06-26 1988-06-27
## T+1  0.3941191  0.3878806  0.4071112   0.402717  0.4043487  0.4023987
##     1988-06-28 1988-06-29 1988-06-30 1988-07-01 1988-07-02 1988-07-03
## T+1   0.395446  0.3886868  0.3853564  0.3789581  0.3745541  0.3698783
##     1988-07-04 1988-07-05 1988-07-06 1988-07-07 1988-07-08 1988-07-09
## T+1  0.4063803   0.400408  0.3935032  0.3892863  0.3900911  0.3858324
##     1988-07-10 1988-07-11 1988-07-12 1988-07-13 1988-07-14 1988-07-15
## T+1  0.3801215  0.3739182  0.3677987  0.3618651  0.3575606  0.3605399
##     1988-07-16 1988-07-17 1988-07-18 1988-07-19 1988-07-20 1988-07-21
## T+1  0.3569844  0.3524432  0.3497508  0.3477913   0.342473  0.3452645
##     1988-07-22 1988-07-23 1988-07-24 1988-07-25 1988-07-26 1988-07-27
## T+1  0.3461796  0.3410506  0.3362145  0.3416815  0.3383419  0.3333204
##     1988-07-28 1988-07-29 1988-07-30 1988-07-31 1988-08-01 1988-08-02
## T+1  0.3305042  0.3257462  0.3506338  0.3466331  0.3441676  0.3483502
##     1988-08-03 1988-08-04 1988-08-05 1988-08-06 1988-08-07 1988-08-08
## T+1  0.3430126  0.3380803  0.3441849  0.3406681  0.3359323  0.3440646
##     1988-08-09 1988-08-10 1988-08-11 1988-08-12 1988-08-13 1988-08-14
## T+1   0.344774  0.3396526  0.3353392  0.3395619  0.3383181  0.3466603
##     1988-08-15 1988-08-16 1988-08-17 1988-08-18 1988-08-19 1988-08-20
## T+1   0.344628  0.3431209  0.3382964  0.3342881  0.3311482  0.3323302
##     1988-08-21 1988-08-22 1988-08-23 1988-08-24 1988-08-25 1988-08-26
## T+1  0.3312552  0.3264538   0.326121  0.3216611   0.317183  0.3167578
##     1988-08-27 1988-08-28 1988-08-29 1988-08-30 1988-08-31 1988-09-01
## T+1  0.3302413  0.3289446   0.341153  0.3365259  0.3316508  0.3356656
##     1988-09-02 1988-09-03 1988-09-04 1988-09-05 1988-09-06 1988-09-07
## T+1  0.3629771  0.3583138  0.3785949  0.3902975  0.3836899  0.3777038
##     1988-09-08 1988-09-09 1988-09-10 1988-09-11 1988-09-12 1988-09-13
## T+1  0.3756565  0.3748537  0.3694672  0.3636288   0.358945  0.3534871
##     1988-09-14 1988-09-15 1988-09-16 1988-09-17 1988-09-18 1988-09-19
## T+1  0.3495565  0.3450496  0.3413106  0.3900043  0.3858789  0.3809718
##     1988-09-20 1988-09-21 1988-09-22 1988-09-23 1988-09-24 1988-09-25
## T+1  0.3750732  0.3801934   0.374265  0.3812101  0.3769569  0.3718206
##     1988-09-26 1988-09-27 1988-09-28 1988-09-29 1988-09-30 1988-10-01
## T+1  0.4027266  0.3957926  0.3972331  0.4017237  0.4324378  0.4328393
##     1988-10-02 1988-10-03 1988-10-04 1988-10-05 1988-10-06 1988-10-07
## T+1  0.4265198  0.4211777   0.414014  0.4089782  0.4048296  0.3991335
##     1988-10-08 1988-10-09 1988-10-10 1988-10-11 1988-10-12 1988-10-13
## T+1  0.3924822  0.4108811    0.41176  0.4045493  0.4006333  0.3964465
##     1988-10-14 1988-10-15 1988-10-16 1988-10-17 1988-10-18 1988-10-19
## T+1  0.3900571  0.4066039   0.399588  0.3934826  0.3868256   0.380318
##     1988-10-20 1988-10-21 1988-10-22 1988-10-23 1988-10-24 1988-10-25
## T+1  0.3761515  0.3713027  0.3692452  0.3633835  0.3585138  0.3552363
##     1988-10-26 1988-10-27 1988-10-28 1988-10-29 1988-10-30 1988-10-31
## T+1  0.3497216  0.3443395  0.3412192  0.3364395  0.3316234  0.3321103
##     1988-11-01 1988-11-02 1988-11-03 1988-11-04 1988-11-05 1988-11-06
## T+1  0.3287848  0.3240624  0.3198268  0.3189177  0.3241338  0.3195856
##     1988-11-07 1988-11-08 1988-11-09 1988-11-10 1988-11-11 1988-11-12
## T+1  0.3320613  0.3291294  0.3244179  0.3209376  0.3165117  0.3130751
##     1988-11-13 1988-11-14 1988-11-15 1988-11-16 1988-11-17 1988-11-18
## T+1  0.3094115  0.3077153  0.3036875  0.3043787  0.3037034  0.3001741
##     1988-11-19 1988-11-20 1988-11-21 1988-11-22 1988-11-23 1988-11-24
## T+1  0.3146359  0.3103728  0.3064479  0.3025648  0.2987041  0.2950533
##     1988-11-25 1988-11-26 1988-11-27 1988-11-28 1988-11-29 1988-11-30
## T+1  0.2919979  0.2927157  0.2912954  0.2884125  0.2852257  0.2819596
##     1988-12-01 1988-12-02 1988-12-03 1988-12-04 1988-12-05 1988-12-06
## T+1   0.278825    0.27585  0.2926611  0.2892503  0.3064438  0.3087497
##     1988-12-07 1988-12-08 1988-12-09 1988-12-10 1988-12-11 1988-12-12
## T+1  0.3046869  0.3025953   0.300729  0.3172102  0.3324874  0.3299682
##     1988-12-13 1988-12-14 1988-12-15 1988-12-16 1988-12-17 1988-12-18
## T+1  0.3252133  0.3207779   0.321729  0.3174081  0.3210697  0.3319153
##     1988-12-19 1988-12-20 1988-12-21 1988-12-22 1988-12-23 1988-12-24
## T+1  0.3275395  0.3263092  0.3217497  0.3336278  0.3304344  0.3321224
##     1988-12-25 1988-12-26 1988-12-27 1988-12-28 1988-12-29 1988-12-30
## T+1  0.3367802  0.3553276  0.3497756  0.3444566  0.3392683  0.3342508
##     1988-12-31 1989-01-01 1989-01-02 1989-01-03 1989-01-04 1989-01-05
## T+1   0.335312  0.3463348  0.3429069  0.3377415  0.3352517  0.3304592
##     1989-01-06 1989-01-07 1989-01-08 1989-01-09 1989-01-10 1989-01-11
## T+1  0.3266338  0.3300001  0.3279808  0.3236734  0.3191213  0.3147172
##     1989-01-12 1989-01-13 1989-01-14 1989-01-15 1989-01-16 1989-01-17
## T+1  0.3106028  0.3065645  0.3025914  0.3046414  0.3045044   0.300584
##     1989-01-18 1989-01-19 1989-01-20 1989-01-21 1989-01-22 1989-01-23
## T+1  0.2967958  0.2931565  0.2943833   0.291006  0.2934429  0.2969793
##     1989-01-24 1989-01-25 1989-01-26 1989-01-27 1989-01-28 1989-01-29
## T+1  0.2933134  0.2897825  0.2864406  0.2933427  0.3346778  0.3330572
##     1989-01-30 1989-01-31 1989-02-01 1989-02-02 1989-02-03 1989-02-04
## T+1  0.3328588  0.3280114  0.3244131  0.3291519  0.3245634  0.3204363
##     1989-02-05 1989-02-06 1989-02-07 1989-02-08 1989-02-09 1989-02-10
## T+1   0.321937  0.3261578  0.3216345  0.3171692  0.3129181  0.3123861
##     1989-02-11 1989-02-12 1989-02-13 1989-02-14 1989-02-15 1989-02-16
## T+1  0.3600856  0.3656425  0.3599927  0.3620209  0.3562593  0.3533836
##     1989-02-17 1989-02-18 1989-02-19 1989-02-20 1989-02-21 1989-02-22
## T+1  0.3485466  0.3448695  0.3505141  0.3555523  0.3522391  0.3467816
##     1989-02-23 1989-02-24 1989-02-25 1989-02-26 1989-02-27 1989-02-28
## T+1  0.3478306  0.3626271  0.3576178  0.3519933  0.3562939  0.3508539
##     1989-03-01 1989-03-02 1989-03-03 1989-03-04 1989-03-05 1989-03-06
## T+1   0.345439  0.3412971  0.3623612  0.3807218   0.400955  0.3992992
##     1989-03-07 1989-03-08 1989-03-09 1989-03-10 1989-03-11 1989-03-12
## T+1  0.3939642  0.3872495  0.3825066  0.3899231  0.3964793  0.4011643
##     1989-03-13 1989-03-14 1989-03-15 1989-03-16 1989-03-17 1989-03-18
## T+1  0.3981003  0.3913425   0.384703  0.3789032  0.3777692  0.3725334
##     1989-03-19 1989-03-20 1989-03-21 1989-03-22 1989-03-23 1989-03-24
## T+1  0.3710022  0.4066173  0.3995319  0.3926687  0.3860263  0.3858727
##     1989-03-25 1989-03-26 1989-03-27 1989-03-28 1989-03-29 1989-03-30
## T+1  0.3844789  0.3818592  0.3940842  0.3874274  0.3809029  0.3783165
##     1989-03-31 1989-04-01 1989-04-02 1989-04-03 1989-04-04 1989-04-05
## T+1  0.3732744  0.3712316  0.3712482  0.3660762  0.3602515   0.354549
##     1989-04-06 1989-04-07 1989-04-08 1989-04-09 1989-04-10 1989-04-11
## T+1  0.3491106  0.3521371  0.3472017  0.3680228  0.3831051  0.3781751
##     1989-04-12 1989-04-13 1989-04-14 1989-04-15 1989-04-16 1989-04-17
## T+1  0.3719271  0.3726788  0.3769358  0.3816742  0.3831725  0.3807561
##     1989-04-18 1989-04-19 1989-04-20 1989-04-21 1989-04-22 1989-04-23
## T+1  0.3744988  0.3683609  0.3632452  0.3577782  0.3546749  0.3688651
##     1989-04-24 1989-04-25 1989-04-26 1989-04-27 1989-04-28 1989-04-29
## T+1  0.3628957  0.3596968  0.3540088  0.3485011  0.3439977  0.3403224
##     1989-04-30 1989-05-01 1989-05-02 1989-05-03 1989-05-04 1989-05-05
## T+1  0.3363927  0.3386149  0.3344762  0.3295779  0.3262822  0.3235796
##     1989-05-06 1989-05-07 1989-05-08 1989-05-09 1989-05-10 1989-05-11
## T+1  0.3211389  0.3175495  0.3157392  0.3114633  0.3073065  0.3206513
##     1989-05-12 1989-05-13 1989-05-14 1989-05-15 1989-05-16 1989-05-17
## T+1   0.333282  0.3339082  0.3296325  0.3255422  0.3222394  0.3177283
##     1989-05-18 1989-05-19 1989-05-20 1989-05-21 1989-05-22 1989-05-23
## T+1  0.3149243   0.316982   0.314733  0.3196829  0.3211028  0.3166402
##     1989-05-24 1989-05-25 1989-05-26 1989-05-27 1989-05-28 1989-05-29
## T+1  0.3123157   0.308155  0.3046181  0.3185786  0.3142945   0.313786
##     1989-05-30 1989-05-31 1989-06-01 1989-06-02 1989-06-03 1989-06-04
## T+1  0.3095859  0.3055021  0.3022181  0.3145564  0.3114712  0.3136584
##     1989-06-05 1989-06-06 1989-06-07 1989-06-08 1989-06-09 1989-06-10
## T+1  0.3122997  0.3086259   0.304562  0.3077512  0.3062141   0.334046
##     1989-06-11 1989-06-12 1989-06-13 1989-06-14 1989-06-15 1989-06-16
## T+1  0.3537448  0.3482463  0.3430511  0.3379105  0.3329464  0.3464595
##     1989-06-17 1989-06-18 1989-06-19 1989-06-20 1989-06-21 1989-06-22
## T+1  0.3412223  0.3362729  0.3475693  0.3438123  0.3386198  0.3343404
##     1989-06-23 1989-06-24 1989-06-25 1989-06-26 1989-06-27 1989-06-28
## T+1  0.3302292  0.3285887  0.3252596  0.3279081  0.3232163  0.3187117
##     1989-06-29 1989-06-30 1989-07-01 1989-07-02 1989-07-03 1989-07-04
## T+1  0.3215971  0.3246116   0.321513  0.3191691  0.3195368  0.3151492
##     1989-07-05 1989-07-06 1989-07-07 1989-07-08 1989-07-09 1989-07-10
## T+1  0.3108757   0.308352  0.3222194   0.321155  0.3170618  0.3165078
##     1989-07-11 1989-07-12 1989-07-13 1989-07-14 1989-07-15 1989-07-16
## T+1  0.3123068  0.3081416  0.3129114  0.3107968  0.3112928   0.309541
##     1989-07-17 1989-07-18 1989-07-19 1989-07-20
## T+1  0.3118025   0.307633  0.3036066  0.3003993
static_fc@forecast$seriesFor  ##Mean
##       1987-08-21   1987-08-22   1987-08-23   1987-08-24   1987-08-25
## T+1 -0.004654263 -0.004418605 -0.003669009 -0.002959826 -0.002592656
##       1987-08-26   1987-08-27    1987-08-28   1987-08-29    1987-08-30
## T+1 -0.001912876 -0.001572978 -0.0009457949 -0.001345435 -0.0007236954
##        1987-08-31   1987-09-01   1987-09-02  1987-09-03   1987-09-04
## T+1 -0.0002739087 4.174126e-05 0.0006004269 0.001113186 0.0008450733
##      1987-09-05  1987-09-06  1987-09-07 1987-09-08 1987-09-09  1987-09-10
## T+1 0.001361497 0.001522415 0.001987096 0.00245561 0.00290332 0.003166037
##      1987-09-11  1987-09-12  1987-09-13  1987-09-14  1987-09-15 1987-09-16
## T+1 0.003376776 0.003745309 0.004107446 0.004396396 0.002930422  0.0033563
##      1987-09-17  1987-09-18  1987-09-19  1987-09-20  1987-09-21  1987-09-22
## T+1 0.003637195 0.003909548 0.003396399 0.003750424 0.004081064 0.004264931
##      1987-09-23  1987-09-24  1987-09-25  1987-09-26  1987-09-27  1987-09-28
## T+1 0.004629447 0.004718571 0.004751257 0.001979214 0.002386946 0.002286019
##      1987-09-29  1987-09-30  1987-10-01  1987-10-02  1987-10-03  1987-10-04
## T+1 0.002655388 0.003093912 0.003153422 0.003536422 0.003284442 0.003456985
##      1987-10-05  1987-10-06  1987-10-07  1987-10-08  1987-10-09  1987-10-10
## T+1 0.003772711 0.004119912 0.004491096 0.004707374 0.005016957 0.005063302
##      1987-10-11  1987-10-12  1987-10-13  1987-10-14  1987-10-15  1987-10-16
## T+1 0.004388048 0.004515077 0.004866629 0.005203475 0.005312755 0.005587003
##      1987-10-17  1987-10-18  1987-10-19  1987-10-20  1987-10-21  1987-10-22
## T+1 0.005867773 0.005425727 0.005717906 0.005980427 0.006266053 0.006529577
##      1987-10-23  1987-10-24  1987-10-25  1987-10-26  1987-10-27  1987-10-28
## T+1 0.005524825 0.005077792 0.004886183 0.005200464 0.004859409 0.005196587
##      1987-10-29  1987-10-30  1987-10-31  1987-11-01  1987-11-02  1987-11-03
## T+1 0.005312323 0.005372838 0.005683166 0.005975087 0.006205287 0.006464662
##      1987-11-04  1987-11-05  1987-11-06  1987-11-07  1987-11-08  1987-11-09
## T+1 0.006728018 0.006968952 0.007157947 0.007211822 0.007410959 0.007577781
##     1987-11-10  1987-11-11  1987-11-12  1987-11-13  1987-11-14  1987-11-15
## T+1 0.00777889 0.007981801 0.008133701 0.008103674 0.008271239 0.008153075
##      1987-11-16  1987-11-17 1987-11-18  1987-11-19  1987-11-20  1987-11-21
## T+1 0.008112077 0.007999527 0.00819229 0.008346859 0.008474078 0.006917664
##      1987-11-22  1987-11-23  1987-11-24  1987-11-25  1987-11-26  1987-11-27
## T+1 0.006687415 0.006940307 0.007176675 0.007407284 0.005642337 0.005792676
##      1987-11-28   1987-11-29    1987-11-30   1987-12-01   1987-12-02
## T+1 0.005357285 -0.000780631 -0.0005235497 4.823872e-05 0.0006066252
##        1987-12-03    1987-12-04    1987-12-05    1987-12-06   1987-12-07
## T+1 -0.0002526517 -0.0003510986 -0.0006661915 -7.557339e-05 -0.001498729
##       1987-12-08    1987-12-09   1987-12-10   1987-12-11   1987-12-12
## T+1 -0.001091583 -0.0004807986 9.990291e-05 0.0006515416 0.0006685871
##       1987-12-13    1987-12-14    1987-12-15   1987-12-16    1987-12-17
## T+1 -0.001403391 -0.0008450735 -0.0002477342 0.0003242036 -0.0002440742
##       1987-12-18   1987-12-19  1987-12-20    1987-12-21    1987-12-22
## T+1 0.0003209299 0.0002024503 -0.00095141 -0.0005822377 -0.0001344397
##       1987-12-23   1987-12-24  1987-12-25  1987-12-26  1987-12-27  1987-12-28
## T+1 0.0004323429 0.0008445298 0.001364408 0.001840059 0.002216188 0.001686709
##      1987-12-29  1987-12-30  1987-12-31  1988-01-01  1988-01-02   1988-01-03
## T+1 0.001657928 0.002142316 0.002578418 0.002917383 0.003341765 -0.003604445
##       1988-01-04   1988-01-05   1988-01-06   1988-01-07    1988-01-08
## T+1 -0.003004757 -0.002345068 -0.001676662 -0.001403018 -0.0009204868
##        1988-01-09   1988-01-10   1988-01-11  1988-01-12  1988-01-13  1988-01-14
## T+1 -0.0003273764 0.0002481748 0.0007544066 0.001275911 0.001777859 0.002256729
##      1988-01-15  1988-01-16  1988-01-17  1988-01-18  1988-01-19  1988-01-20
## T+1 0.002711904 0.003108701 0.002610992 0.003046652 0.003381084 0.003786258
##      1988-01-21  1988-01-22  1988-01-23  1988-01-24  1988-01-25  1988-01-26
## T+1 0.004172784 0.004058177 0.004432225 0.002582399 0.002996015 0.002604143
##      1988-01-27  1988-01-28  1988-01-29  1988-01-30   1988-01-31  1988-02-01
## T+1 0.003045019 0.003452006 0.002554381 0.002972947 0.0009634875 0.001389377
##      1988-02-02  1988-02-03  1988-02-04  1988-02-05  1988-02-06   1988-02-07
## T+1 0.001795887 0.002273926 0.002584873 0.002389075 0.002791102 0.0003464703
##       1988-02-08  1988-02-09  1988-02-10  1988-02-11  1988-02-12  1988-02-13
## T+1 0.0008847386 0.001301512 0.001802285 0.001023667 0.001364576 0.001614177
##      1988-02-14  1988-02-15  1988-02-16  1988-02-17  1988-02-18  1988-02-19
## T+1 0.002034232 0.001073153 0.001569104 0.002057574 0.001971293 0.001175637
##      1988-02-20  1988-02-21 1988-02-22  1988-02-23  1988-02-24  1988-02-25
## T+1 0.001659089 0.001824389 0.00227411 0.002629324 0.003069038 0.003435192
##      1988-02-26  1988-02-27  1988-02-28 1988-02-29  1988-03-01  1988-03-02
## T+1 0.003697115 0.004072301 0.004366064  0.0032653 0.003562428 0.003959214
##      1988-03-03  1988-03-04  1988-03-05  1988-03-06  1988-03-07  1988-03-08
## T+1 0.003995777 0.004370116 0.004204204 0.004023942 0.003934223 0.004196179
##      1988-03-09  1988-03-10  1988-03-11  1988-03-12  1988-03-13  1988-03-14
## T+1 0.004563801 0.004821431 0.004916457 0.005213333 0.005422621 0.005366413
##      1988-03-15  1988-03-16  1988-03-17  1988-03-18 1988-03-19  1988-03-20
## T+1 0.005483101 0.005791591 0.006064318 0.006334851  0.0051312 0.004852262
##      1988-03-21  1988-03-22  1988-03-23  1988-03-24  1988-03-25  1988-03-26
## T+1 0.005173025 0.005376862 0.005690266 0.005956698 0.006229007 0.006483142
##      1988-03-27  1988-03-28 1988-03-29  1988-03-30  1988-03-31  1988-04-01
## T+1 0.006433961 0.006348919 0.00644524 0.006709319 0.006954797 0.007179551
##      1988-04-02  1988-04-03  1988-04-04  1988-04-05  1988-04-06  1988-04-07
## T+1 0.007309589 0.005685693 0.005940944 0.005996456 0.006281345 0.006547244
##      1988-04-08  1988-04-09  1988-04-10  1988-04-11  1988-04-12  1988-04-13
## T+1 0.006736452 0.005587252 0.005844559 0.006134984 0.006374911 0.006642376
##      1988-04-14  1988-04-15  1988-04-16  1988-04-17  1988-04-18  1988-04-19
## T+1 0.005883739 0.006115124 0.006174351 0.006406996 0.006389947 0.006481772
##      1988-04-20  1988-04-21  1988-04-22 1988-04-23  1988-04-24  1988-04-25
## T+1 0.006744341 0.006972351 0.006672605 0.00683926 0.007029557 0.007261125
##      1988-04-26 1988-04-27 1988-04-28 1988-04-29  1988-04-30 1988-05-01
## T+1 0.007369437  0.0075912 0.00777415 0.00710332 0.006432122  0.0063231
##     1988-05-02  1988-05-03  1988-05-04  1988-05-05  1988-05-06  1988-05-07
## T+1 0.00656134 0.006739293 0.006990019 0.007180461 0.007238453 0.007457891
##      1988-05-08  1988-05-09 1988-05-10  1988-05-11  1988-05-12  1988-05-13
## T+1 0.007557533 0.007754627 0.00793679 0.008132439 0.007138787 0.007205688
##      1988-05-14  1988-05-15  1988-05-16  1988-05-17  1988-05-18  1988-05-19
## T+1 0.006435845 0.006697552 0.006945548 0.007146795 0.007378779 0.007578163
##      1988-05-20  1988-05-21  1988-05-22  1988-05-23  1988-05-24  1988-05-25
## T+1 0.007621416 0.007795885 0.007690438 0.007814344 0.007966942 0.008161204
##      1988-05-26  1988-05-27  1988-05-28 1988-05-29  1988-05-30 1988-05-31
## T+1 0.008336038 0.007590013 0.007727587 0.00791655 0.007865985 0.00796704
##      1988-06-01  1988-06-02  1988-06-03  1988-06-04  1988-06-05  1988-06-06
## T+1 0.008161298 0.008321998 0.008494775 0.006522054 0.005253013 0.005419312
##      1988-06-07  1988-06-08  1988-06-09  1988-06-10  1988-06-11  1988-06-12
## T+1 0.005705395 0.006003669 0.006279951 0.006548307 0.006406618 0.006651077
##      1988-06-13  1988-06-14 1988-06-15  1988-06-16  1988-06-17  1988-06-18
## T+1 0.006754903 0.006996609  0.0072355 0.007463462 0.007513996 0.007707511
##     1988-06-19  1988-06-20  1988-06-21  1988-06-22  1988-06-23  1988-06-24
## T+1 0.00782793 0.008024805 0.007444809 0.007663086 0.007856519 0.007250347
##      1988-06-25  1988-06-26  1988-06-27  1988-06-28  1988-06-29  1988-06-30
## T+1 0.007391444 0.007339227 0.007401604 0.007621547 0.007831696 0.007933908
##      1988-07-01  1988-07-02  1988-07-03 1988-07-04 1988-07-05 1988-07-06
## T+1 0.008127805 0.008259384 0.008397395 0.00727392 0.00746497 0.00768232
##      1988-07-07  1988-07-08  1988-07-09  1988-07-10  1988-07-11 1988-07-12
## T+1 0.007813204 0.007788332 0.007919352 0.008092792 0.008278253 0.00845822
##      1988-07-13  1988-07-14  1988-07-15  1988-07-16  1988-07-17  1988-07-18
## T+1 0.008629886 0.008752673 0.008667844 0.008768996 0.008896733 0.008971695
##     1988-07-19  1988-07-20  1988-07-21  1988-07-22  1988-07-23 1988-07-24
## T+1 0.00902589 0.009171445 0.009095326 0.009070237 0.009209994 0.00933986
##      1988-07-25 1988-07-26 1988-07-27  1988-07-28  1988-07-29  1988-07-30
## T+1 0.009192917 0.00928296 0.00941669 0.009490814 0.009614616 0.008947174
##      1988-07-31 1988-08-01  1988-08-02 1988-08-03  1988-08-04  1988-08-05
## T+1 0.009057781 0.00912531 0.009010463 0.00915678 0.009289976 0.009124838
##      1988-08-06  1988-08-07  1988-08-08  1988-08-09  1988-08-10  1988-08-11
## T+1 0.009220334 0.009347382 0.009128119 0.009108744 0.009247725 0.009363168
##      1988-08-12  1988-08-13  1988-08-14  1988-08-15  1988-08-16  1988-08-17
## T+1 0.009250169 0.009283599 0.009057032 0.009112735 0.009153832 0.009284182
##      1988-08-18  1988-08-19  1988-08-20  1988-08-21  1988-08-22  1988-08-23
## T+1 0.009391074 0.009473918 0.009442823 0.009471107 0.009596318 0.009604931
##      1988-08-24  1988-08-25  1988-08-26  1988-08-27  1988-08-28  1988-08-29
## T+1 0.009719478 0.009832909 0.009843598 0.009497701 0.009531591 0.009207224
##      1988-08-30 1988-08-31  1988-09-01  1988-09-02  1988-09-03  1988-09-04
## T+1 0.009331554 0.00946071 0.009354483 0.008597927 0.008731294 0.008138717
##      1988-09-05  1988-09-06  1988-09-07  1988-09-08  1988-09-09  1988-09-10
## T+1 0.007781947 0.007984722 0.008165436 0.008226592 0.008250481 0.008409447
##      1988-09-11  1988-09-12  1988-09-13  1988-09-14  1988-09-15  1988-09-16
## T+1 0.008579153 0.008713342 0.008867514 0.008977082 0.009101206 0.009202961
##      1988-09-17  1988-09-18  1988-09-19  1988-09-20  1988-09-21  1988-09-22
## T+1 0.007791018 0.007917929 0.008067131 0.008243953 0.008090623 0.008267967
##      1988-09-23  1988-09-24  1988-09-25  1988-09-26  1988-09-27  1988-09-28
## T+1 0.008059929 0.008187785 0.008340277 0.007391136 0.007610673 0.007565379
##      1988-09-29  1988-09-30  1988-10-01  1988-10-02  1988-10-03  1988-10-04
## T+1 0.007423125 0.006407277 0.006393505 0.006608831 0.006788383 0.007025609
##      1988-10-05  1988-10-06  1988-10-07  1988-10-08  1988-10-09  1988-10-10
## T+1 0.007189937 0.007323799 0.007505374 0.007714141 0.007128076 0.007099409
##      1988-10-11  1988-10-12  1988-10-13  1988-10-14  1988-10-15 1988-10-16
## T+1 0.007332794 0.007457813 0.007590132 0.007789386 0.007266715 0.00749098
##      1988-10-17  1988-10-18  1988-10-19  1988-10-20  1988-10-21  1988-10-22
## T+1 0.007682963 0.007888926 0.008086867 0.008211835 0.008355536 0.008415949
##      1988-10-23  1988-10-24  1988-10-25  1988-10-26  1988-10-27  1988-10-28
## T+1 0.008586224 0.008725609 0.008818362 0.008972506 0.009120618 0.009205433
##     1988-10-29  1988-10-30  1988-10-31 1988-11-01  1988-11-02  1988-11-03
## T+1 0.00933386 0.009461432 0.009448617 0.00953576 0.009657999 0.009766136
##      1988-11-04  1988-11-05  1988-11-06  1988-11-07  1988-11-08 1988-11-09
## T+1 0.009789159 0.009656163 0.009772249 0.009449908 0.009526769 0.00964886
##      1988-11-10  1988-11-11  1988-11-12 1988-11-13 1988-11-14 1988-11-15
## T+1 0.009737914 0.009849776 0.009935563 0.01002599 0.01006749 0.01016513
##     1988-11-16 1988-11-17 1988-11-18  1988-11-19 1988-11-20 1988-11-21
## T+1 0.01014847 0.01016475 0.01024925 0.009896719 0.01000236 0.01009835
##     1988-11-22 1988-11-23 1988-11-24 1988-11-25 1988-11-26 1988-11-27
## T+1 0.01019212 0.01028416 0.01037011 0.01044123 0.01042458 0.01045747
##     1988-11-28 1988-11-29 1988-11-30 1988-12-01 1988-12-02 1988-12-03
## T+1 0.01052374 0.01059622 0.01066967 0.01073937  0.0108048 0.01042585
##     1988-12-04 1988-12-05 1988-12-06 1988-12-07 1988-12-08 1988-12-09
## T+1 0.01050455 0.01009845 0.01004221 0.01014103 0.01019139 0.01023603
##      1988-12-10 1988-12-11  1988-12-12  1988-12-13  1988-12-14  1988-12-15
## T+1 0.009832225 0.00943868 0.009504849 0.009628371 0.009741977 0.009717747
##      1988-12-16  1988-12-17  1988-12-18  1988-12-19 1988-12-20  1988-12-21
## T+1 0.009827247 0.009734552 0.009453751 0.009568166 0.00960006 0.009717218
##     1988-12-22  1988-12-23  1988-12-24  1988-12-25  1988-12-26  1988-12-27
## T+1 0.00940856 0.009492642 0.009448298 0.009324764 0.008815789 0.008971007
##     1988-12-28  1988-12-29  1988-12-30 1988-12-31  1989-01-01  1989-01-02
## T+1 0.00911742 0.009258071 0.009392061 0.00936389 0.009065977 0.009159654
##      1989-01-03  1989-01-04  1989-01-05  1989-01-06  1989-01-07  1989-01-08
## T+1 0.009299055 0.009365493 0.009491993 0.009591659 0.009504016 0.009556696
##      1989-01-09  1989-01-10  1989-01-11  1989-01-12 1989-01-13 1989-01-14
## T+1 0.009667989 0.009784007 0.009894688 0.009996701 0.01009552 0.01019148
##     1989-01-15 1989-01-16 1989-01-17 1989-01-18 1989-01-19 1989-01-20
## T+1 0.01014213 0.01014543 0.01023949 0.01032922 0.01041434 0.01038577
##     1989-01-21 1989-01-22 1989-01-23 1989-01-24 1989-01-25 1989-01-26
## T+1 0.01046415 0.01040768  0.0103249  0.0104107 0.01049233 0.01056868
##     1989-01-27  1989-01-28  1989-01-29  1989-01-30 1989-01-31  1989-02-01
## T+1 0.01041002 0.009380737 0.009423643 0.009428883  0.0095559 0.009648983
##      1989-02-02  1989-02-03  1989-02-04  1989-02-05  1989-02-06  1989-02-07
## T+1 0.009526183 0.009645115 0.009750661 0.009712438 0.009603977 0.009720158
##      1989-02-08  1989-02-09  1989-02-10  1989-02-11  1989-02-12  1989-02-13
## T+1 0.009833257 0.009939462 0.009952652 0.008680824 0.008520927 0.008683477
##      1989-02-14  1989-02-15  1989-02-16  1989-02-17  1989-02-18  1989-02-19
## T+1 0.008625415 0.008789502 0.008870417 0.009005037 0.009106135 0.008950502
##      1989-02-20  1989-02-21  1989-02-22  1989-02-23  1989-02-24 1989-02-25
## T+1 0.008809456 0.008902437 0.009053696 0.009024807 0.008607996 0.00875105
##      1989-02-26  1989-02-27  1989-02-28  1989-03-01  1989-03-02  1989-03-03
## T+1 0.008909299 0.008788525 0.008941052 0.009090548 0.009203327 0.008615641
##      1989-03-04 1989-03-05  1989-03-06  1989-03-07  1989-03-08 1989-03-09
## T+1 0.008074682 0.00744759 0.007500128 0.007667928 0.007875915 0.00802067
##      1989-03-10  1989-03-11  1989-03-12  1989-03-13  1989-03-14  1989-03-15
## T+1 0.007793527 0.007589101 0.007440931 0.007538034 0.007749558 0.007953857
##      1989-03-16  1989-03-17  1989-03-18  1989-03-19  1989-03-20  1989-03-21
## T+1 0.008129455 0.008163477 0.008319239 0.008364382 0.007266283 0.007492756
##      1989-03-22  1989-03-23  1989-03-24  1989-03-25 1989-03-26  1989-03-27
## T+1 0.007708334 0.007913419 0.007918119 0.007960692 0.00804029 0.007664178
##     1989-03-28  1989-03-29 1989-03-30  1989-03-31 1989-04-01  1989-04-02
## T+1 0.00787045 0.008069213 0.00814707 0.008297327 0.00835763 0.008357141
##      1989-04-03  1989-04-04  1989-04-05  1989-04-06  1989-04-07  1989-04-08
## T+1 0.008508342 0.008676085 0.008837705 0.008989435 0.008905284 0.009042137
##      1989-04-09  1989-04-10  1989-04-11  1989-04-12  1989-04-13  1989-04-14
## T+1 0.008451682 0.008002502 0.008151312 0.008337135 0.008314943 0.008188416
##      1989-04-15  1989-04-16  1989-04-17  1989-04-18  1989-04-19  1989-04-20
## T+1 0.008045891 0.008000454 0.008073646 0.008261024 0.008441813 0.008590209
##     1989-04-21  1989-04-22  1989-04-23  1989-04-24  1989-04-25  1989-04-26
## T+1  0.0087465 0.008834164 0.008427074 0.008600271 0.008691922 0.008852881
##      1989-04-27  1989-04-28  1989-04-29  1989-04-30  1989-05-01  1989-05-02
## T+1 0.009006294 0.009129946 0.009229668 0.009335109 0.009275632 0.009386086
##      1989-05-03  1989-05-04  1989-05-05 1989-05-06  1989-05-07  1989-05-08
## T+1 0.009515055 0.009600759 0.009670398 0.00973279 0.009823686 0.009869143
##      1989-05-09 1989-05-10  1989-05-11  1989-05-12  1989-05-13  1989-05-14
## T+1 0.009975476 0.01007746 0.009745197 0.009417704 0.009401138 0.009513629
##      1989-05-15  1989-05-16  1989-05-17  1989-05-18  1989-05-19  1989-05-20
## T+1 0.009619885 0.009704716 0.009819183 0.009889518 0.009837965 0.009894295
##      1989-05-21  1989-05-22  1989-05-23  1989-05-24 1989-05-25 1989-05-26
## T+1 0.009769782 0.009733707 0.009846552 0.009954395 0.01005675 0.01014269
##     1989-05-27  1989-05-28  1989-05-29 1989-05-30 1989-05-31 1989-06-01
## T+1 0.00979773 0.009905231 0.009917895 0.01002171  0.0101213 0.01020043
##      1989-06-02  1989-06-03  1989-06-04  1989-06-05 1989-06-06 1989-06-07
## T+1 0.009898701 0.009975282 0.009921069 0.009954791 0.01004524 0.01014404
##     1989-06-08 1989-06-09 1989-06-10 1989-06-11  1989-06-12  1989-06-13
## T+1 0.01006662 0.01010403 0.00939749 0.00886029 0.009013333 0.009155733
##      1989-06-14  1989-06-15  1989-06-16  1989-06-17  1989-06-18  1989-06-19
## T+1 0.009294529 0.009426568 0.009062551 0.009205351 0.009338304 0.009032011
##      1989-06-20  1989-06-21  1989-06-22  1989-06-23  1989-06-24  1989-06-25
## T+1 0.009135003 0.009275501 0.009389687 0.009498017 0.009540871 0.009627177
##      1989-06-26  1989-06-27  1989-06-28  1989-06-29  1989-06-30  1989-07-01
## T+1 0.009558587 0.009679714 0.009794365 0.009721111 0.009643873 0.009723257
##      1989-07-02  1989-07-03  1989-07-04  1989-07-05 1989-07-06  1989-07-07
## T+1 0.009782799 0.009773486 0.009883899 0.009989975 0.01005194 0.009705225
##      1989-07-08  1989-07-09  1989-07-10  1989-07-11 1989-07-12  1989-07-13
## T+1 0.009732379 0.009835958 0.009849874 0.009954616 0.01005708 0.009939626
##      1989-07-14  1989-07-15 1989-07-16  1989-07-17 1989-07-18 1989-07-19
## T+1 0.009991921 0.009979687 0.01002281 0.009967094  0.0100695 0.01016708
##     1989-07-20
## T+1 0.01024389
par ( lwd =2, cex.axis = 2)
x_axis = currencies$Date [ currencies$Date >= "2016-08-03"]
plot ( x_axis , static_fc@forecast$seriesFor , type ="l", xlab ="", ylab ="", col ="blue3"
)
lines ( x_axis , dynamic_fc@forecast$seriesFor , col ="brown1")
legend ("bottomleft", legend = c ("Static", "Dynamic") , col = c("blue3","brown1") ,
lty = 1)

=========================================================================================

0.1 Deriving Critical Values for a Dickey–Fuller Test Using Simulation

set.seed(123456)
tnone = tconst = ttrend = NULL
set.seed(123456)
tnone = tconst = ttrend = NULL
for (i in 1:500){
y = c(0, cumsum(rnorm(1199)))
dy = c(NA , diff ( y ) )
lagy = c(NA , y[1:1199])
# Model with no intercept (no drift)
lmnone = lm(dy[-(1:200)] ~ 0 + lagy[-(1:200)])
tnone = c(tnone , coef(summary(lmnone))[1]/coef(summary(lmnone))[2])
# Model with intercept, no trend
lmconst = lm(dy[-(1:200)] ~ 1 + lagy[-(1:200)])
tconst = c(tconst, coef(summary(lmconst))[2,1]/coef(summary(lmconst))[2,2])
# Model with intercept and trend
lmtrend = lm(dy[-(1:200)] ~ 1 + lagy[-(1:200)] + c(1:1000))
ttrend = c(ttrend, coef(summary(lmtrend))[2,1]/ coef(summary(lmtrend))[2,2])
}

Explanation - ‘set.seed(123456)’: to replicate the exact t-values created with this program on any other computer at a later time and the command serves to define the starting value for draws from a standard normal distribution which are necessary in later stages to create variables that follow a standard normal distribution. - ‘tnone = tconst = ttrend = NULL’: variables to store the t-statistics. - N = 500 - ‘y = c(0, cumsum(rnorm(1199)))’: a random series of 1199 numbers with a standard normal distribution rnorm(1199) => a vector comprising 1200 entries that resembles a random walk series that follows a unit root process. - ‘dy = c(NA , diff ( y ) )’ and ‘lagy = c(NA , y[1:1199])’: the first differences and lagged values of y, adding an ’NA’ value at the start to keep the same length. - ‘lmnone’, ‘lmconst’, ‘lmtrend’: the linear model is estimated. - ‘tnone’, ‘tconst’, ‘ttrend’: computes the t-statistic and appends it to the corresponding vector. - Note that when generating random draws, it sometimes takes a while before the constructed series have the properties that they should, and therefore, when generating the regressions, we exclude the first 200 observations. => dy[-(1:200)] is used to remove first 200 observations. The independent variables change for the different models. - ‘dy[-(1:200)] ~ 0 + lagy[-(1:200)]’: only the lagged values of y, hence the values starting at 200, are used and also avoid an intercept. - ‘dy[-(1:200)] ~ 1 + lagy[-(1:200)]’: include an intercept and write 1 instead of 0. - ‘dy[-(1:200)] ~ 1 + lagy[-(1:200)] + c(1:1000)’: the model includes an intercept and a time trend. For each of these 50,000 repetitions, a new set of t-values will be generated and added to the vectors tnone, tconst and ttrend

quantile(tnone, c(0.01,0.05,0.1))
##        1%        5%       10% 
## -2.401095 -1.921597 -1.675099
quantile(tconst, c(0.01,0.05,0.1))
##        1%        5%       10% 
## -3.651240 -2.870267 -2.571466
quantile(ttrend, c(0.01,0.05,0.1))
##        1%        5%       10% 
## -3.987071 -3.366447 -3.107267

Explanation We compute the 1st, 5th and 10th percentile for the three variables ‘tnone’, ‘tconst’, ‘ttrend’ using the quantile function.

0.1.1 Pricing Asian Options

STEPS 1. Specify a data generating process for the underlying asset. A random walk with drift model is usually assumed. Specify also the assumed size of the drift component and the assumed size of the volatility parameter. Specify also a strike price K, and a time to maturity, T. 2. Draw a series of length T, the required number of observations for the life of the option, from a normal distribution. This will be the error series, so that ϵt ∼ N(0; 1). 3. Form a series of observations of length T on the underlying asset. 4. Observe the price of the underlying asset at maturity observation T. For a call option, if the value of the underlying asset on maturity date Pt ≤ K, the option expires worthless for this replication. If the value of the underlying asset on maturity date Pt > K, the option expires in the money, and has a value on that date equal to PT - K, which should be discounted back to the present using the risk-free rate. 5. Repeat steps 1 to 4 a total of N times, and take the average value of the option over N replications. This average will be the price of the option.

set.seed(123456)
# Initial values and derived constants
K = 6500; iv = 0.2652 # Simulation one
s0 = 6289.7; rf = 0.0624; dy = 0.0242; ttm = 0.5; obs = 125
dt = ttm /obs
drift = (rf -dy -iv^2/2)*dt
vsqrdt = iv*dt^0.5
putval = callval = NULL
for (i in 1:25000){
random = rnorm (obs ) # create cumulative sum of random numbers
# Spot price evolution for positive and negative random numbers
spot = s0* exp( drift *c(1: obs)+ vsqrdt * cumsum ( random ))
spot_neg = s0*exp( drift *c(1:obs)+ vsqrdt * cumsum (- random ))
# Compute call values
callval = c( callval , max ( mean ( spot )-K,0)*exp (-rf*ttm ))
callval = c( callval , max ( mean ( spot_neg )-K,0)*exp (-rf*ttm))
# Compute Put values
putval = c(putval , max (K- mean ( spot ),0)*exp (-rf*ttm ))
putval = c(putval , max (K- mean ( spot_neg ),0)*exp (-rf*ttm ))
}
#Result for Simulation one
mean(callval)
## [1] 204.6794
mean(putval)
## [1] 349.6241