Learn R Programming

funcy (version 1.0.1)

sampleFuncy: Simulate functional data.

Description

Generates a functional dataset for 2-6 clusters.

Usage

sampleFuncy(obsNr=100, k=4, timeNr=20, timeNrMax=NULL,
            timeNrMin=NULL, timeInterval=c(0, 1),
            nrGridPts=30, sd=0.3, reg=TRUE)
# S4 method for sampleFuncy
Cluster(object)
# S4 method for sampleFuncy
Data(object,…)

Arguments

obsNr

Number of curves.

k

Number of classes.

timeNr

Number of time points for regular datasets in Format2 (see funcit).

timeNrMax

Maximal number of time points for irregular datasets in Format1 (see funcit).

timeNrMin

Minimal number of time points for irregular dataset in Format1 (see funcit).

timeInterval

Time interval where time points are drawn from.

nrGridPts

Time interval is divided into nrGridPts grid points where time points are randomly drawn from.

sd

Standard deviation from the center curves.

reg

Regular dataset in Format2 or irregular dataset in Format1 (see funcit).

object

An object of class sampleFuncy

Not used.

Value

  • [sampleFuncy] A list with entries data and clusters.

  • [Cluster] Retrieve vector of cluster assignments

  • [Data] Retrieve matrix of dataset

Details

Curves are generated by adding a normally distributed error term with mean 0 and standard deviation sd to the center functions. The center functions are sampled from

  • \(x^2\)

  • \(\sqrt{x}\)

  • \(sin(2*\pi*x)\)

  • \(x^3\)

  • \(-x^2\)

  • \(x-1\)

If reg=TRUE all curves are evaluated on the same time points. If reg=FALSE evaluation place and number can differ for each curve.

References

Christina Yassouridis and Dominik Ernst and Friedrich Leisch. Generalization, Combination and Extension of Functional Clustering Algorithms: The R Package funcy. Journal of Statistical Software. 85 (9). 1--25. 2018

See Also

funcit

Examples

Run this code
# NOT RUN {
##sample a regular dataset
set.seed(2705)
ds <- sampleFuncy(obsNr=100, k=4, timeNr=20, reg=TRUE)
plotFuncy(ds)

##sample an irregular dataset
set.seed(2705)
ds <- sampleFuncy(obsNr=100, k=4, timeNrMin=3, timeNrMax=10, reg=FALSE)
plotFuncy(ds, lty=1)
# }

Run the code above in your browser using DataLab