Learn R Programming

highfrequency (version 0.7.0.1)

TSCov_bi: rvKernel <- function(x, # Tick Data kernelType = "rectangular", # Kernel name (or number) kernelParam = 1, # Kernel parameter (usually lags) kernelDOFadj = TRUE, # Kernel Degree of freedom adjustment alignBy = "seconds", # Align the tick data to [seconds|minutes|hours] alignPeriod = 1) # Align the tick data to this many [seconds|minutes|hours] # Multiday adjustment: multixts <- multixts(x) if (multixts) result <- apply.daily(x, rv.kernel,kernelType,kernelParam,kernelDOFadj, alignBy, alignPeriod, cts, makeReturns) return(result) else #Daily estimation: alignPeriod <- .getAlignPeriod(alignPeriod, alignBy) cdata <- .convertData(x, cts = cts, makeReturns = makeReturns) x <- cdata$data x <- .alignReturns(x, alignPeriod) type <- kernelCharToInt(kernelType) kernelEstimator(as.double(x), as.double(x), as.integer(length(x)), as.integer(kernelParam), as.integer(ifelse(kernelDOFadj, 1, 0)), as.integer(type), ab = double(kernelParam + 1), ab2 = double(kernelParam + 1))

Description

rvKernel <- function(x, # Tick Data kernelType = "rectangular", # Kernel name (or number) kernelParam = 1, # Kernel parameter (usually lags) kernelDOFadj = TRUE, # Kernel Degree of freedom adjustment alignBy = "seconds", # Align the tick data to [seconds|minutes|hours] alignPeriod = 1) # Align the tick data to this many [seconds|minutes|hours] # Multiday adjustment: multixts <- multixts(x) if (multixts) result <- apply.daily(x, rv.kernel,kernelType,kernelParam,kernelDOFadj, alignBy, alignPeriod, cts, makeReturns) return(result) else #Daily estimation: alignPeriod <- .getAlignPeriod(alignPeriod, alignBy) cdata <- .convertData(x, cts = cts, makeReturns = makeReturns) x <- cdata$data x <- .alignReturns(x, alignPeriod) type <- kernelCharToInt(kernelType) kernelEstimator(as.double(x), as.double(x), as.integer(length(x)), as.integer(kernelParam), as.integer(ifelse(kernelDOFadj, 1, 0)), as.integer(type), ab = double(kernelParam + 1), ab2 = double(kernelParam + 1))

Usage

TSCov_bi(pData1, pData2, K = 300, J = 1)

Arguments