smpg: Smooth and Plot One Dimensional Kolmogorov-Zurbenko...

Description Usage Arguments Details Value See Also Examples

Description

kz.smpg is designed to smooth and plot 1D KZ periodogram easily. It will calculate the raw periodogram, mark the spikes, smooth the periodogram, and then output the plot.

Usage

1
kz.smpg(x, dpct = 0.01, rg = c(0, 0.5), log = F, plot = F, ...)

Arguments

x

The data vector for analyses. Missing values are allowed.

dpct

A pre-specified percentage of total variation. Defaults to 1%.

rg

The frequency range of the outputted periodogram. Default is 0 to 0.5.

log

TRUE or FLASE. Use log scale for output periodogram. Defaults to FLASE.

plot

TRUE or FLASE. Flag for output periodogram plot or not. Defaults to FLASE.

...

Other arguments.

  • m : The window size for a regular Fourier transform

  • k : The number of iterations for the KZFT

  • n : The sampling frequency rate as a multiplication of the Fourier frequencies

  • p : The distance between two successive intervals as a percentage of the total length of the data series

  • w : Size of smoothing window. Default value is 20.

  • lvl : "min" or "max". Threshold strategy for marking frequency spikes. "min" is used for cases with weak singles mixed with dominating strong spikes. Defaults to "max".

  • cut : Set the minimum value for a marked frequency spike. Recommend to use argument lvl instead of setting this value directly.

Details

The smoothing process is based on a modified DiRienzo-Zurbenko (DZ) method, for which the smoothing window is not symmetric around the value point. The smoothing algorithm is implemented in C.

Value

Data frame for outputted periodogram, including column spg for the periodogram values, and freq for the frequencies.

See Also

kzp, kzp2, kz.ft

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Adapted from kzft::kzp example 2
t <- 1:2000
y <- 1.1*sin(2*pi*0.0339*t)+7*sin(2*pi*0.0366*t)+5*rnorm(length(t),0,1)
y[sample(t,100,replace=FALSE)] <- NA

## Not run: 
# system.time(op <- kz.smpg(y, dpct=0.0001, rg=c(0.025,0.05),  
#		plot=TRUE, log=TRUE, lvl="min", n=10, k=2))

## End(Not run)
op <- kz.smpg(y, dpct=0.0000, f=c(0.0339,0.0366), rg=c(0.025,0.05), 
	n=10, k=2, plot=TRUE, lvl="min", log=FALSE)

kzfs documentation built on June 2, 2019, 5:04 p.m.

Related to smpg in kzfs...