Plots Single-Channel EEG Time Course

Share:

Description

Creates plot of single-channel electroencephalography (EEG) time course with optional confidence interval. User can control the plot orientation, line types, line colors, etc.

Usage

1
2
3
4
eegtime(time,voltage,flipvoltage=TRUE,vlty=1,vlwd=2,vcol="blue",
        voltageSE=NULL,slty=NA,slwd=1,scol="cyan",salpha=0.65,conflevel=0.95,
        plotzero=TRUE,zlty=1,zlwd=0.5,zcol="black",xlim=NULL,ylim=NULL,
        xlab=NULL,ylab=NULL,nxtick=6,nytick=6,add=FALSE,...)

Arguments

time

Vector of time points at which EEG was recorded.

voltage

Vector of recorded EEG voltage at each point in time.

flipvoltage

If TRUE, negative voltages are plotted upwards.

vlty

Line type for voltage.

vlwd

Line width for voltage.

vcol

Line color for voltage.

voltageSE

Vector of standard errors of EEG voltage at each point in time.

slty

Line type for voltageSE. If slty=NA (default) shaded polygons are plotted.

slwd

Line width for voltageSE. Ignored if slty=NA.

scol

Polygon or line color for voltageSE.

salpha

Transparency value for voltageSE polygon (only used if slty=NA).

conflevel

Confidence level to use for confidence intervals. Default forms 95% CI.

plotzero

If TRUE, horizontal reference line is plotted at 0 volts.

zlty

Line type for reference line. Ignored if plotzero=FALSE.

zlwd

Line width for reference line. Ignored if plotzero=FALSE.

zcol

Line color for reference line. Ignored if plotzero=FALSE.

xlim

Plot limits for time.

ylim

Plot limits for voltage.

xlab

Plot label for time.

ylab

Plot label for voltage.

nxtick

Approximate number of axis ticks for time.

nytick

Approximate number of axis ticks voltage.

add

If TRUE, lines are added to current plot; otherwise a new plot is created.

...

Optional inputs for plot or lines function.

Value

Produces plot of EEG time course with NULL return value.

Note

Confidence intervals are formed using the normal (Gaussian) distribution.

Author(s)

Nathaniel E. Helwig <helwig@umn.edu>

References

Bache, K. & Lichman, M. (2013). UCI Machine Learning Repository [http://archive.ics.uci.edu/ml]. Irvine, CA: University of California, School of Information and Computer Science.

Begleiter, H. Neurodynamics Laboratory. State University of New York Health Center at Brooklyn. http://www.downstate.edu/hbnl/

Ingber, L. (1997). Statistical mechanics of neocortical interactions: Canonical momenta indicatros of electroencephalography. Physical Review E, 55, 4578-4593.

Ingber, L. (1998). Statistical mechanics of neocortical interactions: Training and testing canonical momenta indicators of EEG. Mathematical Computer Modelling, 27, 33-64.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
##########   EXAMPLE   ##########

# get "PZ" electrode from "eegdata" data
data(eegdata)
idx <- which(eegdata$channel=="PZ")
eegdata <- eegdata[idx,]

# get average and standard error (note se=sd/sqrt(n))
eegmean <- tapply(eegdata$voltage,list(eegdata$time,eegdata$group),mean)
eegse <- tapply(eegdata$voltage,list(eegdata$time,eegdata$group),sd)/sqrt(50) 

# plot results with legend
tseq <- seq(0,1000,length.out=256)
eegtime(tseq,eegmean[,2],voltageSE=eegse[,2],ylim=c(-10,6),main="Pz")
eegtime(tseq,eegmean[,1],vlty=2,vcol="red",voltageSE=eegse[,1],scol="pink",add=TRUE)
legend("bottomright",c("controls","alcoholics"),lty=c(1,2),
       lwd=c(2,2),col=c("blue","red"),bty="n")