GetData {cmpp} | R Documentation |
Retrieve Initialized Data from the Cmpp Model
Description
This function retrieves the data initialized in the Cmpp model, including the feature matrix, failure times,
and competing risks indicators (delta1
and delta2
).
Details
This function requires the Cmpp model to be initialized using the Initialize
function. It retrieves the
data stored in the Cmpp object, which includes the feature matrix, failure times, and the binary indicators for
competing risks. If the Cmpp object is not initialized, the function will throw an error.
Value
A list containing:
features |
A numeric matrix of predictor variables. Each row corresponds to an observation. |
timee |
A numeric vector of failure times corresponding to observations. |
delta1 |
A binary vector indicating the occurrence of the first competing event (1 for observed). |
delta2 |
A binary vector indicating the occurrence of the second competing event (1 for observed). |
Examples
library(cmpp)
data("fertility_data")
Nam <- names(fertility_data)
fertility_data$Education
datt <- make_Dummy(fertility_data, features = c("Education"))
datt <- datt$New_Data
datt['Primary_Secondary'] <- datt$`Education:2`
datt['Higher_Education'] <- datt$`Education:3`
datt$`Education:2` <- datt$`Education:3` <- NULL
datt2 <- make_Dummy(datt, features = 'Event')$New_Data
d1 <- datt2$`Event:2`
d2 <- datt2$`Event:3`
feat <- datt2[c('age', 'Primary_Secondary', 'Higher_Education')] |>
data.matrix()
timee <- datt2[['time']]
Initialize(feat, timee, d1, d2, 1e-10)
data <- GetData()
print(data$features) # Feature matrix
print(data$timee) # Failure times
print(data$delta1) # Indicator for the first competing event
print(data$delta2) # Indicator for the second competing event