Skip to contents

Apply one of the imputation strategies used in the article and thesis.

Usage

impute_pls_data(
  x,
  method = c("mice", "knn", "svd"),
  seed = NULL,
  m,
  k = 15L,
  svd_rank = 10L,
  svd_maxiter = 1000L
)

Arguments

x

Incomplete predictor matrix or data frame.

method

Imputation method: "mice", "knn", or "svd".

seed

Optional random seed forwarded to stochastic imputers when supported.

m

Number of imputations for method = "mice". By default this is set to the missing-data percentage rounded to the nearest integer.

k

Number of neighbours for method = "knn".

svd_rank

Target rank for method = "svd".

svd_maxiter

Maximum number of iterations for the fallback SVD routine.

Value

A misspls_imputation object.

Examples

sim <- simulate_pls_data(n = 20, p = 10, true_ncomp = 2, seed = 1)
miss <- add_missingness(sim$x, sim$y, mechanism = "MCAR", missing_prop = 10, seed = 2)
imp <- impute_pls_data(miss$x_incomplete, method = "knn", seed = 3)
length(imp$datasets)
#> [1] 1