Learn R Programming

fdapace (version 0.6.0)

Stringing: Stringing for High-Dimensional data

Description

Converting high-dimensional data to functional data

Usage

Stringing(
  X,
  Y = NULL,
  standardize = FALSE,
  disOptns = "euclidean",
  disMat = NA
)

Value

A list containing the following fields:

Ly

A list of n vectors, which are the random trajectories for all subjects identified by the Stringing method.

Lt

A list of n time points vectors, at which corresponding measurements Ly are taken.

StringingOrder

A vector representing the order of the stringing, s.t. using as column index on X yields recovery of the underlying process.

Xin

A matrix, corresponding to the input data matrix.

Xstd

A matrix, corresponding to the standardized input data matrix. It is NULL if standardize is FALSE.

Arguments

X

A matrix (n by p) of data, where X[i,] is the row vector of measurements for the ith subject.

Y

A vector (n by 1), where Y[i] is the response associated with X[i,]

standardize

A logical variable indicating whether standardization of the input data matrix is required, with default: FALSE.

disOptns

A distance metric to be used, one of the following: "euclidean" (default), "maximum", "manhattan", "canberra", "binary", "minkowski", "correlation", "spearman", "hamming", "xycor", or "user". If specified as "xycor", the absolute difference of correlation between predictor and response is used. If specified as "user", a dissimilarity matrix for the argument disMat must be provided.

disMat

A user-specified dissimilarity matrix, only necessary when disOptns is "user".

References

Chen, K., Chen, K., Müller, H. G., and Wang, J. L. (2011). "Stringing high-dimensional data for functional analysis." Journal of the American Statistical Association, 106(493), 275-284.

Examples

Run this code
set.seed(1)
n <- 50
wiener = Wiener(n = n)[,-1]
p = ncol(wiener)
rdmorder = sample(size = p, x=1:p, replace = FALSE)
stringingfit = Stringing(X = wiener[,rdmorder], disOptns = "correlation")
diff_norev = sum(abs(rdmorder[stringingfit$StringingOrder] - 1:p))
diff_rev = sum(abs(rdmorder[stringingfit$StringedOrder] - p:1))
if(diff_rev <= diff_norev){
  stringingfit$StringingOrder = rev(stringingfit$StringingOrder)
  stringingfit$Ly = lapply(stringingfit$Ly, rev)
}
plot(1:p, rdmorder[stringingfit$StringingOrder], pch=18); abline(a=0,b=1)

Run the code above in your browser using DataLab