# NOT RUN {
#### Supplementary row and column indicator matrix added ####
### long form ###
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)))
fit <- vlda(x = PTSD, object = "subject", time = "time", type = "long")
data(PTSD_column) # The degree of drinking that may affect PTSD
PTSD_column <- as.matrix(PTSD_column)
data(PTSD_row) # Added to the row, and is intended for 316 patients after 18 months.
PTSD_row <- as.matrix(PTSD_row)
vlda_add(
fit,
add.row = PTSD_row,
add.col = PTSD_column
)
### Wide form ###
data(Depression)
fit2 <- vlda(x = Depression, object = "Case", time = c("1week", "2weeks", "4weeks"), type = "wide")
# Response after 6 weeks and gender were added the columns for 800 existing patients.
data(Depression_column)
Depression_column <- as.matrix(Depression_column)
# 100 patients who took placebo in each group of mild and severe were added to the rows.
data(Depression_row)
Depression_row <- as.matrix(Depression_row)
vlda_add(
fit2,
time.name = "6weeks",
add.row = Depression_row,
add.col = Depression_column
)
# }
Run the code above in your browser using DataLab