sasfclust {sasfunclust} | R Documentation |
Sparse and Smooth Functional Data Clustering
Description
Sparse and smooth functional clustering (SaS-Funclust) allows to cluster a sample of curves into homogeneous groups while jointly detecting the most informative portion of domain. (Centofanti et al., 2021).
Usage
sasfclust(
X = NULL,
timeindex = NULL,
curve = NULL,
grid = NULL,
q = 30,
lambda_l = 10,
lambda_s = 10,
G = 2,
tol = 10^-7,
maxit = 50,
par_LQA = list(eps_diff = 1e-06, MAX_iter_LQA = 200, eps_LQA = 1e-05),
plot = F,
trace = F,
init = "kmeans",
varcon = "diagonal",
lambda_s_ini = NULL
)
Arguments
X |
For functional data observed over a regular grid: a matrix of where the rows must correspond to argument values and columns to replications.
For functional data observed over an irregular grid: a vector of length |
timeindex |
A vector of length |
curve |
A vector of length |
grid |
The vector of time points where the curves are sampled.
For Functional data observed over an irregular grid, |
q |
The dimension of the set of B-spline functions. |
lambda_l |
Tuning parameter of the functional adaptive pairwise fusion penalty (FAPFP). |
lambda_s |
Tuning parameter of the smoothness penalty. |
G |
The number of clusters. |
tol |
The tolerance for the stopping condition of the expectation conditional maximization (ECM) algorithms.
The algorithm stops when the log-likelihood difference between two consecutive iterations is less or equal than |
maxit |
The maximum number of iterations allowed in the ECM algorithm. |
par_LQA |
A list of parameters for the local quadratic approximation (LQA) in the ECM algorithm.
|
plot |
If TRUE, the estimated cluster means are plotted at each iteration of the ECM algorithm. Default is FALSE. |
trace |
If TRUE, information are shown at each iteration of the ECM algorithm. Default is FALSE. |
init |
It is the way to initialize the ECM algorithm. There are three ways of initialization: "kmeans", "model-based", and "hierarchical", that provide initialization through the k-means algorithm, model-based clustering based on parameterized finite Gaussian mixture model, and hierarchical clustering, respectively. Default is "kmeans". |
varcon |
A vector of character strings indicating the type of coefficient covariance matrix. Three values are allowed: "full", "diagonal", and "equal". "full" means unrestricted cluster coefficient covariance matrices allowed to be different among clusters. "diagonal" means diagonal cluster coefficient covariance matrices that are equal among clusters. "equal" means diagonal cluster coefficient covariance matrices, with equal diagonal entries, that are equal among clusters. Default is "diagonal". |
lambda_s_ini |
The tuning parameter used to obtain the functional data through smoothing B-splines before applying the initialization algorithm. If NULL a Generalized cross validation procedure is used as described in Ramsay (2005). Default is NULL. |
Value
A list containing the following arguments:
mod
that is a list composed by
-
data
: A list containing the vectorized form ofX
,timeindex
, andcurve
. For functional data observed over a regular gridtimeindex
andcurve
are trivially obtained. -
parameters
: A list containing all the estimated parameters. -
vars
: A list containing results from the Expectation step of the ECM algorithm. -
FullS
: The matrix of B-spline computed overgrid
. -
grid
: The vector of time points where the curves are sampled. -
W
: The basis roughness penalty matrix containing the inner products of pairs of basis function second derivatives. -
AW_vec
: Vectorized version of the diagonal matrix used in the approximation of FAPFP. -
P_tot
: Sparse Matrix used to compute all the pairwise comparisons in the FAPFP. -
lambda_s
: Tuning parameter of the smoothness penalty. -
lambda_l
: Tuning parameter of the FAPFP.
A list, named clus
, containing the following arguments:
-
classes
: The vector of cluster membership. -
po_pr
: Posterior probabilities of cluster membership.
mean_fd
The estimated cluster mean functions.
class
A label for the output type.
References
Centofanti, F., Lepore, A., & Palumbo, B. (2021). Sparse and Smooth Functional Data Clustering. arXiv preprint arXiv:2103.15224.
Ramsay, J., Ramsay, J., & Silverman, B. W. (2005). Functional Data Analysis. Springer Science & Business Media.
See Also
Examples
library(sasfunclust)
train<-simulate_data("Scenario I",n_i=20,var_e = 1,var_b = 0.5^2)
mod<-sasfclust(X=train$X,grid=train$grid,lambda_s = 10^-6,lambda_l =10,G = 2,maxit = 5,q=10)
plot(mod)