simRegression: Simulate noisy observations from a dynamic regression model

simRegressionR Documentation

Simulate noisy observations from a dynamic regression model

Description

Simulates data from a time series regression with dynamic regression coefficients. The dynamic regression coefficients are simulated as a Gaussian random walk, where jumps occur with a pre-specified probability sparsity. The coefficients are initialized by a N(0,1) simulation.

Usage

simRegression(
  T = 200,
  p = 20,
  p_0 = 15,
  sparsity = 0.05,
  RSNR = 5,
  ar1 = 0,
  include_plot = FALSE
)

Arguments

T

number of time points

p

number of predictors (total)

p_0

number of true zero regression terms

sparsity

the probability of a jump (i.e., a change in the dynamic regression coefficient)

RSNR

root-signal-to-noise ratio

ar1

the AR(1) coefficient for the predictors X; default is zero for iid N(0,1) predictors

include_plot

logical; if TRUE, include a plot of the simulated data and the true curve

Value

a list containing

  • the simulated function y

  • the simulated predictors X

  • the simulated dynamic regression coefficients beta_true

  • the true function y_true

  • the true observation standard devation sigma_true

Note

The root-signal-to-noise ratio is defined as RSNR = [sd of true function]/[sd of noise].

Examples

sims = simRegression() # default simulations
names(sims) # variables included in the list


drkowal/dsp documentation built on July 19, 2023, 11:42 a.m.