plot_factors: Plot Function for Factor Scores

Description Usage Arguments Details Author(s) References Examples

View source: R/plot_factors.R

Description

Plot functions for factor scores.

Usage

1
2
3
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 Umean, Uclust or Uscores, or a model of class mcfa, mctfa, mfa, or mtfa.

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 clust in scores, and sets to NULL if still not available.

limx

Numeric vector. Values in limx will only be used in setting the x-axis range for 1-D and 2-D plots.

limy

Numeric vector. Values in limy will only be used in setting the y-axis range for 1-D and 2-D plots.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 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])

EMMIXmfa documentation built on Dec. 18, 2019, 1:40 a.m.