Learn R Programming

metaforest (version 0.1.4)

extract_proximity: Extract proximity matrix for a MetaForest object.

Description

Extract proximity matrix for a MetaForest object.

Usage

extract_proximity(fit, newdata)

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.

Arguments

fit

object of class \'MetaForest\'.

newdata

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

Examples

Run this code
# \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)
# }

Run the code above in your browser using DataLab