R/ardec.periodic.R

Defines functions ardec.periodic

Documented in ardec.periodic

ardec.periodic <-
function(x,per,tol=0.95){

# if(frequency(x)!=12){stop("monthly time series required")}
# updated 29 Apr 2013

fit=ardec.lm(x)

comp=ardec(x,fit$coefficients)

if(any(comp$period > (per-tol) & comp$period < (per+tol))) {
                candidates=which(comp$period > (per-tol) & comp$period < (per+tol))
                lper=candidates[which.max(comp$modulus[candidates])]
                l=comp$period[lper]
                m=comp$modulus[lper]
                gt=Re(comp$comps[lper,]+comp$comps[lper+1,])   }

return(list(period=l,modulus=m,component=gt))  

}

Try the ArDec package in your browser

Any scripts or data that you put into this service are public.

ArDec documentation built on June 1, 2022, 1:06 a.m.