plot.dbcsp: Plot function implemented by dbcsp class

Description Usage Arguments Details Value See Also Examples

Description

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

Usage

1
2
3
## S3 method for class 'dbcsp'
plot(x, class = 1, index = 1, vectors = 1:(x@q*2), pairs=TRUE,
     before = TRUE, after = TRUE, legend = 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.

...

optional arguments inherited from the generic plot 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.

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.

See Also

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

Examples

1
2
3
4
5
6
# 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)

dbcsp documentation built on July 9, 2021, 9:08 a.m.