% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/eValidation.R
\name{eValidation}
\alias{eValidation}
\title{Validate an E2Tree Model via Proximity Matrix Comparison}
\usage{
eValidation(
  data,
  fit,
  D,
  test = c("both", "mantel", "measures"),
  graph = TRUE,
  n_perm = 999,
  conf.level = 0.95,
  seed = NULL
)
}
\arguments{
\item{data}{A data frame containing the variables in the model.}

\item{fit}{An e2tree object.}

\item{D}{The dissimilarity matrix obtained with \code{\link{createDisMatrix}}.}

\item{test}{Character string specifying which tests to perform. One of
\code{"both"} (default), \code{"mantel"} (Mantel test only), or
\code{"measures"} (divergence/similarity measures with permutation tests only).}

\item{graph}{Logical (default TRUE). If TRUE, heatmaps are displayed.}

\item{n_perm}{Integer. Number of permutations for the permutation
test on measures. Default is 999. Set to 0 to skip permutation testing.
Ignored when \code{test = "mantel"}.}

\item{conf.level}{Numeric. Confidence level for intervals. Default is 0.95.}

\item{seed}{Integer or NULL. Random seed for reproducibility.}
}
\value{
An object of class \code{"eValidation"} containing:
\describe{
\item{Proximity_matrix_ensemble}{Ensemble proximity matrix (reordered)}
\item{Proximity_matrix_e2tree}{E2Tree proximity matrix (reordered)}
\item{mantel_test}{Mantel test result (NULL if \code{test = "measures"})}
\item{loi}{LoI object with decomposition (NULL if \code{test = "mantel"})}
\item{measures}{Data frame with all measures (NULL if \code{test = "mantel"})}
\item{permutation}{Permutation test results for measures (if applicable)}
}
}
\description{
Compares the ensemble proximity matrix with the E2Tree-estimated proximity
matrix using multiple divergence and similarity measures. Can perform the
Mantel test, permutation tests on divergence/similarity measures (nLoI,
Hellinger, wRMSE, RV, SSIM), or both.
}
\examples{
\donttest{
## Classification:
data(iris)
smp_size <- floor(0.75 * nrow(iris))
train_ind <- sample(seq_len(nrow(iris)), size = smp_size)
training <- iris[train_ind, ]

ensemble <- randomForest::randomForest(Species ~ ., data=training,
  importance=TRUE, proximity=TRUE)

D <- createDisMatrix(ensemble, data=training, label = "Species",
  parallel = list(active=FALSE, no_cores = 1))

setting <- list(impTotal=0.1, maxDec=0.01, n=2, level=5)
tree <- e2tree(Species ~ ., training, D, ensemble, setting)

val <- eValidation(training, tree, D, n_perm = 199)
print(val)
summary(val)
plot(val)
}

}
