FCCor | R Documentation |
Calculation of functional correlation between two simultaneously observed processes.
FCCor(
x,
y,
Lt,
bw = stop("bw missing"),
kern = "epan",
Tout = sort(unique(unlist(Lt)))
)
x |
A list of function values corresponding to the first process. |
y |
A list of function values corresponding to the second process. |
Lt |
A list of time points for both |
bw |
A numeric vector for bandwidth of length either 5 or 1, specifying the bandwidths for E(X), E(Y), var(X), var(Y), and cov(X, Y). If |
kern |
Smoothing kernel for mu and covariance; "rect", "gauss", "epan", "gausvar", "quar" (default: "gauss") |
Tout |
Output time points. Default to the sorted unique time points. |
FCCor
calculate only the concurrent correlation corr(X(t), Y(t)) (note that the time points t are the same). It assumes no measurement error in the observed values.
A list with the following components:
corr |
A vector of the correlation corr(X(t), Y(t)) evaluated at |
Tout |
Same as the input Tout. |
bw |
The bandwidths used for E(X), E(Y), var(X), var(Y), and cov(X, Y). |
set.seed(1)
n <- 200
nGridIn <- 50
sparsity <- 1:5 # must have length > 1
bw <- 0.2
kern <- 'epan'
T <- matrix(seq(0.5, 1, length.out=nGridIn))
## Corr(X(t), Y(t)) = 1/2
A <- Wiener(n, T)
B <- Wiener(n, T)
C <- Wiener(n, T) + matrix((1:nGridIn) , n, nGridIn, byrow=TRUE)
X <- A + B
Y <- A + C
indEach <- lapply(1:n, function(x) sort(sample(nGridIn, sample(sparsity, 1))))
tAll <- lapply(1:n, function(i) T[indEach[[i]]])
Xsp <- lapply(1:n, function(i) X[i, indEach[[i]]])
Ysp <- lapply(1:n, function(i) Y[i, indEach[[i]]])
plot(T, FCCor(Xsp, Ysp, tAll, bw)[['corr']], ylim=c(-1, 1))
abline(h=0.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.