Last data update: 2014.03.03

R: Power law noise generator for unequally sampled observation...
TK95_uneqR Documentation

Power law noise generator for unequally sampled observation times

Description

Generates power law noise using TK95 according to Timmer and König (1995), with modifications proposed in Uttley, McHardy and Papadakis (2002) for given irregular observation times.

Usage

TK95_uneq(tt, alpha = 1.5)

Arguments

tt

numeric vector: Observation times given.

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: Noise values related to the observation times.

Note

This function is applied in Thieler et al. (2013). See also Thieler, Fried and Rathjens (2016).

Author(s)

Anita M. Thieler

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

Uttley, P., McHardy, I. M. and Papadakis, I. E. (2002) Measuring the Broad-Band Power Spectra of Active Galactic Nuclei with RXTE. Monthly Notices of the Royal Astronomical Society, 332 (1), 231-250

See Also

Applies TK95, applied in tsgen.

Examples

# Compare with example in TK95 to see that the power law is much more clear in
# equally sampled data!
set.seed(31)
# Generate power law noise with exponent alpha=1.5:
tt <- sampler(ttype="unif", ps=1, ncycles=2000, npoints=2000)
y <- TK95_uneq(tt, alpha=1.5)

# Show time series:
plot(tt,y, type="l", main="Irregular Power Law Noise", xlab="t", ylab="y")

# Plot Lomb-Scargle periodogram with log-axes:
temp <- RobPer(cbind(tt,y,1), weighting=FALSE, model="sine", regression="L2",
    periods=2000/seq(2, 1000, 2))
plot(log(seq(2, 1000, 2)/2000), log(temp), main="log-log-Fourier periodogram",
    xlab="log(frequency)", ylab="log(periodogram)")
title(main= "Power Law not so obvious", cex.main=0.8, line=0.5)

# A line with slope -alpha for comparison
abline(a=-10, b=-1.5, col="red")
text(-5, -1.5, 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_uneq.Rd_%03d_medium.png", width=480, height=480)
> ### Name: TK95_uneq
> ### Title: Power law noise generator for unequally sampled observation
> ###   times
> ### Aliases: TK95_uneq
> 
> ### ** Examples
> 
> # Compare with example in TK95 to see that the power law is much more clear in
> # equally sampled data!
> set.seed(31)
> # Generate power law noise with exponent alpha=1.5:
> tt <- sampler(ttype="unif", ps=1, ncycles=2000, npoints=2000)
> y <- TK95_uneq(tt, alpha=1.5)
> 
> # Show time series:
> plot(tt,y, type="l", main="Irregular Power Law Noise", xlab="t", ylab="y")
> 
> # Plot Lomb-Scargle periodogram with log-axes:
> temp <- RobPer(cbind(tt,y,1), weighting=FALSE, model="sine", regression="L2",
+     periods=2000/seq(2, 1000, 2))
> plot(log(seq(2, 1000, 2)/2000), log(temp), main="log-log-Fourier periodogram",
+     xlab="log(frequency)", ylab="log(periodogram)")
> title(main= "Power Law not so obvious", cex.main=0.8, line=0.5)
> 
> # A line with slope -alpha for comparison
> abline(a=-10, b=-1.5, col="red")
> text(-5, -1.5, expression(alpha==1.5), col="red")
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>