this is the sequel of the previous entry.
use spline()
> spline(seq(1,74,1),as.vector(SP5.result[,2]),n=220)
merge with the actual data. dont' forget suffixes parameter.
> colnames(merge(to.monthly(GSPC)["::2018-06-30"],last(spline(seq(1,74,1),as.vector(SP5.result[,2]),n=220)$y,n=138),suffixes=c('','spline')))
[1] "GSPC.Open" "GSPC.High" "GSPC.Low" "GSPC.Close" "GSPC.Volume" "GSPC.Adjusted" "spline"
below will get only "$spline" column.
> merge(to.monthly(GSPC)["::2018-06-30"],last(spline(seq(1,74,1),as.vector(SP5.result[,2]),n=220)$y,n=138),suffixes=c('','spline'))$spline
get monthlyReturn() values and plot them by plot.xts(). need the further investigation of methods available in spline(). use 'grid.ticks.on' parameter.
plot(monthlyReturn(merge(to.monthly(GSPC)["::2018-06-30"],last(spline(seq(1,74,1),as.vector(SP5.result[,2]),n=220,method="fmm")$y,n=138),suffixes=c('','spline'))$spline),type='h',grid.ticks.on='months')
use spline()
> spline(seq(1,74,1),as.vector(SP5.result[,2]),n=220)
merge with the actual data. dont' forget suffixes parameter.
> colnames(merge(to.monthly(GSPC)["::2018-06-30"],last(spline(seq(1,74,1),as.vector(SP5.result[,2]),n=220)$y,n=138),suffixes=c('','spline')))
[1] "GSPC.Open" "GSPC.High" "GSPC.Low" "GSPC.Close" "GSPC.Volume" "GSPC.Adjusted" "spline"
below will get only "$spline" column.
> merge(to.monthly(GSPC)["::2018-06-30"],last(spline(seq(1,74,1),as.vector(SP5.result[,2]),n=220)$y,n=138),suffixes=c('','spline'))$spline
get monthlyReturn() values and plot them by plot.xts(). need the further investigation of methods available in spline(). use 'grid.ticks.on' parameter.
plot(monthlyReturn(merge(to.monthly(GSPC)["::2018-06-30"],last(spline(seq(1,74,1),as.vector(SP5.result[,2]),n=220,method="fmm")$y,n=138),suffixes=c('','spline'))$spline),type='h',grid.ticks.on='months')
0 件のコメント:
コメントを投稿