eaemg {biosignalEMG}R Documentation

Ensemble-averaged EMG


Creates an ensemble-averaged EMG associated with a cyclical activity.


eaemg(data, channel, runs, what, timenormalization = c("min", "mean", "median", "max"),
   scalem = 1, empirical = TRUE, level = 0.9)

## S3 method for class 'eaemg'
plot(x, ci.lty ="dashed", ...)
## S3 method for class 'eaemg'
print(x, ...)
## S3 method for class 'eaemg'
summary(object, ...)



an ‘emg’ object, usually rectified, moving-average of a rectified EMG or the computed envelope of an EMG.


in case of multi-channel data, channel is the specific channel to be considered by the procedure. Possible values: a character vector specifying the name of the channel to be considered (case sensitive) or a numeric value specifying the channel to be considered (number of column in data).


an ‘rle’ object indicating the lengths of succesive phases (active and inactive) or an atomic vector indicating in each position if the signal corresponds to a silence phase (0) or an active phase (1 or a greater integer).


which phases are going to be ensemble-averaged, active phases (1) or silence phases (0).


a string that indicates with respect to which value all phase durations should be normalized. It can be the “min” (default), “mean”, “median” or “max” duration of the phases.


a value (>=1) that controls the local detail of the ensemble.


logical; if TRUE (default), the confidence intervals are computed based on the empirical quantiles; if FALSE, confidence intervals are computed asumming a Gaussian distribution.


a value in [0,1] indicating the confidence level.

x, object

an ‘eaemg’ object.


line type to plot the confidence intervals.


additional arguments to be passed to the generic function.


Ensemble-Averaged EMG is usually applied to EMG signals associated with cyclical activities. In Ensemble-Averaged EMG the time base for each cycle is normalized and all the profiles are averaged. To successfully obtain the average profile, the data should be a rectified EMG, the moving average of a rectified EMG or the envelope of an EMG signal.

The runs argument can be computed througth the rle function of a thresholded envelope (see Examples) or computed with an onset/offset detection algorithm (see onoff_singlethres and onoff_bonato).


returns an object of class ‘eaemg’ which is a list with components:


a matrix with three columns, each corresponding to the lower limit of the interval, the ensemble average and the upper limit of the interval.


the empirical argument


the level argument


J.A. Guerrero jaguerrero@correo.uaa.mx


Kumar S., Mital A. (1996) Electromyography In Ergonomics Taylor & Francis.

Esquivel M.E., Guerrero J.A., Macias-Diaz J.E. (2010) Activity pattern detection in electroneurographic and electromyogram signals through a heteroscedastic change-point method. Mathematical Biosciences 224(2) 109–117

See Also

rectification, movingaverage, envelope, onoff_singlethres, onoff_bonato


# change graphical parameters to show multiple plots
op <- par(mfrow = c(2, 1))

# Simulate 10 seconds of an EMG
emgx <- syntheticemg(n.length.out = 10000, on.sd = 1, on.duration.mean = 350, 
    on.duration.sd = 10, off.sd = 0.05, off.duration.mean = 300, off.duration.sd = 20, 
    on.mode.pos = 0.75, shape.factor = 0.5, samplingrate = 1000, units = "mV", 
    data.name = "Synthetic EMG")
# MA-envelope
emgma <- envelope(emgx, method = "MA", wsize = 60)
# Ensemble-averaged EMG
ea1 <- eaemg(emgma, runs = rle(emgx$on.off), what = 1, timenormalization = "max", 
    scalem = 1, empirical = TRUE, level = 0.9)
plot(ea1, lwd = 2, main = "Ensemble-averaged EMG using apriori onset/offset")

# Determine the onset/offset runs using a thresholded envelope
empiricalonoff <- onoff_singlethres(emgx, t = 0.05)
ea2 <- eaemg(emgma, runs = empiricalonoff, what = 1, timenormalization = "max", 
    scalem = 1, empirical = TRUE, level = 0.9)
plot(ea2, lwd = 2, main = "Ensemble-averaged EMG using empirical onset/offset")

# reset graphical parameters

[Package biosignalEMG version 2.1.0 Index]