EndRule(x, y, k, dimx, endrule=c("NA", "trim", "keep", "constant", "func"), align = c("center", "left", "right"), Func, ...)
dim(x)
) used to choose
dimentions of the output. k2
values at both ends are affected, where k2
is the half-bandwidth
k2 = k %/% 2
.
"mad"
- applies the mad function to
smaller and smaller sections of the array. Equivalent to:
for(i in 1:k2) out[i]=mad(x[1:(i+k2)])
.
"trim"
- trim the ends; output array length is equal to
length(x)-2*k2 (out = out[(k2+1):(n-k2)])
. This option mimics
output of apply
(embed(x,k),1,FUN)
and other
related functions.
"keep"
- fill the ends with numbers from x
vector
(out[1:k2] = x[1:k2])
. This option makes more sense in case of
smoothing functions, kept here for consistency.
"constant"
- fill the ends with first and last calculated
value in output array (out[1:k2] = out[k2+1])
"NA"
- fill the ends with NA's (out[1:k2] = NA)
"func"
- same as "mad"
option except that implemented
in R for testing purposes. Avoid since it can be very slow for large windows.
run
functions. Function EndRule
will fill the
remaining beginning and end sections using method chosen by endrule
argument.EndRule
will use in case of
endrule="func"
.Func
that EndRule
will
use in case of endrule="func"
.x
. Only in case of
endrule="trim"
.the output will be shorter.