# raddreg: Random data generation from the Gaussian additive... In hhsmm: Hidden Hybrid Markov/Semi-Markov Model Fitting

## Random data generation from the Gaussian additive (Markov-switching) model for hhsmm model

### Description

Generates vectors of covariate and response observations from the Gaussian additive (Markov-switching) model, using B-Splines in a specified state and using the parameters of a specified model

### Usage

```raddreg(j, model, covar, ...)
```

### Arguments

 `j` a specified state `model` a `hhsmmspec` model `covar` either a function which generates the covariate vector or a list containing the following items: `mean` the mean vector of covariates (to be generated from multivariate normal distribution) `cov` the variance-covariance matrix of covariates (to be generated from multivariate normal distribution) `...` additional arguments of the `covar` function

### Value

a random matrix of observations from Gaussian additive (Markov-switching) model, in which the first columns are associated with the responses and the last columns are associated with the covariates

### Author(s)

Morteza Amini, morteza.amini@ut.ac.ir

### References

Langrock, R., Adam, T., Leos-Barajas, V., Mews, S., Miller, D. L., and Papastamatiou, Y. P. (2018). Spline-based nonparametric inference in general state-switching models. Statistica Neerlandica, 72(3), 179-200.

### Examples

```J <- 3
initial <- c(1, 0, 0)
semi <- rep(FALSE, 3)
P <- matrix(c(0.5, 0.2, 0.3, 0.2, 0.5, 0.3, 0.1, 0.4, 0.5), nrow = J,
byrow = TRUE)
par <- list(intercept = list(-21, -83, 33),
coef = list(array(c(1, 8, 52, 27, 38), dim = c(5, 1, 1)),
array(c(99, 87, 94, 77, 50), dim = c(5, 1, 1)),
array(c(-1, -8, -40, -22, -28), dim = c(5, 1, 1))),
sigma = list(0.2, 0.4, 0.1))
model <- hhsmmspec(init = initial, transition = P, parms.emis = par,
dens.emis = dnorm_additive_reg, semi = semi)
train <- simulate(model, nsim = 70, seed = 1234,
remission = raddreg, covar = list(mean = 0, cov = 1))
plot(train\$x[, 1] ~ train\$x[, 2], col = train\$s, pch = 16,
xlab = "x", ylab = "y")

```

hhsmm documentation built on May 30, 2022, 1:05 a.m.