lmestData {LMest} | R Documentation |
Data for LMest
functions
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
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 |
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 |
|
latentFormula |
|
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 |
Xinitial |
the variables affecting the initial probabilities of the latent model if specified in |
Xtrans |
the variables affecting the transition probabilities of the latent model if specified in |
Author(s)
Francesco Bartolucci, Silvia Pandolfi, Fulvia Pennoni, Alessio Farcomeni, Alessio Serafini
Examples
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)