Description Usage Arguments Value References See Also Examples
View source: R/sasfunclust_functions.R
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).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
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 ∑_{i=1}^{N}n_i, with N the number of curves, where the entries from ∑_{i=1}^{k-1}(n_i+1) to ∑_{i=1}^{k}n_i are elements representing the observations for curve k. |
timeindex |
A vector of length ∑_{i=1}^{N}n_i. The entries from ∑_{i=1}^{k-1}(n_i+1) to ∑_{i=1}^{k}n_i provide the locations on |
curve |
A vector of length ∑_{i=1}^{N}n_i. The entries from ∑_{i=1}^{k-1}(n_i+1) to ∑_{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, |
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. |
A list containing the following arguments:
mod
that is a list composed by
data
: A list containing the vectorized form of X
, timeindex
, and curve
. For functional data observed over a regular grid timeindex
and curve
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 over grid
.
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.
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.
1 2 3 4 | 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.