Dear R helping team,
I am trying to check if the model I fitted is the best fitted model from the 
data. I have over all 392 data, I want to fit the model in the first 382 data 
and do 10 step predictions, check whether my model fits the last 10 data well.
Here is the R code I wrote
da<-read.table(file.choose(),header=T)

y <- data.frame(time =
seq(as.Date('2007-01-07'), by = 'weeks', length = 392))

#produce a vector that can show the dates
of the exchange rates.#

ex<-da[,2]
mod <- list()

mod[["linear"]] <- linear(ex, m = 4)

mod[["setar"]] <- setar(ex, m = 4,
thDelay = 1)

mod[["lstar"]] <- lstar(ex, m = 4,
thDelay = 1)

mod[["nnetTs"]] <- nnetTs(ex, m = 4,
size = 3)

mod[["aar"]] <- aar(ex, m = 4)set.seed(10)mod.test <- list()ex.train <- 
window(ex, end = 380)ex.test <- window(ex, start = 381)mod.test[["linear"]] <- 
linear(ex.train, m = 4)mod.test[["setar"]] <- setar(ex.train, m = 4, thDelay = 
1)mod.test[["lstar"]] <- lstar(ex.train, m = 4, thDelay = 1, trace = 
FALSE,control = list(maxit = 1e+05))mod.test[["nnet"]] <- nnetTs(ex.train, m = 
4, size = 3, control = list(maxit = 1e+05))mod.test[["aar"]] <- aar(ex.train, m 
= 4)
frc.test <- lapply(mod.test, predict, n.ahead = 10)plot(ex.test, ylim = 
range(ex))for (i in 1:length(frc.test))     lines(frc.test[[i]], lty = i + 1, 
col = i + 1)legend(381, 0.5, lty = 1:(length(frc.test) + 1), col = 
1:(length(frc.test) +1), legend = c("observed", names(frc.test)))
I am expecting to have some plot like the graph on page 20 of this link 
http://cran.r-project.org/web/packages/tsDyn/vignettes/tsDyn.pdf
but I get the picture,please see attachment.
here is the first few lines of my data> head(da)    End_Date USD_GBP1 
07/01/2007  0.51222 14/01/2007  0.51523 21/01/2007  0.50834 28/01/2007  0.50735 
04/02/2007  0.50946 11/02/2007  0.5097
I attached my data as well just in case you may need it.
Thank you very much for your help!!
Kind regards
Penny



                                          
End_Date        USD_GBP
07/01/2007      0.5122
14/01/2007      0.5152
21/01/2007      0.5083
28/01/2007      0.5073
04/02/2007      0.5094
11/02/2007      0.5097
18/02/2007      0.5124
25/02/2007      0.5115
04/03/2007      0.5106
11/03/2007      0.5176
18/03/2007      0.5167
25/03/2007      0.5112
01/04/2007      0.509
08/04/2007      0.5072
15/04/2007      0.5064
22/04/2007      0.5003
29/04/2007      0.5
06/05/2007      0.5014
13/05/2007      0.5027
20/05/2007      0.5053
27/05/2007      0.5052
03/06/2007      0.5047
10/06/2007      0.5041
17/06/2007      0.5071
24/06/2007      0.5029
01/07/2007      0.4997
08/07/2007      0.4967
15/07/2007      0.494
22/07/2007      0.4887
29/07/2007      0.4879
05/08/2007      0.4923
12/08/2007      0.4926
19/08/2007      0.5005
26/08/2007      0.5016
02/09/2007      0.4967
09/09/2007      0.4951
16/09/2007      0.494
23/09/2007      0.4981
30/09/2007      0.4938
07/10/2007      0.4899
14/10/2007      0.4908
21/10/2007      0.4899
28/10/2007      0.4882
04/11/2007      0.4828
11/11/2007      0.4777
18/11/2007      0.4843
25/11/2007      0.4855
02/12/2007      0.4842
09/12/2007      0.4891
16/12/2007      0.4912
23/12/2007      0.4992
30/12/2007      0.5034
06/01/2008      0.5039
13/01/2008      0.5087
20/01/2008      0.5099
27/01/2008      0.5097
03/02/2008      0.5043
10/02/2008      0.5104
17/02/2008      0.5109
24/02/2008      0.5111
02/03/2008      0.5053
09/03/2008      0.5011
16/03/2008      0.4952
23/03/2008      0.5004
30/03/2008      0.5013
06/04/2008      0.5027
13/04/2008      0.5054
20/04/2008      0.5053
27/04/2008      0.5034
04/05/2008      0.505
11/05/2008      0.5094
18/05/2008      0.5126
25/05/2008      0.5082
01/06/2008      0.5053
08/06/2008      0.5087
15/06/2008      0.5105
22/06/2008      0.5096
29/06/2008      0.5056
06/07/2008      0.5025
13/07/2008      0.5053
20/07/2008      0.5007
27/07/2008      0.5013
03/08/2008      0.5042
10/08/2008      0.5126
17/08/2008      0.5292
24/08/2008      0.5365
31/08/2008      0.5439
07/09/2008      0.5602
14/09/2008      0.5656
21/09/2008      0.5538
28/09/2008      0.5418
05/10/2008      0.5579
12/10/2008      0.576
19/10/2008      0.5782
26/10/2008      0.6042
02/11/2008      0.6252
09/11/2008      0.6295
16/11/2008      0.6562
23/11/2008      0.6715
30/11/2008      0.6567
07/12/2008      0.671
14/12/2008      0.6739
21/12/2008      0.6593
28/12/2008      0.6767
04/01/2009      0.6864
11/01/2009      0.6715
18/01/2009      0.6762
25/01/2009      0.7088
01/02/2009      0.7073
08/02/2009      0.6895
15/02/2009      0.6871
22/02/2009      0.6993
01/03/2009      0.695
08/03/2009      0.7068
15/03/2009      0.7181
22/03/2009      0.704
29/03/2009      0.6891
05/04/2009      0.6906
12/04/2009      0.6788
19/04/2009      0.6743
26/04/2009      0.6826
03/05/2009      0.6783
10/05/2009      0.6643
17/05/2009      0.658
24/05/2009      0.6427
31/05/2009      0.6252
07/06/2009      0.6149
14/06/2009      0.615
21/06/2009      0.6098
28/06/2009      0.6081
05/07/2009      0.6077
12/07/2009      0.6167
19/07/2009      0.6131
26/07/2009      0.6082
02/08/2009      0.6059
09/08/2009      0.5943
16/08/2009      0.6038
23/08/2009      0.6066
30/08/2009      0.6116
06/09/2009      0.6139
13/09/2009      0.6051
20/09/2009      0.6065
27/09/2009      0.6176
04/10/2009      0.6273
11/10/2009      0.6271
18/10/2009      0.6235
25/10/2009      0.6088
01/11/2009      0.6099
08/11/2009      0.6062
15/11/2009      0.6002
22/11/2009      0.5994
29/11/2009      0.6042
06/12/2009      0.6043
13/12/2009      0.6121
20/12/2009      0.616
27/12/2009      0.6237
03/01/2010      0.6234
10/01/2010      0.6232
17/01/2010      0.6175
24/01/2010      0.6152
31/01/2010      0.62
07/02/2010      0.6303
14/02/2010      0.6389
21/02/2010      0.6402
28/02/2010      0.6505
07/03/2010      0.6633
14/03/2010      0.6631
21/03/2010      0.6596
28/03/2010      0.6687
04/04/2010      0.6616
11/04/2010      0.655
18/04/2010      0.6489
25/04/2010      0.651
02/05/2010      0.6527
09/05/2010      0.6645
16/05/2010      0.6774
23/05/2010      0.6931
30/05/2010      0.692
06/06/2010      0.687
13/06/2010      0.6885
20/06/2010      0.6779
27/06/2010      0.6709
04/07/2010      0.6628
11/07/2010      0.6602
18/07/2010      0.6576
25/07/2010      0.6535
01/08/2010      0.6422
08/08/2010      0.63
15/08/2010      0.6351
22/08/2010      0.6414
29/08/2010      0.6449
05/09/2010      0.6472
12/09/2010      0.6488
19/09/2010      0.6438
26/09/2010      0.638
03/10/2010      0.6322
10/10/2010      0.6295
17/10/2010      0.6272
24/10/2010      0.633
31/10/2010      0.631
07/11/2010      0.6206
14/11/2010      0.6204
21/11/2010      0.6246
28/11/2010      0.6322
05/12/2010      0.6401
12/12/2010      0.634
19/12/2010      0.6373
26/12/2010      0.6463
02/01/2011      0.6464
09/01/2011      0.6436
16/01/2011      0.6374
23/01/2011      0.6273
30/01/2011      0.6285
06/02/2011      0.6226
13/02/2011      0.6219
20/02/2011      0.6205
27/02/2011      0.6179
06/03/2011      0.6157
13/03/2011      0.6185
20/03/2011      0.6204
27/03/2011      0.6168
03/04/2011      0.6231
10/04/2011      0.6149
17/04/2011      0.6124
24/04/2011      0.6099
01/05/2011      0.603
08/05/2011      0.605
15/05/2011      0.6126
22/05/2011      0.6168
29/05/2011      0.6139
05/06/2011      0.6084
12/06/2011      0.611
19/06/2011      0.6156
26/06/2011      0.621
03/07/2011      0.6244
10/07/2011      0.6233
17/07/2011      0.6233
24/07/2011      0.618
31/07/2011      0.6114
07/08/2011      0.6113
14/08/2011      0.6137
21/08/2011      0.6089
28/08/2011      0.609
04/09/2011      0.6138
11/09/2011      0.6239
18/09/2011      0.6323
25/09/2011      0.6412
02/10/2011      0.6421
09/10/2011      0.6453
16/10/2011      0.6374
23/10/2011      0.6324
30/10/2011      0.6241
06/11/2011      0.6239
13/11/2011      0.6243
20/11/2011      0.6303
27/11/2011      0.6411
04/12/2011      0.6415
11/12/2011      0.6392
18/12/2011      0.6427
25/12/2011      0.6406
01/01/2012      0.6428
08/01/2012      0.6438
15/01/2012      0.6497
22/01/2012      0.6489
29/01/2012      0.6398
05/02/2012      0.6339
12/02/2012      0.6324
19/02/2012      0.6345
26/02/2012      0.6328
04/03/2012      0.6295
11/03/2012      0.6338
18/03/2012      0.6365
25/03/2012      0.6306
01/04/2012      0.6274
08/04/2012      0.6276
15/04/2012      0.6293
22/04/2012      0.6259
29/04/2012      0.6185
06/05/2012      0.6169
13/05/2012      0.6198
20/05/2012      0.6269
27/05/2012      0.6353
03/06/2012      0.6434
10/06/2012      0.6481
17/06/2012      0.6427
24/06/2012      0.6382
01/07/2012      0.6407
08/07/2012      0.6405
15/07/2012      0.6448
22/07/2012      0.6397
29/07/2012      0.6409
05/08/2012      0.6391
12/08/2012      0.6394
19/08/2012      0.6372
26/08/2012      0.6336
02/09/2012      0.632
09/09/2012      0.6283
16/09/2012      0.6213
23/09/2012      0.6161
30/09/2012      0.6171
07/10/2012      0.6194
14/10/2012      0.6228
21/10/2012      0.6219
28/10/2012      0.6233
04/11/2012      0.6218
11/11/2012      0.6259
18/11/2012      0.6298
25/11/2012      0.6273
02/12/2012      0.6241
09/12/2012      0.6225
16/12/2012      0.6208
23/12/2012      0.6166
30/12/2012      0.6193
06/01/2013      0.6183
13/01/2013      0.6217
20/01/2013      0.6241
27/01/2013      0.6315
03/02/2013      0.6342
10/02/2013      0.6361
17/02/2013      0.6402
24/02/2013      0.6512
03/03/2013      0.6609
10/03/2013      0.6651
17/03/2013      0.6675
24/03/2013      0.6603
31/03/2013      0.6584
07/04/2013      0.6575
14/04/2013      0.6521
21/04/2013      0.6537
28/04/2013      0.6523
05/05/2013      0.6438
12/05/2013      0.6453
19/05/2013      0.655
26/05/2013      0.6604
02/06/2013      0.6604
09/06/2013      0.6498
16/06/2013      0.6397
23/06/2013      0.6417
30/06/2013      0.6519
07/07/2013      0.661
14/07/2013      0.6669
21/07/2013      0.6591
28/07/2013      0.6516
04/08/2013      0.6546
11/08/2013      0.6486
18/08/2013      0.6437
25/08/2013      0.64
01/09/2013      0.6437
08/09/2013      0.6417
15/09/2013      0.6345
22/09/2013      0.626
29/09/2013      0.6229
06/10/2013      0.6192
13/10/2013      0.6247
20/10/2013      0.6233
27/10/2013      0.6182
03/11/2013      0.6226
10/11/2013      0.6243
17/11/2013      0.6241
24/11/2013      0.6194
01/12/2013      0.6146
08/12/2013      0.6109
15/12/2013      0.6109
22/12/2013      0.6123
29/12/2013      0.6099
05/01/2014      0.6063
12/01/2014      0.6084
19/01/2014      0.6092
26/01/2014      0.6062
02/02/2014      0.6054
09/02/2014      0.6112
16/02/2014      0.6044
23/02/2014      0.5991
02/03/2014      0.5996
09/03/2014      0.5981
16/03/2014      0.6004
23/03/2014      0.6033
30/03/2014      0.604
06/04/2014      0.6015
13/04/2014      0.5989
20/04/2014      0.5965
27/04/2014      0.5951
04/05/2014      0.5935
11/05/2014      0.5914
18/05/2014      0.5943
25/05/2014      0.5936
01/06/2014      0.5957
08/06/2014      0.5963
15/06/2014      0.5936
22/06/2014      0.5884
29/06/2014      0.5877
06/07/2014      0.584
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to