Learn R Programming

PTAk (version 1.2-6)

preprocessings: Few useful functions for preprocessing arrays

Description

Choices of centering or detrending and scaling are important preprocessings for multiway analysis.

Usage

Multcent(dat,bi=c(1,2),by=3,
          centre=mean,
           centrebyBA=c(TRUE,FALSE),scalebyBA=c(TRUE,FALSE))
IterMV(n=10,dat,Mm=c(1,3),Vm=c(2,3),
               fFUN=mean,usetren=FALSE,
                  tren=function(x)smooth.spline(as.vector(x),df=5)$y,
                   rsd=TRUE)
Detren(dat,Mm=c(1,3),rsd=TRUE,
         tren=function(x)smooth.spline(as.vector(x),df=5)$y )
Susan1D(y,x=NULL,sigmak=NULL,sigmat=NULL,
          ker=list(function(u)return(exp(-0.5*u**2))))

Arguments

dat
array
bi
vector defining the "centering, bicentering or multi-centering" one wants to operate crossed with by
by
number or vector defining the entries used "with" in the other operations
centre
function used as FUN in applying "multi-centering"
centrebyBA
a bolean vector for "centering" with centre Before and After according to by
scalebyBA
idem as centrebyBA, for scaling operation
n
number of iterations between "centering" and scaling
Mm
margins to performs Detren or fFUN on
Vm
margins to scale
fFUN
function to use as FUN if usetren is FALSE
usetren
logical, to use Detren
tren
function to use in Detren
rsd
logical passed into Detren (only) to detrend or not
y
vector (length n)
x
vector of same length, if NULL it is 1:n
sigmak
parameter related to kernel bandwidth with y values (default is 1/2*range
sigmat
parameter related to kernel bandwidth with x values (default value is 8*n^{-1/5}, with a minimum number of neigbours set as one apart)
ker
a list of two kernels list("t"=function "k"=function ) for each weightings (if only one given it is used for both)

Details

Multcent performs in order "centering" by by; "multicentering" for every bi with by; then scale (standard deviation) to one by by.

IterMV performs an iterative "detrending" and scaling according to te margins defined (see Leibovici(2000) and references in it).

Detren detrends (or smooths if rsd is FALSE) the data accoding to th margins given.

Susan1D performs a non-linear kernel smoothing of y against x (both reordered in the function according to orders of x) with an usual kernel (t) as for kernel regression and a kernel (t) for the values of y (the product of the kernels constitutes the non-linear weightings. This function is adapted from SUSAN algorithm (see references).

References

Smith S.M. and J.M. Brady (1997) SUSAN - a new approach to low level image processing. International Journal of Computer Vision, 23(1):45-78, May 1997.