Simulate functional data.

Share:

Description

Generates a functional dataset for 2-6 clusters.

Usage

1
2
3
4
5
6
7
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 signature 'sampleFuncy'
Cluster(object)
## S4 method for signature '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.

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

  • √{x}

  • sin(2*π*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.

Value

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

  • [Cluster] Retrieve vector of cluster assignments

  • [Data] Retrieve matrix of dataset

Author(s)

Christina Yassouridis

See Also

funcit

Examples

1
2
3
4
5
6
7
8
9
##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)