pgram: Periodogram computation

Description Usage Arguments Details Value Author(s) Examples

Description

The periodogram is computed.

Usage

1
pgram(z, fr = "default", method = c("periodogram", "regression"))

Arguments

z

time series vector of length n, say.

fr

use "default" for usual Fourier frequencies, 1/n, ..., floor(n/2)/n. Set fr = N, to evaluate the periodogram at the Fourier frequencies corresponding to a time series of length N. Finally set fr to any desired set of frequencies. Note frequencies are in cycles per unit time sometimes called temoral frequency to distinguish from angular frequency. Both are widely used in time series.

method

either periodogram or regression

Details

Uses FFT. So if the length of z is a highly composite number, the computation is very efficient. Otherwise the usual DFT is used.

Value

Periodogram evaluated at the Fourier frequencies or R-square.

Author(s)

A.I. McLeod and Yuanhao Lai

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
z<-sunspot.year
n<-length(z) 
I<-pgram(z)
f<-I[,1]
I <- I[,2]
plot(f, I, xlab="f", ylab="f", type="l") 
title(main="Periodogram for Annual Sunpots, 1700-1988") 
#
z<-c(0.42, 0.89, 1.44, 1.98, 2.21, 2.04, 0.82, 0.62, 0.56, 0.8, 1.33)
fr <- (1:50)/101
pgram(z)
pgram(z, fr=101)
pgram(z, fr=fr)
pgram(z, method="regression")
pgram(z, method="regression", fr=101)
pgram(z, method="regression", fr=fr)
  
                                                        

Example output

Periodicity tests in short time series
      frequency periodogram
[1,] 0.09090909  1.26259378
[2,] 0.18181818  0.61950511
[3,] 0.27272727  0.02257858
[4,] 0.36363636  0.11744806
[5,] 0.45454545  0.05925629
       frequency periodogram
 [1,] 0.00990099 15.16173539
 [2,] 0.01980198 13.84466929
 [3,] 0.02970297 11.87397218
 [4,] 0.03960396  9.53633122
 [5,] 0.04950495  7.14613879
 [6,] 0.05940594  4.98494653
 [7,] 0.06930693  3.25305630
 [8,] 0.07920792  2.04348498
 [9,] 0.08910891  1.34216510
[10,] 0.09900990  1.05130241
[11,] 0.10891089  1.02727582
[12,] 0.11881188  1.12177376
[13,] 0.12871287  1.21552155
[14,] 0.13861386  1.23745182
[15,] 0.14851485  1.16719807
[16,] 0.15841584  1.02371483
[17,] 0.16831683  0.84621320
[18,] 0.17821782  0.67464064
[19,] 0.18811881  0.53563952
[20,] 0.19801980  0.43702651
[21,] 0.20792079  0.37049643
[22,] 0.21782178  0.31960968
[23,] 0.22772277  0.26893429
[24,] 0.23762376  0.21065052
[25,] 0.24752475  0.14658243
[26,] 0.25742574  0.08572500
[27,] 0.26732673  0.03906219
[28,] 0.27722772  0.01424416
[29,] 0.28712871  0.01235753
[30,] 0.29702970  0.02785957
[31,] 0.30693069  0.05131270
[32,] 0.31683168  0.07344388
[33,] 0.32673267  0.08866935
[34,] 0.33663366  0.09664351
[35,] 0.34653465  0.10136193
[36,] 0.35643564  0.10842641
[37,] 0.36633663  0.12181271
[38,] 0.37623762  0.14159582
[39,] 0.38613861  0.16358166
[40,] 0.39603960  0.18092180
[41,] 0.40594059  0.18693452
[42,] 0.41584158  0.17787882
[43,] 0.42574257  0.15450442
[44,] 0.43564356  0.12177138
[45,] 0.44554455  0.08693272
[46,] 0.45544554  0.05685444
[47,] 0.46534653  0.03572682
[48,] 0.47524752  0.02409515
[49,] 0.48514851  0.01952321
[50,] 0.49504950  0.01847450
       frequency periodogram
 [1,] 0.00990099 15.16173539
 [2,] 0.01980198 13.84466929
 [3,] 0.02970297 11.87397218
 [4,] 0.03960396  9.53633122
 [5,] 0.04950495  7.14613879
 [6,] 0.05940594  4.98494653
 [7,] 0.06930693  3.25305630
 [8,] 0.07920792  2.04348498
 [9,] 0.08910891  1.34216510
[10,] 0.09900990  1.05130241
[11,] 0.10891089  1.02727582
[12,] 0.11881188  1.12177376
[13,] 0.12871287  1.21552155
[14,] 0.13861386  1.23745182
[15,] 0.14851485  1.16719807
[16,] 0.15841584  1.02371483
[17,] 0.16831683  0.84621320
[18,] 0.17821782  0.67464064
[19,] 0.18811881  0.53563952
[20,] 0.19801980  0.43702651
[21,] 0.20792079  0.37049643
[22,] 0.21782178  0.31960968
[23,] 0.22772277  0.26893429
[24,] 0.23762376  0.21065052
[25,] 0.24752475  0.14658243
[26,] 0.25742574  0.08572500
[27,] 0.26732673  0.03906219
[28,] 0.27722772  0.01424416
[29,] 0.28712871  0.01235753
[30,] 0.29702970  0.02785957
[31,] 0.30693069  0.05131270
[32,] 0.31683168  0.07344388
[33,] 0.32673267  0.08866935
[34,] 0.33663366  0.09664351
[35,] 0.34653465  0.10136193
[36,] 0.35643564  0.10842641
[37,] 0.36633663  0.12181271
[38,] 0.37623762  0.14159582
[39,] 0.38613861  0.16358166
[40,] 0.39603960  0.18092180
[41,] 0.40594059  0.18693452
[42,] 0.41584158  0.17787882
[43,] 0.42574257  0.15450442
[44,] 0.43564356  0.12177138
[45,] 0.44554455  0.08693272
[46,] 0.45544554  0.05685444
[47,] 0.46534653  0.03572682
[48,] 0.47524752  0.02409515
[49,] 0.48514851  0.01952321
[50,] 0.49504950  0.01847450
      frequency        RSq
[1,] 0.09090909 0.60661325
[2,] 0.18181818 0.29764126
[3,] 0.27272727 0.01084788
[4,] 0.36363636 0.05642792
[5,] 0.45454545 0.02846969
       frequency         RSq
 [1,] 0.00990099 0.249332566
 [2,] 0.01980198 0.254063913
 [3,] 0.02970297 0.262781562
 [4,] 0.03960396 0.276952390
 [5,] 0.04950495 0.299119097
 [6,] 0.05940594 0.333475327
 [7,] 0.06930693 0.386527536
 [8,] 0.07920792 0.466991696
 [9,] 0.08910891 0.582064897
[10,] 0.09900990 0.725411894
[11,] 0.10891089 0.862220732
[12,] 0.11881188 0.941848253
[13,] 0.12871287 0.940203653
[14,] 0.13861386 0.868539036
[15,] 0.14851485 0.749289764
[16,] 0.15841584 0.607375465
[17,] 0.16831683 0.466816760
[18,] 0.17821782 0.340033644
[19,] 0.18811881 0.227968369
[20,] 0.19801980 0.131989238
[21,] 0.20792079 0.059928153
[22,] 0.21782178 0.018114163
[23,] 0.22772277 0.002367339
[24,] 0.23762376 0.001467246
[25,] 0.24752475 0.005515096
[26,] 0.25742574 0.009266680
[27,] 0.26732673 0.010906785
[28,] 0.27722772 0.010445295
[29,] 0.28712871 0.009720380
[30,] 0.29702970 0.012282687
[31,] 0.30693069 0.020823608
[32,] 0.31683168 0.034212905
[33,] 0.32673267 0.048190474
[34,] 0.33663366 0.058416887
[35,] 0.34653465 0.062679110
[36,] 0.35643564 0.061029051
[37,] 0.36633663 0.053960429
[38,] 0.37623762 0.041458566
[39,] 0.38613861 0.025142444
[40,] 0.39603960 0.010326387
[41,] 0.40594059 0.002484643
[42,] 0.41584158 0.002334491
[43,] 0.42574257 0.007247518
[44,] 0.43564356 0.014607684
[45,] 0.44554455 0.022383126
[46,] 0.45544554 0.029001056
[47,] 0.46534653 0.033895327
[48,] 0.47524752 0.037234096
[49,] 0.48514851 0.039305313
[50,] 0.49504950 0.040298434
       frequency         RSq
 [1,] 0.00990099 0.249332566
 [2,] 0.01980198 0.254063913
 [3,] 0.02970297 0.262781562
 [4,] 0.03960396 0.276952390
 [5,] 0.04950495 0.299119097
 [6,] 0.05940594 0.333475327
 [7,] 0.06930693 0.386527536
 [8,] 0.07920792 0.466991696
 [9,] 0.08910891 0.582064897
[10,] 0.09900990 0.725411894
[11,] 0.10891089 0.862220732
[12,] 0.11881188 0.941848253
[13,] 0.12871287 0.940203653
[14,] 0.13861386 0.868539036
[15,] 0.14851485 0.749289764
[16,] 0.15841584 0.607375465
[17,] 0.16831683 0.466816760
[18,] 0.17821782 0.340033644
[19,] 0.18811881 0.227968369
[20,] 0.19801980 0.131989238
[21,] 0.20792079 0.059928153
[22,] 0.21782178 0.018114163
[23,] 0.22772277 0.002367339
[24,] 0.23762376 0.001467246
[25,] 0.24752475 0.005515096
[26,] 0.25742574 0.009266680
[27,] 0.26732673 0.010906785
[28,] 0.27722772 0.010445295
[29,] 0.28712871 0.009720380
[30,] 0.29702970 0.012282687
[31,] 0.30693069 0.020823608
[32,] 0.31683168 0.034212905
[33,] 0.32673267 0.048190474
[34,] 0.33663366 0.058416887
[35,] 0.34653465 0.062679110
[36,] 0.35643564 0.061029051
[37,] 0.36633663 0.053960429
[38,] 0.37623762 0.041458566
[39,] 0.38613861 0.025142444
[40,] 0.39603960 0.010326387
[41,] 0.40594059 0.002484643
[42,] 0.41584158 0.002334491
[43,] 0.42574257 0.007247518
[44,] 0.43564356 0.014607684
[45,] 0.44554455 0.022383126
[46,] 0.45544554 0.029001056
[47,] 0.46534653 0.033895327
[48,] 0.47524752 0.037234096
[49,] 0.48514851 0.039305313
[50,] 0.49504950 0.040298434

ptest documentation built on May 2, 2019, 5:58 a.m.