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 \sum_{i=1}^{N}n_i, with N the number of curves, where the entries from \sum_{i=1}^{k-1}(n_i+1) to \sum_{i=1}^{k}n_i are elements representing the observations for curve k.

timeindex

A vector of length \sum_{i=1}^{N}n_i. The entries from \sum_{i=1}^{k-1}(n_i+1) to \sum_{i=1}^{k}n_i provide the locations on grid of curve k. So for example, if the kth curve is observed at time points t_l,t_m of the grid then the the entries from \sum_{i=1}^{k-1}(n_i+1) to \sum_{i=1}^{k}n_i would be l,m, being n_k=2. If X is a matrix, timeindex is ignored.

curve

A vector of length \sum_{i=1}^{N}n_i. The entries from \sum_{i=1}^{k-1}(n_i+1) to \sum_{i=1}^{k}n_i are equal to k. If X is a matrix, curve is ignored.

grid

The vector of time points where the curves are sampled. For Functional data observed over an irregular grid, timeindex and grid provide the time points for each curve.

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 tol.

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. eps_diff is the lower bound for the coefficient mean differences, values below eps_diff are set to zero. MAX_iter_LQA is the maximum number of iterations allowed in the LQA. eps_LQA is the tolerance for the stopping condition of LQA.

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

A list, named clus, containing the following arguments:

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

sasfclust_cv

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)

[Package sasfunclust version 1.0.0 Index]