stepArchetypesRawData_funct_multiv {adamethods} | R Documentation |
Archetype algorithm to raw data with the functional multivariate Frobenius norm
Description
This is a slight modification of stepArchetypesRawData
to use the functional archetype algorithm with the multivariate Frobenius norm.
Usage
stepArchetypesRawData_funct_multiv(data, numArch, numRep = 3,
verbose = TRUE, saveHistory = FALSE, PM)
Arguments
data |
Data to obtain archetypes. |
numArch |
Number of archetypes to compute, from 1 to |
numRep |
For each |
verbose |
If TRUE, the progress during execution is shown. |
saveHistory |
Save execution steps. |
PM |
Penalty matrix obtained with |
Value
A list with the archetypes.
Author(s)
Irene Epifanio
References
Cutler, A. and Breiman, L., Archetypal Analysis. Technometrics, 1994, 36(4), 338-347, https://doi.org/10.2307/1269949
Epifanio, I., Functional archetype and archetypoid analysis, 2016. Computational Statistics and Data Analysis 104, 24-34, https://doi.org/10.1016/j.csda.2016.06.007
Eugster, M.J.A. and Leisch, F., From Spider-Man to Hero - Archetypal Analysis in R, 2009. Journal of Statistical Software 30(8), 1-23, https://doi.org/10.18637/jss.v030.i08
Examples
## Not run:
library(fda)
?growth
str(growth)
hgtm <- growth$hgtm
hgtf <- growth$hgtf[,1:39]
# Create array:
nvars <- 2
data.array <- array(0, dim = c(dim(hgtm), nvars))
data.array[,,1] <- as.matrix(hgtm)
data.array[,,2] <- as.matrix(hgtf)
rownames(data.array) <- 1:nrow(hgtm)
colnames(data.array) <- colnames(hgtm)
str(data.array)
# Create basis:
nbasis <- 10
basis_fd <- create.bspline.basis(c(1,nrow(hgtm)), nbasis)
PM <- eval.penalty(basis_fd)
# Make fd object:
temp_points <- 1:nrow(hgtm)
temp_fd <- Data2fd(argvals = temp_points, y = data.array, basisobj = basis_fd)
X <- array(0, dim = c(dim(t(temp_fd$coefs[,,1])), nvars))
X[,,1] <- t(temp_fd$coef[,,1])
X[,,2] <- t(temp_fd$coef[,,2])
# Standardize the variables:
Xs <- X
Xs[,,1] <- scale(X[,,1])
Xs[,,2] <- scale(X[,,2])
lass <- stepArchetypesRawData_funct_multiv(data = Xs, numArch = 3,
numRep = 5, verbose = FALSE,
saveHistory = FALSE, PM)
str(lass)
length(lass[[1]])
class(lass[[1]])
class(lass[[1]][[5]])
## End(Not run)