lsp: Lomb-Scargle Periodogram

lspR Documentation

Lomb-Scargle Periodogram


Computes the Lomb-Scargle periodogram for a time series with irregular (or regular) sampling intervals. Allows selecting a frequency range to be inspected, as well as the spacing of frequencies scanned.


lsp(x, times = NULL, from = NULL, to = NULL, type = c("frequency", "period"),
    ofac = 1, alpha = 0.01, normalize=c("standard","press"), plot = TRUE, ...)



The data to be analysed. x can be either a two-column numerical dataframe or matrix, with sampling times in column 1 and measurements in column 2, a single numerical vector containing measurements, or a single vector ts object (which will be converted to a numerical vector).


If x is a single vector, times can be provided as a numerical vector of equal length containing sampling times. If x is a vector and times is NULL, the data are assumed to be equally sampled and times is set to 1:length(x).


The starting frequency (or period, depending on type) to begin scanning for periodic components.


The highest frequency (or period, depending on type) to scan.


Either “frequency” (the default) or “period”. Determines the type of the periodogram x-axis.


The oversampling factor. Must be an integer>=1. Larger values of ofac lead to finer scanning of frequencies but may be time-consuming for large datasets and/or large frequency ranges (


The significance level. The periodogram plot shows a horizontal dashed line. Periodogram peaks exceeding this line can be considered significant at alpha. Defaults to 0.01. Only used if plot=TRUE.


The type of normalization used, either “standard” or “press”. If normalization is standard (the default) the periodogram is confined to the interval 0-1, and the statistical significance of the largest peak in the periodogram is computed according to Baluev (2008).if normalization is set to “press” the periodogram will be normalized using the factor 1/(2 * var(y)) and the p-value for the significance of the largest peak in the periodogram is computed from the exponential distribution, as outlined in Press et al. (1994), see below


Logical. If plot=TRUE the periodogram is plotted.


Further graphical parameters affecting the periodogram plot.


For a more robust - but potentially time-consuming estimation of p-values (when n is large) see randlsp.

Significance levels in both lsp and randlsp increase with the number of frequencies inspected. Therefore, if the frequency-range of interest can be narrowed down a priori, use arguments “from” and “to” to do so.


A named list with the following components:


The type of normalization used.


A vector containing the frequencies/periods scanned.


A vector containing the normalised power corresponding to scanned frequencies/periods.


Names of the data vectors analysed.


The length of the data vector.


The periodogram type used, either "frequency" or "period".


The oversampling factor used.


The length of the output (powers). This can be >n if ofac >1.


The false alarm probability used.


Powers > sig.level can be considered significant peaks at p=alpha.


The maximum power in the frequency/period interval inspected.

The frequency/period at which the maximum peak occurred.


The probability that the maximum peak occurred by chance.


For a description of the properties of the Lomb-Scargle Periodogram, its computation and comparison with other methods see Ruf, T. (1999). Function lsp uses the algorithm given by Press et al (1994). The Lomb-Scargle Periodogram was originally proposed by Lomb N.R. (1976) and further extended by Scargle J.D. (1982). An improved method for assessing the statistical significance of candidate periodicities by Baluev (2008), based on extreme value theory, is also implemented. This implementation uses code modified from the astropy.timeseries Python package (VanderPlas et al. 2012, 2015).


Thomas Ruf based on code by Press et al (1994).


Baluev, R. V. (2008). Assessing the statistical significance of periodogram peaks. Monthly Notices of the Royal Astronomical Society, 385(3), 1279-1285.

Lomb N.R. (1976) Least-squares frequency analysis of unequally spaced data. Astrophysics and Space Science 39:447–462

Press W.H., Teukolsky S.A., Vetterling S.T., Flannery, B.P. (1994) Numerical recipes in C: the art of scientific computing.2nd edition. Cambridge University Press, Cambridge, 994pp.

Ruf, T. (1999) The Lomb-Scargle Periodogram in Biological Rhythm Research: Analysis of Incomplete and Unequally Spaced Time-Series. Biological Rhythm Research 30: 178–201.

Scargle J.D. (1982) Studies in astronomical time series. II. Statistical aspects of spectral analysis of unevenly spaced data. The Astrophysical Journal 302: 757–763.

VanderPlas, J., Connolly, A. Ivezic, Z. & Gray, A. (2012) Introduction to astroML: Machine learning for astrophysics. Proceedings of the Conference on Intelligent Data Understanding

VanderPlas, J. & Ivezic, Z. (2015) Periodograms for Multiband Astronomical Time Series.The Astrophysical Jounal 812.1:18

See Also

randlsp summary.lsp


# ibex contains an unevenly sampled time series

# lynx contains evenly sampled data
lynx.spec <- lsp(lynx,type='period',from=2,to=20,ofac=5)

# generate unevenly sampled data
lsp(y,times=time,ofac=10, to=0.3)

lomb documentation built on May 29, 2024, 3:37 a.m.