| NNS.SD.cluster | R Documentation |
Clusters a set of variables by iteratively extracting Stochastic Dominance (SD)-efficient sets, subject to a minimum cluster size.
NNS.SD.cluster(
data,
degree = 1,
type = "discrete",
min_cluster = 1,
dendrogram = FALSE
)
data |
A numeric matrix or data frame of variables to be clustered. |
degree |
Numeric options: (1, 2, 3). Degree of stochastic dominance test. |
type |
At degree 1, |
min_cluster |
Integer. Peeling stops once at most |
dendrogram |
Logical; |
The function applies NNS.SD.efficient.set iteratively, peeling off the SD-efficient set at each step
(whatever its size) while more than min_cluster variables remain, or until no more subsets can be extracted.
Variables in each SD-efficient set form a cluster. The remaining variables form the final cluster, which is merged
into the previous cluster if it has fewer than min_cluster members.
A list with the following components:
Clusters: A named list of cluster memberships where each element is the set of variable names belonging to that cluster.
Dendrogram (optional): If dendrogram = TRUE, an hclust object is also returned.
Fred Viole, OVVO Financial Systems
Viole, F. and Nawrocki, D. (2016) "LPM Density Functions for the Computation of the SD Efficient Set." Journal of Mathematical Finance, 6, 105-126. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.4236/jmf.2016.61012")}.
Viole, F. (2017) "A Note on Stochastic Dominance." \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2139/ssrn.3002675")}
## Not run:
set.seed(123)
x <- rnorm(100)
y <- rnorm(100)
z <- rnorm(100)
A <- cbind(x, y, z)
# Perform SD-based clustering (degree 1), requiring at least 2 elements per cluster
results <- NNS.SD.cluster(data = A, degree = 1, min_cluster = 2)
print(results$Clusters)
# Produce a dendrogram as well
results_with_dendro <- NNS.SD.cluster(data = A, degree = 1, min_cluster = 2, dendrogram = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.