Cross-variation of two stochastic processes

CrossVariation(X, Y)

Arguments

X

numeric vector containing the one process

Y

numeric vector, same length as X, containing the other process

Value

A numeric vector, same length as X, giving the quadratic cross-varation as function of time

Examples

## Quadratic variation of Brownian motion
times <- seq(0,10,0.01)
B <- rBM(times)
plot(times,CrossVariation(B,B),type="l")
abline(0,1,lty="dashed")


## Verifying Ito's formula
X <- -times + B
h <- dhdx <- dh2dx2 <- function(x) exp(x)
Y <- h(X)
plot(times,Y,type="l")

Yi <- h(X[1]) + itointegral(dhdx(X),X) + 0.5*itointegral(dh2dx2(X),CrossVariation(X,X))
lines(times,Yi,col="blue")