Learn R Programming

psdr

Overview

Author: Yong-Han Hank Cheng

This package allows you to generate and compare power spectral density (PSD) plots given time series data. Fast Fourier Transform (FFT) is used to take a time series data, analyze the oscillations, and then output the frequencies of these oscillations in the time series in the form of a PSD plot.

Thus given a time series, the dominant frequencies in the time series can be identified. Additional functions in this package allow the dominant frequencies of multiple groups of time series to be compared with each other.

To see example usage with the main functions of this package, please visit this site: https://yhhc2.github.io/psdr/articles/Introduction.html

The mathematical operations used to generate the PSDs are described here:

“Fft.” Fast Fourier transform - MATLAB. Accessed May 25, 2021. https://www.mathworks.com/help/matlab/ref/fft.html.

“Signal Analyzer.” MATLAB & Simulink. Accessed May 25, 2021. https://www.mathworks.com/help/signal/ug/power-spectral-density-estimates-using-fft.html.

Installation

# Install the package from GitHub
devtools::install_github("yhhc2/psdr")
# Load package
library("psdr")

Usage

Source code: https://github.com/yhhc2/psdr

Visit the package’s website: https://yhhc2.github.io/psdr/

Visit this vignette for example usage: https://yhhc2.github.io/psdr/articles/Introduction.html

Visit this vignette for example output for each function usage: https://yhhc2.github.io/psdr/articles/Examples.html

License

The psdr package is licensed under the GPL (>=3) license. The logo is licensed under the CC BY 4.0 license.

Thanks

This package was developed in part during my time at the NIH as a postbac researcher. Acknowledgements to:

  • Kory Johnson and Yang Fann at the NINDS Bioinformatics Section for mentorship.

  • Jonathan Pomeraniec at the NIH Clinical Center for providing datasets to validate usage of package.

  • John Kakareka and Randy Pursley at the NIH CIT, Signal Processing and Instrumentation Section for guidance on signal processing.

  • Tianxia Wu at the NINDS Clinical Trials Unit for guidance on statistical testing.

  • NIH Undergraduate Scholarship Program and the NINDS Section of Infections of the Nervous System for supporting postbac.

Copy Link

Version

Install

install.packages('psdr')

Monthly Downloads

334

Version

1.0.1

License

GPL (>= 3) | file LICENSE

Maintainer

Yong-Han Hank Cheng

Last Published

June 4th, 2021

Functions in psdr (1.0.1)

MakeCompositeXYPlotForAllWindows

Find averaged xy plots
MakeCompositePSDForAllWindows

Make PSD for each window (dataframe) in a list and then find the average of all the PSDs
SingleBinPSDIntegrationOrDominantFreqComparison

Given sets of windows (dataframes) corresponding to different combos, see if the integration or dominant frequency of a specific frequency range is significantly different between the combos
MakePowerSpectralDensity

Create a power spectral density (PSD) plot using time series data
MakeOneSidedAmplitudeSpectrum

Create a one sided amplitude spectrum using time series data
GetHomogeneousWindows

Get windows (dataframes) that have the same specified column values for all observations
GetSubsetOfWindows

Select only windows (dataframes) where a specified column matches a specified value
GetSubsetOfWindowsTwoLevels

Select only windows (dataframes) where a two specified columns must match specified values
CountWindows

Create a contingency table to display how many windows (dataframes) fall into particular categories
AutomatedCompositePlotting

Automated plotting of time series, PSD, and log transformed PSD
IdentifyMaxOnXY

Given a xy plot. Find the maximum value on the plot
SingleBinPSDIntegrationForMultipleWindows

Calculate integral for multiple PSDs for a single frequency bin
PSDIntegrationPerFreqBin

Given a time series vector, generate a PSD, then calculate integration for specified bins
FindHomogeneousWindows

Assess if window (dataframe) share certain features across all observations
GenerateExampleData

Produce example data set for demonstrating package functions
PSDIdentifyDominantFrequency

Given a time series vector, create a PSD and find the dominant frequency
PSDDominantFrequencyForMultipleWindows

Calculate dominant frequency for multiple PSDs for a single frequency range