plot.ndmodel {noisemodel}R Documentation

Plot function for class ndmodel

Description

Representation of the dataset contained in an object of class ndmodel after the application of a noise introduction model.

Usage

## S3 method for class 'ndmodel'
plot(x, ..., noise = NA, xvar = 1, yvar = 2, pca = FALSE)

Arguments

x

an object of class ndmodel.

...

other options to pass to the function.

noise

a logical indicating which samples to show. The valid options are:

  • TRUE: to show only the noisy samples.

  • FALSE: to show only the clean samples.

  • NA: to show both the clean and noisy samples (default value).

xvar

an integer with the index of the input attribute (if pca = FALSE) or the principal component (if pca = TRUE) to represent in the x axis (default: 1).

yvar

an integer with the index of the input attribute (if pca = FALSE) or the principal component (if pca = TRUE) to represent in the y axis (default: 2).

pca

a logical indicating if PCA must be used (default: FALSE).

Details

This function performs a two-dimensional representation using the ggplot2 package of the dataset contained in the object x of class ndmodel. Each of the classes in the dataset (available in x$ynoise) is represented by a different color. There are two options to represent the input attributes of the samples on the x and y axes of the graph:

Finally, the parameter noise is used to indicate which samples (noisy, clean or all) to show. Clean samples are represented by circles in the graph, while noisy samples are represented by crosses.

Value

An object of class ggplot and gg with the graph created using the ggplot2 package.

See Also

print.ndmodel, summary.ndmodel, sym_uni_ln, sym_cuni_ln, sym_uni_an

Examples

# load the dataset
data(iris)

# apply the noise introduction model
set.seed(9)
output <- sym_uni_ln(x = iris[,-ncol(iris)], y = iris[,ncol(iris)], level = 0.1)

# plots for all the samples, the clean samples and the noisy samples using PCA
plot(output, pca = TRUE)
plot(output, noise = FALSE, pca = TRUE)
plot(output, noise = TRUE, pca = TRUE)

# plots using the Petal.Length and Petal.Width variables
plot(output, xvar = 3, yvar = 4)
plot(output, noise = FALSE, xvar = 3, yvar = 4)
plot(output, noise = TRUE, xvar = 3, yvar = 4)


[Package noisemodel version 1.0.2 Index]