Learn R Programming

sjPlot (version 2.6.3)

sjc.grpdisc: Compute a linear discriminant analysis on classified cluster groups

Description

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

Usage

sjc.grpdisc(data, groups, groupcount, clss.fit = 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.

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

Run this code
# NOT RUN {
# 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)

# }

Run the code above in your browser using DataLab