Helper function to reorder lists according to cvFolds

reorder_list(
  a_list,
  a_0,
  valid_rows,
  n_SL = 1,
  which_nuisance,
  n,
  n_mediator_values,
  n_M1_values = 0,
  n_M2_values = 0
)

Arguments

a_list

Structured list of nuisance parameters

a_0

Treatment levels

valid_rows

List of rows of data in validation data for each split.

n_SL

Number of super learners. If >1, then predictions are averaged over repeated super learners

which_nuisance

Structure of reordering is slightly different for each relevant nuisance parameter ("OR", "PS", "MED")

n

Sample size

n_mediator_values

Number of unique combinations of mediators