periodogram is a wrapper function for spectrum
with some special options set. It
returns the power spectral density, i.e. the
squared modulus of the Fourier coefficient divided by the length
of the series, for multiple time series as well as the corresponding
Fourier frequencies. The frequencies range between
0 and the Nyquist critical frequency fc = frequency(x)/2.
periodogram is used by the functions
avgp and fisher.g.test.
For general periodogram functions
please refer to spectrum.
Usage
periodogram(x, method = "builtin")
Arguments
x
vector or matrix containing the time series data
(one time series per column)
method
a string that specifies which method should be used to
compute the spectral density: "builtin" employs the function
spectrum with the options
taper=0, plot=FALSE, fast=FALSE, detrend=FALSE, and demean=TRUE;
"clone" employs directly the Fourier transform function fft
(with sames results as "builtin"); and "smooth" uses the
function spectrum with options as above plus span=3.
Value
A list object with the following components:
spec
A vector or matrix with the estimated power spectral densities
(one column per time series).
freq
A vector with frequencies f ranging from 0 to fc
(if the sampling rate frequency(x)) equals 1 then fc = 0.5).
Angular frequencies may be obtained by multiplication with 2*pi
(i.e. omega = 2*pi*f).
# load GeneCycle library
library("GeneCycle")
# load data set
data(caulobacter)
# how many genes and how many samples?
dim(caulobacter)
# periodograms of the first 10 genes
periodogram(caulobacter[,1:10])
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(GeneCycle)
Loading required package: MASS
Loading required package: longitudinal
Loading required package: corpcor
Loading required package: fdrtool
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/GeneCycle/periodogram.Rd_%03d_medium.png", width=480, height=480)
> ### Name: periodogram
> ### Title: Periodogram Power Spectral Density
> ### Aliases: periodogram
> ### Keywords: ts
>
> ### ** Examples
>
> # load GeneCycle library
> library("GeneCycle")
>
> # load data set
> data(caulobacter)
>
> # how many genes and how many samples?
> dim(caulobacter)
[1] 11 1444
>
> # periodograms of the first 10 genes
> periodogram(caulobacter[,1:10])
$spec
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 0.44284739 1.130357356 1.068349960 1.419206295 2.27775109 1.639187395
[2,] 0.17385272 0.115400249 0.104251846 0.130276223 0.20037570 0.274096460
[3,] 0.29355408 0.003969141 0.001325152 0.002410588 0.09710114 0.052439716
[4,] 0.23226646 0.005259707 0.001714942 0.006475784 0.09488164 0.001921288
[5,] 0.01466026 0.010919571 0.003348493 0.002697767 0.06143642 0.006730472
[,7] [,8] [,9] [,10]
[1,] 0.0023735707 2.019760704 0.075547591 0.9021377
[2,] 0.0078230143 0.134738578 0.018713563 0.5507906
[3,] 0.0199583163 0.017368141 0.029188321 0.2945531
[4,] 0.2256001470 0.003061959 0.002084201 0.3577172
[5,] 0.0005818419 0.014593731 0.029949666 0.2678070
$freq
[1] 0.09090909 0.18181818 0.27272727 0.36363636 0.45454545
>
>
>
>
>
> dev.off()
null device
1
>