kzft: Kolmogorov-Zurbenko Fourier Transform

Description Usage Arguments Details References See Also Examples

View source: R/kzft.R

Description

Kolmogorov-Zurbenko Fourier Transform is an iterated Fourier transform.

Usage

1
2
3
kzft(x, f=0, m=1, k=1) 
coeff(m, k)
transfer_function(m, k, lamda = seq(-0.5,0.5,by=0.01), omega = 0 )

Arguments

x

The raw data

f

The frequency that KZFT is applied at.

m

The window size for transform

k

The number of iterations for applying the KZFT

lamda

The frequencies used for the calculating the transfer function.

omega

The frequency that KZFT is applied at.

Details

Kolmogorov-Zurbenko Fourier Transform (KZFT) is the Fourier transform applied over every segment of length m iterated k times. The argument alg="F" will use Fast Fourier Transforms written in C (fftw library). The alg="C" is a slow Fourier Transform but has the advantage of being able to handle missing values. It currently works in one dimension. The alg="R" is an R version of KZFT for experimental purposes.The coeff function generates the coefficients for the KZFT function.

You will introduce a phase shift and decrease the fidelity of the signal if the product of f*m is not an integer.

References

I. G. Zurbenko, The spectral Analysis of Time Series. North-Holland, 1986.

I. G. Zurbenko, P. S. Porter, Construction of high-resolution wavelets, Signal Processing 65: 315-327, 1998.

R. Neagu, I. G. Zurbenko, Tracking and separating non-stationary multi-component chirp signals, J. Franklin Inst., 499-520, 2002.

R. H. Shumway, D. S. Stoffer, Time Series Analysis and Its Applications: With R Examples, Springer, 2006.

Wei Yang and Igor Zurbenko, kzft: Kolmogorov-Zurbenko Fourier Transform and Applications, R-Project 2007.

Igor G. Zurbenko, Amy L. Potrzeba, Tidal Waves in Atmosphere and Their Effects, Acta Geophysica Volume 58, Number 2, 356-373

See Also

kzp, kztp,

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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# example taken from Wei Yang's KZFT package
# coefficients of kzft(201,5)

# function to calculate polnomial coefficients for kzft
## Not run: 
a<-coeff(201,5);
t<-seq(1:1001)-501;
z<-cos(2*pi*0.025*t);
plot(z*a,type="l",xlab="Time", ylab="Coefficient", main="Coefficients of the kzft");
lines(a);
lines(-1*a);

## End(Not run)

# example taken from Wei Yang's KZFT package
# transfer function of the kzft(201,5) at frequency 0.025
lamda<-seq(-0.1,0.1,by=0.001)
tf1<-transfer_function(201,1,lamda,0.025)
tf2<-transfer_function(201,5,lamda,0.025)
matplot(lamda,cbind(log(tf1),log(tf2)),type="l",ylim=c(-15,0),
	ylab="Natural log transformation of the coefficients", 
	xlab="Frequency (cycles/time unit)",
    main="Transfer function of kzft(201,5) at frequency 0.025")

# example with missing values
set.seed(2)
period=101
f<-1/period
t<-1:2000
s<-1*sin(2*pi*f*t)
x<-s
noise<-3*rnorm(length(t))
x<-s+noise
m=101

rand_idx <- sample(t,100,replace=FALSE)
x[rand_idx]<-NA
x<-as.vector(na.omit(x))

system.time(z1<-kzft(x, m=m, k=1, f=f))
system.time(z2<-kzft(x, m=m, k=2, f=f))
system.time(z3<-kzft(x, m=m, k=3, f=f))

par(mfrow=c(2,2))
plot(x,type="l",main="Original time series",xlab="t", ylab="y")
lines(s,col="blue")
plot(2*Re(z1),type="l",main="kzft(101,1)",xlab="t", ylab="y", ylim=c(-6,6))
lines(s,col="blue")
plot(2*Re(z2),type="l",main="kzft(101,2)",xlab="t", ylab="y", ylim=c(-6,6))
lines(s,col="blue")
plot(2*Re(z3),type="l",main="kzft(101,3)",xlab="t", ylab="y", ylim=c(-6,6))
lines(s,col="blue")
par(mfrow=c(1,1))

Example output

   user  system elapsed 
  0.012   0.000   0.012 
   user  system elapsed 
  0.051   0.000   0.050 
   user  system elapsed 
  0.051   0.000   0.052 

kza documentation built on March 26, 2020, 6:27 p.m.

Related to kzft in kza...