plot_factors {EMMIXmfa} | R Documentation |
Plot Function for Factor Scores
Description
Plot functions for factor scores.
Usage
plot_factors(scores, type = "Umean",
clust=if (exists('clust', where = scores)) scores$clust else NULL,
limx = NULL, limy = NULL)
Arguments
scores |
A list containing factor scores specified by
|
type |
What type of factor scores are to be plotted. See Details. |
clust |
Indicators of belonging to components. If available, they will be
portrayed in plots.
If not provided, looks for |
limx |
Numeric vector. Values in |
limy |
Numeric vector. Values in |
Details
When the factor scores were obtained using mcfa
or mctfa
, then a visualization of the group structure
can be obtained by plotting the factor scores.
In the case of mfa
and mtfa
, the factor scores
simply corresponds to white noise.
The type
should either be "Uscores"
, "Uclust"
or
the default "Umean"
. See factor_scores
for a detailed
description of the factor scores.
Author(s)
Geoffrey McLachlan, Suren Rathnayake, Jungsun Baek
References
McLachlan GJ, Baek J, and Rathnayake SI (2011). Mixtures of factor analyzers for the analysis of high-dimensional data. In Mixture Estimation and Applications, KL Mengersen, CP Robert, and DM Titterington (Eds). Hoboken, New Jersey: Wiley, pp. 171–191.
McLachlan GJ, and Peel D (2000). Finite Mixture Models. New York: Wiley.
Examples
# Visualizing data used in model estimation
set.seed(1)
inds <- dim(iris)[1]
indSample <- sample(1 : inds, 50)
model <- mcfa (iris[indSample, -5], g = 3, q = 2,
nkmeans = 1, nrandom = 0, itmax = 150)
minmis(model$clust, iris[indSample, 5])
#same as plot_factors(model, tyep = "Umean", clust = model$clust)
plot(model)
#can provide alternative groupings of samples via plot_factors
plot_factors(model, clust = iris[indSample, 5])
#same as plot_factors(model, tyep = "Uclust")
plot(model, type = "Uclust")
Y <- iris[-c(indSample), -5]
Y <- as.matrix(Y)
clust <- predict(model, Y)
minmis(clust, iris[-c(indSample), 5])
fac_scores <- factor_scores(model, Y)
plot_factors(fac_scores, type = "Umean", clust = clust)
plot_factors(fac_scores, type = "Umean", clust = iris[-c(indSample), 5])