Skip to contents

A general wrapper function to allow generation of functional data according to several approaches: bbridge, bmotion, kl, ou, and far1.

Usage

generate_data(fparam, data_details, burnin = 100)

Arguments

fparam

fparam of data (or resolution that will be equally spaced on [0,1]).

data_details

List of named lists indicating parameters for each data group. Each process can use different parameters, given below.

  • bmotion: Brownian motion contains:

    • N: Numeric indicating the number of observations.

    • sd: Numeric for the standard deviation of the observations.

  • bbridge: Brownian bridge contains:

    • N: Numeric indicating the number of observations.

    • sd: Numeric for the standard deviation of the observations.

  • kl: Karhunen-Loeve expansion contains:

    • N: Numeric indicating the number of observations.

    • distribution: Distribution of the errors. Options include: binomial, exponential, laplace, normal, t (add dof argument), gamma (add shape argument), and cauchy.

    • eigenvalues: Numerics for the eigenvalues of the given distribution (value for each in basis).

    • mean: Numeric for the mean of the group.

    • dependence: Strength of dependence between observation.

    • basis: fda basisfd object.

    • dof: (Optional) Numeric for the degrees of freedom if using a t distribution.

    • shape: (Optional) Numeric for the shape if using a gamma distribution.

  • ou: Ornstein-Uhlenbeck process requires:

    • N: Numeric indicating the number of observations.

    • dependence: Strength of dependence between observation.

  • far1: Functional autoregressive process of order 1 contains:

    • N: Numeric indicating the number of observations.

    • dependence: Strength of dependence between observation.

    • sd: Numeric for the standard deviation of the observations.

    • vary: Boolean if the starting value each observation should be 0 or vary. It does this by dropping first value. If fparam is given as a number, it can adjust so that the length is the same. If fparam is a vector, the fparam will be one smaller.

burnin

Numeric for amount of burnin for data. Only used for the first groups. Subsequent groups begin at the end of the last group.

Value

A dfts object for the generated data.

Examples

result <- generate_data(
  fparam=15,
  data_details =list('bmotion'=list('N'=100, 'sd'=1),
                     'bbridge'=list('N'=100, 'sd'=1),
                     'bbridge'=list('N'=100, 'sd'=1),
                     'kl'=list('N'=100,
                               'distribution'='Normal',
                               'eigenvalues'=1/1:4,
                               'mean'=0, 'dependence'=0,
                               'basis'=fda::create.bspline.basis(),
                               'sd'=1),
                     'ou'=list('N'=100, 'dependence'=0 ) ,
                     'far1'=list('N'=100, 'dependence'=0,
                                 'sd'=1,'vary'=FALSE) )
)