simulate_bites {forceR}R Documentation

Simulate bites

Description

Simulates either sinusoidal or plateau-like bites.

Usage

simulate_bites(
  no.of.bites = 5,
  length.of.bite = 1000,
  length.of.series = 10000,
  max.y = 1,
  max.y.jit = NULL,
  peak.pos = 50,
  slope.perc.start = 10,
  slope.perc.end = slope.perc.start,
  jit = NULL,
  bite.type = "sin",
  plot = TRUE
)

Arguments

no.of.bites

Number of bites in time series. Default: 5.

length.of.bite

Length of each bite. Default: 1000.

length.of.series

Length of the whole time series. Default: 10000.

max.y

Maximum y value. Default: 1.

max.y.jit

Jitter above and below maximum y value in ⁠[%]⁠ of maximum y value. Default: NULL.

peak.pos

Position (in percent) of peak within peak curve. Only applies to ⁠bite.type = "sin⁠ (sinusoidal bites.) Default: same as 50.

slope.perc.start

Percentage of how much of the whole bite is defined by the ascending slope. Only applies to ⁠bite.type = "plat⁠ (plateau-like bites.) Default: 10.

slope.perc.end

Percentage of how much of the whole bite is defined by the descending slope. Only applies to ⁠bite.type = "plat⁠ (plateau-like bites.) Default: same as slope.perc.start.

jit

Jitter along the whole time series. Default: NULL.

bite.type

String: either "sin" or "plat" for sinusoidal or plateau-like bites, respectively. Default: "sin".

plot

Logical. If TRUE, the simulated time series will be plotted to the active plot device. Default: TRUE.

Value

Returns a tibble with the columns t and y containing simulated bites.

Examples

# simulate a time series with sinusoidal bites
# where the peaks are located in the centers of the bites.
simulate_bites(no.of.bites = 5,
                length.of.bite = 1000,
                length.of.series = 10000,
                max.y = 5,
                max.y.jit = 15,
                jit = 0.5,
                peak.pos = 0.5,
                bite.type = "sin",
                plot = TRUE)

# simulate a time series with sinusoidal bites
# where the peaks are located towards the ends of the bites.
simulate_bites(no.of.bites = 5,
                length.of.bite = 1000,
                length.of.series = 10000,
                max.y = 5,
                max.y.jit = 15,
                jit = 0.5,
                peak.pos = 0.8,
                bite.type = "sin",
                plot = TRUE)

# simulate a time series with plateau-like bites
simulate_bites(no.of.bites = 5,
                length.of.bite = 1000,
                length.of.series = 10000,
                max.y = 5,
                max.y.jit = 15,
                jit = 1,
                bite.type = "plat",
                plot = TRUE)

# simulate a time series with plateau-like bites
# with slowly ascending bite start and abprupt bite end.
simulate_bites(no.of.bites = 5,
                length.of.bite = 1000,
                length.of.series = 10000,
                max.y = 5,
                max.y.jit = 15,
                slope.perc.start = 60,
                slope.perc.end = 10,
                jit = 1,
                bite.type = "plat",
                plot = TRUE)

[Package forceR version 1.0.20 Index]