trajectories {latrend} | R Documentation |
Get the trajectories
Description
Transform or extract the trajectories from the given object to a standardized format.
Trajectories are ordered by Id and observation time.
For estimated models; get the trajectories used for estimation, along with the cluster membership. This data can be used for plotting or post-hoc analysis.
Usage
trajectories(
object,
id = idVariable(object),
time = timeVariable(object),
response = responseVariable(object),
cluster = "Cluster",
...
)
## S4 method for signature 'data.frame'
trajectories(
object,
id = idVariable(object),
time = timeVariable(object),
response = responseVariable(object),
cluster = "Cluster",
...
)
## S4 method for signature 'matrix'
trajectories(
object,
id = idVariable(object),
time = timeVariable(object),
response = responseVariable(object),
cluster = "Cluster",
...
)
## S4 method for signature 'call'
trajectories(object, ..., envir)
## S4 method for signature 'lcModel'
trajectories(
object,
id = idVariable(object),
time = timeVariable(object),
response = responseVariable(object),
cluster = "Cluster",
...
)
Arguments
object |
The data or model or extract the trajectories from. |
id |
The identifier variable name, see idVariable. |
time |
The time variable name, see timeVariable. |
response |
The response variable name, see responseVariable. |
cluster |
Experimental feature for data.frame input: a vector of cluster membership per id |
... |
Arguments passed to trajectoryAssignments for generating the Cluster column. |
envir |
The |
Details
The standardized data format is for method estimation by latrend, and for plotting functions.
The generic function removes unused factor levels in the Id column, and any trajectories which are only comprised of NAs in the response.
Value
A data.frame
with columns matching the id
, time
, response
and cluster
name arguments.
See Also
Examples
data(latrendData)
method <- lcMethodLMKM(Y ~ Time, id = "Id", time = "Time")
model <- latrend(method, latrendData)
trajectories(model)