View source: R/sequential_imputation.R
apply_locf_nocb | R Documentation |
Imputes missing values in a matrix by applying Last Observation Carried Forward (LOCF) followed by Next Observation Carried Backward (NOCB) for each subject.
apply_locf_nocb(X, subject_id)
X |
A matrix where rows represent observations and columns represent variables. |
subject_id |
A vector of subject IDs corresponding to the rows of |
A matrix with missing values imputed using LOCF and NOCB.
X <- matrix(c(NA, 2, NA, 4, 5, NA, 7, 8, NA, NA), nrow = 5, byrow = TRUE)
subject_id <- c(1, 1, 1, 2, 2)
apply_locf_nocb(X, subject_id)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.