numero.summary {Numero} | R Documentation |
Estimates subgroup statistics after self-organizing map analysis
numero.summary(results, elements, data = NULL, capacity = 10)
results |
A list object that contains the self-organizing map and its statistical colorings. |
elements |
A SOM topology with additional labels that indicate selected regions. |
data |
A matrix or a data frame. |
capacity |
Maximum number of subgroups to compare. |
The input results
must contain the output from
codenumero.evaluate() or similar.
The input argument elements
must be a topology of a SOM with
additional columns as in the output from numero.subgroup()
.
The function first looks for row names in data
that are also included
in results
. The rows are then divided into subgroups according to the
district assignments in results
and the region labels in
elements
.
A data frame of summary statistics, see nroSummary()
for details. The data frame also contains additional information on which
variables were used for the training of the SOM.
Ville-Petteri Makinen
# Import data. fname <- system.file("extdata", "finndiane.txt", package = "Numero") dataset <- read.delim(file = fname) # Set identities and manage missing data. dataset <- numero.clean(dataset, identity = "INDEX") # Prepare training variables. trvars <- c("CHOL", "HDL2C", "TG", "CREAT", "uALB") trdata <- numero.prepare(data = dataset, variables = trvars) # Create a self-organizing map. modl <- numero.create(data = trdata) # Evaluate map statistics for all variables. stats <- numero.evaluate(model = modl, data = dataset) # Define subgroups. x <- stats$planes$uALB tops <- which(x >= quantile(x, 0.75, na.rm=TRUE)) bottoms <- which(x <= quantile(x, 0.25, na.rm=TRUE)) elem <- data.frame(stats$som$topology, stringsAsFactors = FALSE) elem$REGION <- "MiddleAlb" elem$REGION[tops] <- "HighAlb" elem$REGION[bottoms] <- "LowAlb" # Compare subgroups. cmp <- numero.summary(results = stats, elements = elem, data = dataset)