apply_locf_nocb: Impute Missing Values Using LOCF and NOCB

View source: R/sequential_imputation.R

apply_locf_nocbR Documentation

Impute Missing Values Using LOCF and NOCB

Description

Imputes missing values in a matrix by applying Last Observation Carried Forward (LOCF) followed by Next Observation Carried Backward (NOCB) for each subject.

Usage

apply_locf_nocb(X, subject_id)

Arguments

X

A matrix where rows represent observations and columns represent variables.

subject_id

A vector of subject IDs corresponding to the rows of X.

Value

A matrix with missing values imputed using LOCF and NOCB.

Examples

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)


SBMTrees documentation built on April 3, 2025, 6:10 p.m.