rAccumulation: Realized Accumulation Plot

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/realized.R

Description

Plots the realized estimate as it accumulates over a time interval.

Usage

1
2
rAccumulation(x, period = 1, y = NULL, align.by="seconds", align.period = 1, 
   plotit = FALSE, cts = TRUE, makeReturns = FALSE)

Arguments

x

Tick data in xts object.

y

Tick data in xts object.

period

Sampling period

align.by

Align the tick data to seconds|minutes|hours

align.period

Align the returns to this period first

plotit

T for plot

cts

Create calendar time sampling if a non realizedObject is passed

makeReturns

Prices are passed make them into log returns

Details

Plots the realized estimate as it accumulates over a time interval. This is a good tool to determine what obersations are adding (possibly subtracting for covariance) to the estimate.

Value

Realized accumulation vector if plotit = F

Author(s)

Scott Payseur <scott.payseur@gmail.com>

References

S. W. Payseur. A One Day Comparison of Realized Variance and Covariance Estimators. Working Paper: University of Washington, 2007

See Also

rMarginal

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
data(sbux.xts)

cumm <- list() 
cumm[[1]] <- rCumSum(sbux.xts, period=1, align.by="seconds", align.period=60) 
cumm[[2]] <- rCumSum(sbux.xts, period=10, align.by="seconds", align.period=60) 
cumm[[3]] <- rCumSum(sbux.xts, period=20, align.by="seconds", align.period=60) 
cumm[[4]] <- rCumSum(sbux.xts, period=30, align.by="seconds", align.period=60) 
accum <- list() 
accum[[1]] <- rAccumulation(sbux.xts, period=10, align.by="seconds", align.period=60) 
accum[[2]] <- rAccumulation(sbux.xts, period=20, align.by="seconds", align.period=60) 
accum[[3]] <- rAccumulation(sbux.xts, period=30, align.by="seconds", align.period=60)

par(mfrow=c(2,1)) 
plot(cumm[[1]], xlab="", ylab="Cumulative Ruturns", main="Starbucks (SBUX)",
     sub='20110701', type="p", col=16, lwd=2) 
lines(cumm[[2]], col=2, lwd=2) 
lines(cumm[[3]], col=3, lwd=2) 
lines(cumm[[4]], col=4, lwd=2) 
plot(accum[[1]], xlab="", ylab="Realized Accumulation", type="l",main="Starbucks (SBUX)", 
      sub='20110701', col=2, lwd=2) 
lines(accum[[2]], col=3, lwd=2) 
lines(accum[[3]], col=4, lwd=2) 

Example output

Loading required package: xts
Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric

xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00] 
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00] 
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00] 
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00] 
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00] 
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00] 
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00] 
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00] 
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00] 
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00] 
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00] 
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00] 
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00] 
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00] 
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00] 
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00] 
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00] 
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00] 
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00] 
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00] 

highfrequency documentation built on May 2, 2019, 6:09 p.m.