This recursion function conducts the Biswas and Ghosh multivariate test based on the dendrogram from the hierarchical clustering of the average distance matrix of the unsupervised random forest.

recursive.test(
  dend,
  df,
  cateVar = NULL,
  ordinalVar = NULL,
  cohortid.var = "cohortid",
  alpha.level = 0.05,
  verbose = T,
  saveIntermediate = F,
  BG.method = "asymptotic",
  n_perm = 200,
  N_auto = 50,
  impute = T,
  miceArgs = list(method = "mean", maxit = 1)
)

Arguments

dend

dendrogram object from the stat::as.as.dendrogram()

df

data.frame

cateVar

string or vector, names of variables are categorical, which will be converted into dummy variables

ordinalVar

string or vector, names of variables are ordinal factors, which will be converted into numeric variables

cohortid.var

string, name of the cohort id indicator in the relate::df

alpha.level

numeric, alpha level for statistical significance of the BG test

verbose

boolean, whether to print the intermediate test results at each round

saveIntermediate

boolean, whether to save the intermediate test result in the final output

BG.method

string, "asymptotic","permutation","automatic", see relate::BGcompare above

n_perm

number of permutation if method is permutation

N_auto

integer, the sample size for automatically choosing between asymptotic and permutation, below is permutation, above is asymptotic

impute

boolean, whether to conduct MICE imputation within clusters before testing

miceArgs

list, a list of arguments parse into mice::mice