SimuBlocks: Generate simulated data

Description Usage Arguments Details Value Author(s) References Examples

Description

Generate data for simulations.

Usage

1
2
3
SimuBlocks(n, sigma = 0.1, seed = NA)
SimuWave(n, sigma = 0.1, seed = NA)
SimuDoppler(n, sigma = 0.1, seed = NA)

Arguments

n

The number of observations.

sigma

A positive value to specify the standard deviation of the Gaussian noise.

seed

a single value to specify the seed used for generating data. See set.seed for details.

Details

Let x = i/n, i=1,…,n. Assume that y_x follows an underlying trend y0_x with additive noise ε_x, i.e.,

y_x = y0_x + ε_x,

where y0_x is a smooth curve representing relatively long-term movements and ε_x is often assumed to follow i.i.d. N(0, σ^2).

Value

A list with the following components:

y

The simulated data of length n.

x

The locations of y, of length n.

y0

The true signal of length n.

tau

Locations of the true knots.

SetA

Indexs of the true knots.

Author(s)

Canhong Wen, Xueqin Wang, Shijie Quan, Zelin Hong and Aijun Zhang.

Maintainer: Canhong Wen <wench@ustc.edu.cn>

References

Wen, C., Zhu, J., Wang, X., and Zhang, A. (2019) L0 trend filtering, technique report.

Examples

1
2
3
4
5
6
7
  ##------ Piecewise constant trend filtering example in Wen et al.(2018).-----
  set.seed(1)
  data <- SimuBlocks(2048)
  fit <- samias(data$y, kmax = 15)           # With default input argument
  plot(fit, type="coef", main = "Blocks")    # Plot the optimal estimate
  lines(data$x, data$y0, type="s")           # Add the true signal for reference
  plot(fit, type= "vpath", main = "Blocks")  # Plot the solution path

AMIAS documentation built on May 2, 2019, 2:10 a.m.

Related to SimuBlocks in AMIAS...