> last(GSPC.predict)
SP5.Open SP5.High SP5.Low SP5.Close SP5.Volume spline eps
6 2019 2751.53 2964.15 2728.81 2941.76 70881390000 3073.12 2873.672
> as.xts(cbind(1,2,3,4,5,6,7),as.Date("2019-07-01"))
[,1] [,2] [,3] [,4] [,5] [,6] [,7]
2019-07-01 1 2 3 4 5 6 7
> append(last(GSPC.predict,12),as.xts(cbind(1,2,3,4,5,6,7),as.Date("2019-07-01")))
SP5.Open SP5.High SP5.Low SP5.Close SP5.Volume spline eps
7 2018 2704.95 2848.03 2698.95 2816.29 64542170000 2755.988 2655.353
8 2018 2821.17 2916.50 2796.34 2901.52 69238220000 2782.479 2683.418
9 2018 2896.96 2940.91 2864.12 2913.98 62492080000 2803.764 2707.010
10 2018 2926.29 2939.86 2603.54 2711.74 91327930000 2819.118 2723.880
11 2018 2717.58 2815.15 2631.09 2760.17 80080110000 2831.201 2737.248
12 2018 2790.50 2800.18 2346.58 2506.85 83519570000 2843.346 2751.415
1 2019 2476.96 2708.95 2443.96 2704.10 80391630000 2858.716 2769.494
2 2019 2702.32 2813.49 2681.83 2784.49 70183430000 2879.906 2790.537
3 2019 2798.22 2860.31 2722.27 2834.40 78596280000 2909.390 2812.729
4 2019 2848.63 2949.52 2848.63 2945.83 69604840000 2949.670 2834.471
5 2019 2952.33 2954.13 2750.52 2752.06 76860120000 3003.365 2854.984
6 2019 2751.53 2964.15 2728.81 2941.76 70881390000 3073.120 2873.672
7 2019 1.00 2.00 3.00 4.00 5 6.000 7.000
> last(append(tmp.predict[,-236],cbind(last(SP5)[,-5],1,2)))
SP5.Open SP5.High SP5.Low SP5.Close SP5.Volume spline eps
8 2019 2943.9 2945.5 2914.11 2932.05 2210278484 1 2
なので、
> last(append(GSPC.predict[,-5],cbind(last(to.monthly(SP5),2)[,-5],2,1)),5)
SP5.Open SP5.High SP5.Low SP5.Close spline eps
4 2019 2848.63 2949.52 2848.63 2945.83 2950.103 2833.925
5 2019 2952.33 2954.13 2750.52 2752.06 3002.397 2852.558
6 2019 2751.53 2964.15 2728.81 2941.76 3070.108 2868.224
7 2019 2971.41 3027.98 2952.22 2980.38 2.000 1.000
8 2019 2980.32 3013.59 2914.11 2932.05 2.000 1.000
のように2ヶ月分いっぺんにappendできる。
ゆえに、以下の操作で2ヶ月分付加。
last(append(GSPC.predict,cbind(last(to.monthly(SP5),2),2,1)),5)
#
#
tmp.predict <- append(GSPC.predict,cbind(last(to.monthly(SP5),2),2,1))
length(index(tmp.predict))
が下の式のほうがよりベター。1ヶ月分。
tmp.predict <- append(tmp.predict,cbind(last(to.monthly(SP5)),1,2))
length(index(tmp.predict))
tmp.predict <- append(GSPC.predict,cbind(last(to.monthly(SP5),3),c(1,3,5),c(2,4,6)))
以下、未検証。
tmp.predict <-append(GSPC.predict,cbind(last(to.monthly(SP5),2),
tmp.predict <-append(GSPC.predict,cbind(last(to.monthly(SP5),2),
3月,6月,9月,12月用。
tmp.predict <-
0 件のコメント:
コメントを投稿