dataGenerator: Data Generator

View source: R/dataFunctions.R

dataGeneratorR Documentation

Data Generator

Description

Generating data with a given model = changepoint relative positions + parameters + type of cost + (standard deviation + gamma decay)

Usage

dataGenerator(
  n,
  changepoints,
  parameters,
  type = "mean",
  sigma = 1,
  gamma = 1,
  size = 10
)

Arguments

n

number of data points to generate

changepoints

vector of positions of the changepoints in (0,1] (last element is always 1).

parameters

vector of means for the consecutive segments (same length as changepoints)

type

a string defining the cost model to use: "mean", "variance", "poisson", "exp", "negbin"

sigma

a positive number = the standard deviation of the data

gamma

a number between 0 and 1 : the coefficient of the exponential decay (by default = 1 for piecewise constant signals)

size

parameter of the rnbinom function

Value

a vector of size n generated by the chosen model

Examples

dataGenerator(500, c(0.3, 0.6, 1), c(1, 2, 3), type = "mean", sigma = 0.5)

dataGenerator(1000, c(0.2, 0.33,0.5, 1), c(4, 0.2, 3,0.5), type = "variance")

dataGenerator(800, c(0.4, 0.8, 1), c(15, 5, 8), type = "mean", gamma  = 0.95, sigma = 0.4)

dataGenerator(400, c(0.4, 0.9, 1), c(2, 1.5, 3), type = "poisson")

dataGenerator(1000, c(0.44, 0.86, 1), c(0.5, 0.2, 0.4), type = "negbin", size = 3)

gfpop documentation built on April 1, 2023, 12:22 a.m.