Computes linear discriminant analysis on classified cluster groups. This function plots a bar graph indicating the goodness of classification for each group.

sjc.grpdisc(data, groups, groupcount, clss.fit = TRUE, prnt.plot = TRUE)

Arguments

data

A data frame with variables that should be used for the cluster analysis.

groups

group classification of the cluster analysis that was returned from the sjc.cluster-function

groupcount

amount of groups (clusters) that should be used. Use sjc.elbow to determine the group-count depending on the elbow-criterion.

clss.fit

logical, if TRUE (default), a vertical line indicating the overall goodness of classification is added to the plot, so one can see whether a certain group is below or above the average classification goodness.

prnt.plot

logical, if TRUE (default), plots the results as graph. Use FALSE if you don't want to plot any graphs. In either case, the ggplot-object will be returned as value.

Value

(Invisibly) returns an object with

  • data: the used data frame for plotting,

  • plot: the ggplot object,

  • accuracy: a vector with the accuracy of classification for each group,

  • total.accuracy: the total accuracy of group classification.

Examples

# retrieve group classification from hierarchical cluster analysis # on the mtcars data set (5 groups) groups <- sjc.cluster(mtcars, 5) # plot goodness of group classificatoin sjc.grpdisc(mtcars, groups, 5)