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 |
... |
other options to pass to the function. |
noise |
a logical indicating which samples to show. The valid options are:
|
xvar |
an integer with the index of the input attribute (if |
yvar |
an integer with the index of the input attribute (if |
pca |
a logical indicating if PCA must be used (default: |
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:
If
pca = FALSE
, the values in the graph are taken from the current attribute values found inx$xnoise
. In this case,xvar
andyvar
indicate the indices of the attributes to show in the x and y axes, respectively.If
pca = TRUE
, the values in the graph are taken after performing a PCA overx$xnoise
. In this case,xvar
andyvar
indicate the index of the principal component according to the variance explained to show in the x and y axes, respectively.
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)