drawLMlatentcont: Draw samples from LM model for continuous outcomes with...

View source: R/draw.R

drawLMlatentcontR Documentation

Draw samples from LM model for continuous outcomes with covariates in the latent model

Description

Function that draws samples from the LM model for continuous outcomes with individual covariates with specific parameters.

Usage

drawLMlatentcont(Mu, Si, Be, Ga, latentFormula, data, index,
                 paramLatent = c("multilogit","difflogit"), est = NULL,
                 format = c("long","matrices"), fort = TRUE, seed = NULL)

Arguments

Mu

array of conditional means for the response variables (r x k)

Si

var-cov matrix common to all states (r x r)

Be

parameters affecting the logit for the initial probabilities

Ga

parametes affecting the logit for the transition probabilities

latentFormula

a symbolic description of the model to be fitted. A detailed description is given in lmestCont

data

a data frame in long format, with rows corresponding to observations and columns corresponding to variables, a column corresponding to time occasions and a column containing the unit identifier

index

a character vector with two elements indicating the name of the "id" column as first element and the "time" column as second element

paramLatent

type of parametrization for the transition probabilities ("multilogit" = standard multinomial logit for every row of the transition matrix, "difflogit" = multinomial logit based on the difference between two sets of parameters)

est

object of class LMlatentcont (LMlatentcont-class)

format

character string indicating the format of final responses matrix

fort

to use fortran routine when possible (FALSE for not use fortran)

seed

an integer value with the random number generator state

Value

Y

array of continuous outcomes (n x TT x r)

U

matrix containing the sequence of latent states (n x TT)

Mu

array of conditional means for the response variables (r x k)

Si

var-cov matrix common to all states (r x r)

Be

parameters affecting the logit for the initial probabilities

Ga

parametes affecting the logit for the transition probabilities

latentFormula

a symbolic description of the model to be fitted. A detailed description is given in lmestCont

data

a data frame in long format, with rows corresponding to observations and columns corresponding to variables, a column corresponding to time occasions and a column containing the unit identifier

est

object of class LMlatentcont (LMlatentcont-class)

Author(s)

Francesco Bartolucci, Silvia Pandolfi, Fulvia Pennoni, Alessio Farcomeni, Alessio Serafini

Examples


## Not run: 
data(data_long_cont)

est <- lmestCont(responsesFormula = Y1 + Y2 + Y3~ NULL,
                 latentFormula = ~ X1 + X2,
                 index = c("id", "time"),
                 data = data_long_cont,
                 k = 3)

out <- drawLMlatentcont(est = est,format = "matrices", seed = 4321)
out1 <- drawLMlatentcont(latentFormula = ~ X1 + X2, data = data_long_cont,
                         index = c("id", "time"),
                         Mu = est$Mu,Si = est$Si,
                         Be = est$Be,Ga = est$Ga, fort=TRUE, seed = 4321, format = "matrices")


## End(Not run)

LMest documentation built on Aug. 27, 2023, 5:06 p.m.