{"id":29433992,"url":"https://github.com/abarbour/psd","last_synced_at":"2025-07-13T02:01:53.982Z","repository":{"id":2215561,"uuid":"3165044","full_name":"abarbour/psd","owner":"abarbour","description":"Adaptive, sine-multitaper power spectral density estimation in R","archived":false,"fork":false,"pushed_at":"2025-04-25T18:26:34.000Z","size":124171,"stargazers_count":9,"open_issues_count":2,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-09T11:27:39.054Z","etag":null,"topics":["multitaper","power-spectral-density","power-spectrum","psd","r","spectral-density-estimates","spectrum"],"latest_commit_sha":null,"homepage":"https://cran.r-project.org/package=psd","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abarbour.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2012-01-12T19:35:20.000Z","updated_at":"2025-04-25T18:26:38.000Z","dependencies_parsed_at":"2023-10-20T16:13:16.896Z","dependency_job_id":null,"html_url":"https://github.com/abarbour/psd","commit_stats":{"total_commits":421,"total_committers":4,"mean_commits":105.25,"dds":0.517814726840855,"last_synced_commit":"c65fce54b2c705d047a6b873504e755d6250360c"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/abarbour/psd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abarbour%2Fpsd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abarbour%2Fpsd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abarbour%2Fpsd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abarbour%2Fpsd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abarbour","download_url":"https://codeload.github.com/abarbour/psd/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abarbour%2Fpsd/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264946029,"owners_count":23687086,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["multitaper","power-spectral-density","power-spectrum","psd","r","spectral-density-estimates","spectrum"],"created_at":"2025-07-13T02:00:52.616Z","updated_at":"2025-07-13T02:01:53.938Z","avatar_url":"https://github.com/abarbour.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# psd \n\nAdaptive, sine multitaper power spectral density estimation for R\n\nby Andrew J Barbour, Jonathan Kennel, and Robert L Parker\n\n\u003c!--\n[![Travis Build Status](https://travis-ci.org/abarbour/psd.svg?branch=master)](https://travis-ci.org/abarbour/psd) \n[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/abarbour/psd?branch=master\u0026svg=true)](https://ci.appveyor.com/project/abarbour/psd) \n--\u003e\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/abarbour/psd/workflows/R-CMD-check/badge.svg)](https://github.com/abarbour/psd/actions) \n[![](https://www.r-pkg.org/badges/version-last-release/psd?color=green)](https://cran.r-project.org/package=psd) \n[![Code Coverage](https://codecov.io/github/abarbour/psd/coverage.svg?branch=master)](https://app.codecov.io/github/abarbour/psd?branch=master) \n[![Downloads](https://cranlogs.r-pkg.org/badges/psd)](https://www.r-pkg.org/pkg/psd) \n[![License](https://img.shields.io/badge/license-GPL-lightgrey.svg)](https://www.gnu.org/licenses/gpl-2.0.html) \n[![Citation](https://img.shields.io/badge/published-CAGEO-red.svg)](https://doi.org/10.1016/j.cageo.2013.09.015)\n\u003c!-- badges: end --\u003e\n\n### **_Latest News_**\n\n_As of version 2.0, one can calculate the multivariate PSD (\"cross spectra\") between two signals._\n\n## Description\n\nThis is an [R](https://www.r-project.org)\npackage for computing univariate power spectral density\nestimates with little or no tuning effort.\nWe employ sine multitapers, allowing the number to vary with frequency\nin order to reduce mean square error, the sum of squared bias and\nvariance, at each point.  The approximate criterion of\n[Riedel and Sidorenko (1995)](https://doi.org/10.1109/78.365298)\nis modified to prevent runaway averaging that otherwise occurs when\nthe curvature of the spectrum goes to zero.  An iterative procedure\nrefines the number of tapers employed at each frequency.  The resultant\npower spectra possess significantly lower variances \nthan those of traditional, non-adaptive estimators.  The sine tapers also provide\nuseful spectral leakage suppression.  Resolution and uncertainty can\nbe estimated from the number of degrees of freedom (twice the number\nof tapers).\n\nThis technique is particularly suited to long time series, because\nit demands only one numerical Fourier transform, and requires no\ncostly additional computation of taper functions, like the Slepian\nfunctions.  It also avoids the degradation of the low-frequency\nperformance associated with record segmentation \nin Welch's method.\nAbove all, the adaptive process relieves the user of the need to set\na tuning parameter, such as time-bandwidth product or segment length,\nthat fixes frequency resolution for the entire frequency interval; instead\nit provides frequency-dependent spectral resolution tailored to the\nshape of the spectrum itself.\n\n`psd` elegantly handles\nspectra with large dynamic range and mixed-bandwidth features|features\ntypically found in geophysical datasets.  \n\n## How to Cite\n\nBob and Andy have a [paper in Computers \u0026 Geosciences][1]\nto accompany this software [(download a pdf, 1MB)][pdf]; it describes the theory behind\nthe estimation process, and how we apply it in practice.\nIf you find `psd` useful in your research, we kindly request\nyou cite our paper. See also:\n\n    citation(\"psd\")\n\n## Getting Started\n\nYou can to install the package and it's dependencies\nwith [CRAN](https://cran.r-project.org/package=psd)\n(from within the `R` environment):\n\n    install.packages(\"psd\")\n\nthen load the package library\n\n    library(psd)\n\nWe have included a dataset to play with, namely `Tohoku`, which represents\nrecordings of high-frequency borehole strainmeter data during\nteleseismic waves from the 2011 Mw 9.0 Tohoku \nearthquake ([original data source](https://goo.gl/Gx7Ww)).\nAccess and inspect these data with:\n\n    data(Tohoku)\n    print(str(Tohoku))\n\nThe 'preseismic' data has interesting spectral features, so we\nsubset it, and analyze the areal strain (the change in borehole\ndiameter):\n\n    Dat \u003c- subset(Tohoku, epoch==\"preseismic\")\n    Areal \u003c- ts(Dat$areal)\n\nFor the purposes of improving the accuracy of the spectrum, we remove a linear trend:\n\n    Dat \u003c- prewhiten(Areal, plot=FALSE)\n\nNow we can calculate the adaptive PSD:\n\n    mtpsd \u003c- pspectrum(Dat[['prew_lm']], plot=TRUE)\n    print(class(mtpsd))\n\nIn the previous example the `plot=TRUE` flag produces a comparison with a basic periodogram, but\nwe can also visualize the spectrum with builtin plotting methods:\n\n    plot(mtpsd, log=\"dB\")\n\nThe spectral uncertainty can be easily calculated:\n\n    sprop \u003c- spectral_properties(mtpsd)\n    with(sprop, {\n        plot(taper/max(taper), type=\"h\", ylim=c(0,2), col=\"dark grey\") \n        lines(stderr.chi.lower)\n        lines(stderr.chi.upper)\n    })\n\n### Installing the Development Version\n\nShould you wish to install the development version\nof this software, the [remotes][2] library\nwill be useful:\n\n    library(remotes)\n    remotes::install_github(\"abarbour/psd\")\n\n[1]: https://doi.org/10.1016/j.cageo.2013.09.015\n[2]: https://cran.r-project.org/package=remotes\n[pdf]: https://github.com/abarbour/psd/raw/master/paper/2014.barbour_parker.official.CAGEO3272.pdf\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabarbour%2Fpsd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabarbour%2Fpsd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabarbour%2Fpsd/lists"}