lmestData: Data for 'LMest' functions

Description Usage Arguments Value Author(s) Examples

View source: R/lmestData.R

Description

An object of class lmestData containing data in long format, some necessary information on the data structure and objects for the estimation functions.

Usage

1
2
3
4
lmestData(data, id = NULL, time = NULL,
          idAsFactor = TRUE, timeAsFactor = TRUE,
          responsesFormula = NULL, latentFormula = NULL,
          na.rm = FALSE, check.names = FALSE)

Arguments

data

a matrix or data frame in long format of observation

id

a numeric vector or a string indicating the column with the unit identifier. If NULL, the first column is considered

time

a numeric vector or a string indicating the column with the time occasions. If NULL, the second column is considered, and if the id is not NULL, the function will automatically add the column with the time occasions

idAsFactor

a logical value indicating whether or not the column with the ids is converted to a factor. (By default is set to TRUE)

timeAsFactor

a logical value indicating whether or not the column with the time occasions is converted in a factor. (By default is set to TRUE)

responsesFormula

A detailed description is given in lmest,lmestCont

latentFormula

A detailed description is given in lmest,lmestCont

na.rm

a logical value indicating whether or not the observation with at least a missing value is removed (By default is set to FALSE)

check.names

a logical value indicating whether or not the names of the variables are syntactically valid, and adjusted if necessary. (By default is set to FALSE)

Value

An object of class 'lmestData' with the following objects:

data

a data.frame object to use in the estimation functions

id

a integer vector with the unit identifier

time

a integer vector with the time occasions

n

the number of observation

TT

an integer value indicating number of time occasions

d

an interger value indicating the number of variables (columns except id and time)

Y

the response variables

Xmanifest

the variables affecting the measurement model if specified in responsesFormula

Xinitial

the variables affecting the initial probabilities of the latent model if specified in latentFormula

Xtrans

the variables affecting the transition probabilities of the latent model if specified in latentFormula

Author(s)

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
data(data_long_cont)
str(data_long_cont)

## Data with continous resposes

dt <- lmestData(data = data_long_cont, id = "id",time="time")
str(dt)

## Summary of each variable and for each time

summary(dt)

## Summary of each variable

summary(dt, type = "cross")

## Summary of each variable by time

summary(dt, type = "year")

plot(dt)
plot(dt, typePlot = "sh")

#######################

## Not run: 

data("data_criminal_sim")

dt1 <- lmestData(data = data_criminal_sim, id = "id", time = "time")
str(dt1)

summary(dt1, varType = rep("d",ncol(dt1$Y)))

dt2 <- lmestData(data = data_criminal_sim, id = "id", time = "time",
                 responsesFormula = y1 + y2 ~ y3, latentFormula = ~ y7 + y8 | y9 + y10)
str(dt2)

## Summary for responses, covariates on the manifest distribution,
## covariates on intial and transition probabilities

summary(dt2, dataSummary = "responses",varType = rep("d",ncol(dt2$Y)))
summary(dt2, dataSummary = "manifest",varType = rep("d",ncol(dt2$Xmanifest)))
summary(dt2, dataSummary = "initial",varType = rep("d",ncol(dt2$Xinitial)))
summary(dt2, dataSummary = "transition",varType = rep("d",ncol(dt2$Xtrans)))


## End(Not run)

LMest documentation built on Oct. 10, 2021, 1:09 a.m.