| m_dist | R Documentation |
This function is used to calculate the Mahalanobis distance for a multivariate time series.
m_dist(
data,
sampling_rate = 1,
smooth_dur = 0,
overlap = 0,
consec = FALSE,
cum_sum = FALSE,
bl_start = 0,
bl_end = floor(nrow(data)/sampling_rate),
bl_cov = FALSE
)
data |
A data frame or matrix with one row for each time point. Note that the Mahalanobis distance calculation should be carried out on continuous data only, so if your data contain logical, factor or character data, proceed at your own risk...errors (or at least meaningless results) will probably ensue. |
sampling_rate |
The sampling rate in Hz (data should be regularly sampled). If not specified it will be assumed to be 1 Hz. |
smooth_dur |
The length, in minutes, of the window to use for calculation of "comparison" values. If not specified or zero (the default), there will be no smoothing (a distance will be calculated for each data observation). |
overlap |
The amount of overlap, in minutes, between consecutive "comparison" windows. |
consec |
Logical (default FALSE). If |
cum_sum |
Logical (default FALSE). If |
bl_start |
Start time (in seconds since start of the data set) of the baseline period. The mean data values for this period will be used as the 'control' to which all "comparison" data points (or windows) will be compared. If not specified, it will be assumed to be 0 (start of record). If |
bl_end |
End time (in seconds since start of the data set) of the baseline period. If not specified, the entire data set will be used (baseline_end will be the last sampled time-point in the data set). If consec = TRUE, then adjacent windows will be compared, and this input will have no effect except to define the data used to compute the covariance matrix, if |
bl_cov |
Logical. If bl_cov is TRUE, then a covariance matrix using all data *in the baseline period* will be used for calculating the Mahalanobis distance. Default is bl_cov = FALSE, which uses *all* data (in the entire dataset) to compute the covariance matrix. |
Data frame containing results: variable seconds is times (in seconds since start of dataset) at which Mahalanobis distances are reported. If a smooth_dur window was applied, then the reported times will be the midpoint of each "comparison" window. Variable dist contains the computed Mahalanobis distances.
BW <- beaked_whale
m_dist_result <- m_dist(BW$A$data, BW$A$sampling_rate)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.