Skip to contents

Simulate white noise series from a list of functions and vector of regimes. This function is used internally for simulation from MixAR models.

Usage

mixARnoise_sim(rdist, z)

Arguments

rdist

a list of functions for random number generation, see `Details'.

z

a vector of positive integers specifying the 'regimes'.

Details

If the length of the list rdist is max(z), then z[[i]] is the random number generator for regime i. Alternatively, if rdist is of length one, then the same generator will be used for all regimes.

mixARnoise_sim returns a vector, say y, of the same length as z, such that y[i] is generated by z[[i]].

Value

a numeric vector

See also

Examples

## MixAR with 2 components: N(0,1) and t_5
set.seed = 1234
z <- sample(2, size = 5, replace = TRUE)
mixARnoise_sim(list(rnorm, function(n) rt(n, 5)), z)
#> [1]  0.4952791 -1.6357424  0.6639916  0.9037336  0.1274709