Generates an equidistant time series of power law noise according to Timmer and König (1995).
Usage
TK95(N = 1000, alpha = 1.5)
Arguments
N
integer value: Length of the generated time series.
alpha
numeric value: Exponent of the power law. White noise has exponent 0, flicker noise (pink noise) has exponent 1, brown noise has exponent 2.
Value
numeric vector: The generated time series.
Note
This function is used in Thieler et al. (2013). See also Thieler, Fried and Rathjens (2016).
Author(s)
Anita M. Thieler with contributions of Uwe Ligges
References
Thieler, A. M., Backes, M., Fried, R. and Rhode, W. (2013): Periodicity Detection in Irregularly Sampled Light Curves by Robust Regression and Outlier Detection. Statistical Analysis and Data Mining, 6 (1), 73-89
Thieler, A. M., Fried, R. and Rathjens, J. (2016): RobPer: An R Package to Calculate Periodograms for Light Curves Based on Robust Regression. Journal of Statistical Software, 69 (9), 1-36, <doi:10.18637/jss.v069.i09>
Timmer, J. and König, M. (1995) On Generating Power Law Noise. Astronomy and Astrophysics, 300, 707-710
See Also
Applied in tsgen by TK95_uneq.
Examples
set.seed(31)
# Generate power law noise with exponent alpha=1.5:
y <- TK95(N=2000, alpha=1.5)
tt <- seq(along=y)
# Show time series:
plot(tt,y, type="l", main="Power Law Noise", xlab="t", ylab="y")
# Plot Fourier periodogram with log-axes:
temp <- spectrum(y, plot=FALSE)
plot(log(temp$freq), log(temp$spec), main="log-log-Fourier periodogram",
xlab="log(frequency)", ylab="log(periodogram)")
# A line with slope -alpha for comparison
abline(a=8, b=-1.5, col="red")
text(-2, 12, expression(alpha==1.5), col="red")
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(RobPer)
Loading required package: robustbase
Loading required package: quantreg
Loading required package: SparseM
Attaching package: 'SparseM'
The following object is masked from 'package:base':
backsolve
Loading required package: splines
Loading required package: BB
Loading required package: rgenoud
## rgenoud (Version 5.7-12.4, Build Date: 2015-07-19)
## See http://sekhon.berkeley.edu/rgenoud for additional documentation.
## Please cite software as:
## Walter Mebane, Jr. and Jasjeet S. Sekhon. 2011.
## ``Genetic Optimization Using Derivatives: The rgenoud package for R.''
## Journal of Statistical Software, 42(11): 1-26.
##
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/RobPer/TK95.Rd_%03d_medium.png", width=480, height=480)
> ### Name: TK95
> ### Title: Power law noise generator
> ### Aliases: TK95
>
> ### ** Examples
>
> set.seed(31)
> # Generate power law noise with exponent alpha=1.5:
> y <- TK95(N=2000, alpha=1.5)
> tt <- seq(along=y)
>
> # Show time series:
> plot(tt,y, type="l", main="Power Law Noise", xlab="t", ylab="y")
>
> # Plot Fourier periodogram with log-axes:
> temp <- spectrum(y, plot=FALSE)
> plot(log(temp$freq), log(temp$spec), main="log-log-Fourier periodogram",
+ xlab="log(frequency)", ylab="log(periodogram)")
>
> # A line with slope -alpha for comparison
> abline(a=8, b=-1.5, col="red")
> text(-2, 12, expression(alpha==1.5), col="red")
>
>
>
>
>
> dev.off()
null device
1
>