rm_baseline: Baseline correction

View source: R/baseline_correction.R

rm_baselineR Documentation

Baseline correction

Description

Used to correct data using the mean of a specified time period. For time-domain data, this will subtract the mean from all data. For eeg_tfr objects, a variety of methods are available, including subtraction, and conversion to "dB" change. With a data frame, it will search for "electrode" and "epoch" columns, and groups on these when found. An electrode column is always required; an epoch column is not. Note that baseline correction is always applied on single-trial basis. For baseline correction based on subtraction, this makes no difference compared to averaging first and then baseline correcting, but for divisive measures used with time-frequency data, this distinction can be very important, and can lead to counterintuitive results.

Usage

rm_baseline(data, time_lim = NULL, ...)

## S3 method for class 'eeg_data'
rm_baseline(data, time_lim = NULL, verbose = TRUE, ...)

## S3 method for class 'eeg_epochs'
rm_baseline(data, time_lim = NULL, verbose = TRUE, ...)

## S3 method for class 'data.frame'
rm_baseline(data, time_lim = NULL, verbose = TRUE, ...)

## S3 method for class 'eeg_tfr'
rm_baseline(data, time_lim = NULL, type = "divide", verbose = TRUE, ...)

## S3 method for class 'eeg_evoked'
rm_baseline(data, time_lim = NULL, verbose = TRUE, ...)

Arguments

data

Data to be baseline corrected.

time_lim

Numeric character vector (e.g. time_lim <- c(-.1, 0)) defining the time period to use as a baseline. If the value is NULL, it uses the mean of the whole of each epoch if the data is epoched, or the channel mean if the data is continuous.

...

other parameters to be passed to functions

verbose

Defaults to TRUE. Output descriptive messages to console.

type

Type of baseline correction to apply. Options are ("divide", "ratio", "absolute", "db", and "pc")

Value

An eegUtils object or a data.frame, depending on the input.

Methods (by class)

  • eeg_data: remove baseline from continuous eeg_data

  • eeg_epochs: Remove baseline from eeg_epochs

  • data.frame: Legacy method for data.frames

  • eeg_tfr: Method for eeg_tfr objects

  • eeg_evoked: Method for eeg_evoked objects

Author(s)

Matt Craddock matt@mattcraddock.com

Examples

rm_baseline(demo_epochs)
rm_baseline(demo_epochs, c(-.1, 0))

neuroconductor/eegUtils documentation built on Feb. 3, 2023, 5:33 p.m.