Learn R Programming

vlda (version 1.1.5)

vlda: Visualization of Longitudinal Data Analysis

Description

Visualization of multidimensional longitudinal data based on the projection method using the indicator matrix.

Usage

vlda(x, object, time, type = c("long", "wide"))

Arguments

x

A data frame consisting of categorical data coded in numbers. Its n samples(object) should have been repeatedly measured through multiple time points; its p variables will be represented as variable coordinate. To keep track of which observation occurred in which time point, you must have included a variable, Time.

object

A vector of length n samples. The object who would have made repeatedly measure through multiple time points; the object is indicated by the name of the observation coordinate.

time

A time point of longitudinal data. Accepts a character string that denotes the name of the time variable.

type

A type of longitudinal data.

Value

obs.coordinate

A tibble data class of row coordinates. Each row represents row coordinates and the observations corresponding to each row are included in the obs_list

var.coordinate

The column coordinate.

Eigen

Summarize the principal inertias(Eigenvalues) that as a result of applying the above algorithm using the indicator matrix

GOF

Goodness-of-fit of the Approximation for 2-dimensional VLDA plot.

Details

The value returned by vlda is using as the main argument of vlda_plot and vlda_add function, the corresponding model. long-format is that each row is one time point per object So each object has T rows. All T values for each object are stacked<U+2013>they're all in the one column; wide-format is that a object repeated responses will be in a single row, and each response is in a separate column. so \((Y_{1}, \ldots ,Y_{T})\) are the response variables obtained at time \(t(=1,\ldots ,T)\).type = c(long, wide)

See Also

vlda_add vlda_plot

Examples

Run this code
# NOT RUN {
## longform of the PTSD data
data(PTSD)
PTSD <- as.data.frame(PTSD)
PTSD[,2:4] <- apply(PTSD[,2:4], 2, function(x) ifelse(x >= 3, 1, 0))
PTSD[,5] <-  ifelse(PTSD[,5] >= 6 , 1, 0)
PTSD <- data.frame(lapply(PTSD, function(x) as.factor(x)))
vlda(x = PTSD, object = "subject", time = "time", type = "long")


## Wideform od the Depression data
data(Depression)
head(Depression)
vlda(Depression, object = "Case", time = c("1week", "2weeks", "4weeks"), type = "wide")
vlda(Depression, "Case", c("1week", "2weeks", "4weeks"), "wide")

# }

Run the code above in your browser using DataLab