YsimulationR Documentation

Simulation of the vector of responses Y. Data preparation stage for simulation.

Description

Additional function to be used for simulation purposes (academical or research). Simulating the vector of responses Y according to the formula (see details).

Usage

Ysimulation(t, I, X, lambda, sigma = 1, beta)

Arguments

t

Vector of the observed time (n x 1), n – number of observations

I

Vector of the initial states (n x 1), n – number of observations

X

Matrix of predictors (n x k), n - number of observations, k - number of columns (k - 1 - number of regressors).

lambda

Matrix with the known transition rates λ_{i,j}, (m x m), m – number of states

sigma

Scalar, the standard deviation of the disturbance term

beta

Matrix (k x m), k - number of columns (k - 1 - number of regressors), m - number of states, m = 2,3,.. .

Details

The i-th response $Y_i$ is defined by the following formula: $Y_i(t)=x_iβ + Z_i sqrtt, i=1,...,n.$ The vector with stationary probabilities is user-defined vector.

Value

Vector with new response values of vector Y (n x 1)

Examples

Xtest <- cbind(rep_len(1,10),c(2,5,7,3,1,1,2,2,3,6), c(5,4,1,2,3,2,3,5,2,2))
tGiven <- matrix (c(0.9,1.18,1,1.6,1.4,1.7,1.9,1.45,1.5,2.14), nrow = 10, ncol = 1)
initState <- matrix (c(2,1,1,2,2,2,1,1,2,1),nrow = 10, ncol = 1)
lambda <- matrix(c(0, 0.33, 0.45, 0), nrow = 2, ncol = 2, byrow = TRUE)
beta <- matrix(c(1, 2, 3, 4, 6, 8), nrow = 3, ncol = 2, byrow = TRUE)
Ysimulation(tGiven,initState,Xtest,lambda,1,beta)