Skip to main content
. 2021 Feb 2;18(3):1333. doi: 10.3390/ijerph18031333
Algorithm A1: Impute missing values with random forest [28].
Require: X is an n × p matrix, setup stopping criterion (γ)
  setup initial guess for missing values;
  k vector of sorted indices of columns in X w.r.t. increasing amount of missing values;
  while not γ do
   Xoldimp store previously imputed matrix;
   for s in k do
    Fit a random forest: yobs(s)xobs(s);
    Predict ymis(s) using xmis(s);
    Xnewimp update imputed matrix, using predicted ymis(s);
    end for
    update γ
   end while
   return the imputed matrix Ximp