drawLMbasiccont {LMest} | R Documentation |
Draw samples from the basic LM model for continuous outcomes
Description
Function that draws samples from the basic LM model for continuous outcomes with specific parameters.
Usage
drawLMbasiccont(piv, Pi, Mu, Si, n, est = NULL,
format = c("long","matrices"), seed = NULL)
Arguments
piv |
vector of initial probabilities of the latent Markov chain |
Pi |
set of transition probabilities matrices (k x k x TT) |
Mu |
matrix of conditional means for the response variables (r x k) |
Si |
var-cov matrix common to all states (r x r) |
n |
sample size |
est |
object of class |
format |
character string indicating the format of final responses matrix |
seed |
an integer value with the random number generator state |
Value
Y |
array of continuous outcomes (n x TT x r) |
piv |
vector of initial probabilities of the latent Markov chain |
Pi |
set of transition probabilities matrices (k x k x TT) |
Mu |
matrix of conditional means for the response variables (r x k) |
Si |
var-cov matrix common to all states (r x r) |
n |
sample size |
est |
object of class |
Author(s)
Francesco Bartolucci, Silvia Pandolfi, Fulvia Pennoni, Alessio Farcomeni, Alessio Serafini
Examples
## Not run:
# draw a sample for 1000 units and 3 response variable
n <- 1000
TT <- 5
k <- 2
r <- 3 #number of response variables
piv <- c(0.7,0.3)
Pi <- matrix(c(0.9,0.1,0.1,0.9), k, k)
Pi <- array(Pi, c(k, k, TT))
Pi[,,1] <- 0
Mu <- matrix(c(-2,-2,0,0,2,2), r, k)
Si <- diag(r)
out <- drawLMbasiccont(piv, Pi, Mu, Si, n)
data(data_long_cont)
est <- lmestCont(responsesFormula = Y1 + Y2 + Y3 ~ NULL,
index = c("id", "time"),
data = data_long_cont,
k = 3,
modBasic = 1,
tol = 10^-5)
out2 <- drawLMbasiccont(est = est, n = 100, format = "long", seed = 4321)
## End(Not run)