plot.dbcsp {dbcsp}R Documentation

Plot function implemented by dbcsp class

Description

This function plots an instance before and/or after its DB-CSP projection.

Usage

## S3 method for class 'dbcsp'
plot(x, class = 1, index = 1, vectors = 1:(x@q*2), pairs=TRUE,
     before = TRUE, after = TRUE, legend = FALSE, getsignals = FALSE, ...)

Arguments

x

object of class dbcsp.

class

integer, which of both classes to access (1 or 2), by default class=1

index

an integer, representing which instance of the class to plot, by default index=1.

vectors

an integer or vector of integers, representing the vectors to plot after the projection, by default all the vectors used in the projection are plotted vectors=1:(x@q*2).

pairs

logical, if TRUE the pairs of the indicated vectors are also shown, by default pairs=TRUE.

before

logical, if TRUE the original signals are plotted, by default before=TRUE.

after

logical, if TRUE the signals after projection are plotted, by default after=TRUE.

legend

logical, if true the legend of the transformed signals is shown, by default legend=FALSE. When plotting more than 15 pairs of signals (15*2=30 signals), the legend is not shown. If before=TRUE legends are not displayed.

getsignals

logical, if TRUE the projected signals for the selected class, instance and vectors are returned, by default getsignals=FALSE.

...

optional arguments inherited from the matplot method.

Details

It plots an instance before and/or after being projected with the DB-CSP filter. Vectors values must lie between 1 and 2*q, being q the number of dimensions used to perform the DB-CSP algorithm when creating the dbcsp object. The following should be taken into account when plotting:

If pairs=TRUE, it is recommended that vectors<q for better understanding, since their pairs are plotted as well. In case that vectors>q, it should be noted that the values are displayed from b1 to bq, where b1 and bq represent q+1 vector and 2*q vector, respectively. The paired vectors (a1-b1, a2-b2, ...) are plotted with the same color, but different line type.

For example if q=15 and plot(object, vectors=16, pairs=FALSE), b1 (16-q=1) vector is shown.

The number of rows and columns of the layout (mfrow, mfcol) can not be modified, as the function select them according to before and after parameters.

Value

Displays a plot of the selected instance before and/or after the DB-CSP filter projection. The vectors shown after the projection are differentiated by the q first and q last vectors, since the former maximize the variance of one class and minimize the variance of the other, while the latter do the opposite. If getsignals=TRUE, a matrix with the projected signals shown in the plot is returned.

See Also

dbcsp, print, summary, train, selectQ, predict, boxplot

Examples

# Read data from 2 classes
x <- AR.data$come
y <- AR.data$five
mydbcsp <- new("dbcsp", X1 = x, X2 = y)
plot(mydbcsp)
plot(mydbcsp,class=2,index=30,vectors=1:5,before=FALSE, legend=TRUE)
pSignals <- plot(mydbcsp,class=2,index=30,vectors=1:5,before=FALSE, legend=TRUE,getsignals=TRUE)

[Package dbcsp version 0.0.2.1 Index]