Skip to contents

Simulates functional data for K clusters based on specified parameters for clustering analysis within the `fda.clust` package. It uses `rprocKmu` to generate the latent processes and `rproc2fdata` from `fda.usc` to generate the functional data.

Usage

rprocKclust(t, n, process, c, k = NULL, s = 1, par.list = NULL, ...)

Arguments

t

A numeric vector representing the evaluation points (argvals) at which the functional data are computed.

n

A vector of integers specifying the number of curves to be generated for each of the K clusters.

process

A character vector of length K specifying the type of each latent process. Options include "poly1", "poly2", "sin", "cos", "sin_cos", and "cos_sin".

c

A numeric vector of length K specifying the coefficients for each process.

k

An optional numeric vector of length K specifying the exponents for the processes. This parameter is only relevant for "poly1" and "poly2".

s

A numeric vector specifying the standard deviation of the noise to be added to each cluster's data. If only one value is provided, it is recycled for all clusters.

par.list

A list of lists of additional parameters to be passed to rproc2fdata for generating the functional data for each cluster.

...

Additional arguments to be passed to rproc2fdata, allowing for further customization of the process generation.

Value

A list containing the following elements:

  • X: The functional data as an fdata object.

  • X.hat: The estimated mean functions for each cluster.

  • groups: The group labels for each curve.

  • color: The colors associated with each cluster.

  • colors: The colors assigned to each individual curve.

Examples

t <- seq(0, 2*pi, length.out = 101)
res <- rprocKclust(t, 
                   n = c(30, 50, 40), 
                   process = c("poly1", "sin", "cos"), 
                   c = c(10, 1, 1), 
                   k = c(2, NA, NA), 
                   s = c(0.2, 0.3, 0.1))

plot(res$X, col = res$colors)
lines(res$X.hat, lwd = 2, col = res$color)