plot.ppgmmga: Plots the data onto the projection subspace estimated by the...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/plots.R

Description

Plot method for objects of class 'ppgmmga'.

Usage

1
2
3
4
5
6
7
## S3 method for class 'ppgmmga'
plot(x, 
     class = NULL, 
     dim = seq(x$d), 
     drawAxis = TRUE, 
     bins = nclass.Sturges,
     ...)

Arguments

x

An object of class 'ppgmmga' obtained from a call to ppgmmga function.

class

A numeric or character vector indicating the classification of the observations/cases to be plotted.

dim

A numeric vector indicating the dimensions to use for plotting. By default, all the dimensions of the projection subspace (i.e. x$d) are used. Subsets of all the available dimensions can also be provided (see example below.)
The resulting graph depends on the dimension: in the 1D case a histogram is provided, a scatterplot in the 2D case, a scatterplot matrix in higher dimensions.

drawAxis

A logical value specifying whether or not the axes should be included in the 2D scatterplot. By default is to TRUE.

bins

An R function to be used for computing the number of classes for the histogram. By default nclass.Sturges is used; see nclass.Sturges for more details. Users may provide a different function. This argument only applies to 1D graphs.

...

further arguments.

Details

Plots the cloud of points onto a subspace after appling the Projection Pursuit algorithm based on Gaussian mixtures and Genetic algorithm implemented in ppgmmga function.

Value

Returns a object of class ggplot.

Author(s)

Serafini A. srf.alessio@gmail.com
Scrucca L. luca.scrucca@unipg.it

References

Scrucca, L. and Serafini, A. (2019) Projection pursuit based on Gaussian mixtures and evolutionary algorithms. Journal of Computational and Graphical Statistics, 28:4, 847–860. DOI: 10.1080/10618600.2019.1598871

See Also

ppgmmga

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
26
## Not run: 
data(iris)
X <- iris[,-5]
Class <- iris$Species

# 1D
pp1 <- ppgmmga(data = X, d = 1, approx = "UT")
summary(pp1, check = TRUE)
plot(pp1)
plot(pp1, Class)

# 2D
pp2 <- ppgmmga(data = X, d = 2, approx = "UT")
summary(pp2, check = TRUE)
plot(pp2)
plot(pp2, Class)

# 3D
pp3 <- ppgmmga(data = X, d = 3)
summary(pp3, check = TRUE)
plot(pp3)
plot(pp3, Class)
plot(pp3, Class, dim = c(1,3))
plot(pp3, Class, dim = c(2,3))

## End(Not run)

luca-scr/ppgmmga documentation built on Oct. 2, 2021, 12:02 p.m.