generate_ar1: Simulate irregular time series

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/generate_ar1.R

Description

Simulate ensembles of irregular time series with pre-defined properties.

Usage

1
2
3
generate_ar1(TX, phi,avg=TRUE,sd.in=1,osamp=10)
generate_powlaw(TX, beta = 1, SNR = 1, avg=TRUE, sd.in = 1)
generate_ar1sins(TX, phi, ps = NULL, vars = 1, SNR = 1)

Arguments

TX

Sampling times given as numerical vector or list of numerical vectors

phi

Number between 0 and 1, giving the lag-1 autocorrelation for AR-1 processes.

avg

If true, sampling by averaging, else point-sampling of the high-resolution process.

sd.in

Standard deviation for the output.

osamp

Oversampling factor for generation.

beta

Number giving the power law exponent. 0 for white noise. For beta>1 the time series is not stationary.

SNR

Signal-to-noise-ratio: Number between 0 and 1. For SNR=0 the signal is white noise.

ps

Vector with N periods for sinusoids

vars

Vector with N+1 variances (that should add up to one), where the first one is for the AR1 component

Value

Returns a numerical vector (if TX is a vector) or a list of numerical vectors (if TX is a list of sampling times).

Author(s)

Kira Rehfeld

References

Rehfeld, K. and Kurths, J.: Similarity estimators for irregular and age-uncertain time series, Clim. Past, 10, 107-122, doi:10.5194/cp-10-107-2014, 2014. Rehfeld, K., Marwan, N., Heitzig, J., and Kurths, J.: Comparison of correlation analysis techniques for irregularly sampled time series, Nonlin. Processes Geophys., 18, 389-404, doi:10.5194/npg-18-389-2011, 2011.

See Also

generate_t, car

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#TX<-replicate(1,generate_t(dt=1,tmin=0,tmax=100,method="gamma"),simplify=FALSE)
#TY<-replicate(1,generate_t(dt=1,tmin=0,tmax=100,method="gamma"),simplify=FALSE)
#TZ<-replicate(1,generate_t(dt=1,tmin=0,tmax=100,method="gamma"),simplify=FALSE)
TX<-generate_t(dt=1,tmin=0,tmax=100,method="gamma");
TY<-generate_t()
TZ<-generate_t(method="linear")
#print(generate_t())
X<-generate_ar1(TX=list(generate_t()),phi=0.5)


Y<-generate_powlaw(list(generate_t()),beta=1,SNR=0.5)
#print(str(Y))
#Z<-generate_ar1sins(TX=list(TX), phi=0.5, ps = c(10,30), vars = c(.5,.25,.25), SNR = 1)
#print((Y))
## Get their spectra with significance
#nestobj.X<-nestspec.sig(data=X,W=10)
#nestobj.Y<-nestspec.sig(data=Y[[1]],W=10)
#nestobj.Z<-nestspec.sig(data=Z[[1]],W=10)

## Plot the ts/ spectra
#x11(width=10,height=4)
#par(mfrow=c(2,3))
#plot(X[[1]],xlab="time")
#plot(Y[[1]],xlab="time")
#plot(Z[[1]],xlab="time")
#nestspec.plot(nestobj.X,addtitle=FALSE,speconly=TRUE); title(main="AR1")
#nestspec.plot(nestobj.Y,addtitle=FALSE,speconly=TRUE); title(main="Power law")
#nestspec.plot(nestobj.Z,addtitle=FALSE,speconly=TRUE); title(main="AR1+Sinusoid+White noise")
#abline(v=1/c(10,30))# marking the frequencies

krehfeld/nest documentation built on May 28, 2019, 12:33 a.m.