Extract proximity matrix for a MetaForest object.

extract_proximity(fit, newdata)

Arguments

fit

object of class \'MetaForest\'.

newdata

new data with the same columns as the data used for fit

Value

an n x n matrix where position i, j gives the proportion of times observation i and j are in the same terminal node across all trees.

Examples

# \dontshow{
set.seed(42)
data <- SimulateSMD(k_train = 100, distribution = "bernoulli", model = es *
                    x[,1]*x[,2])
#Conduct unweighted MetaForest analysis
mf.unif <- MetaForest(formula = yi ~ ., data = data$training,
                      whichweights = "unif", method = "DL")
prox_matrix <- extract_proximity(mf.unif)
# }