colKernelSmoothing.matrix {aroma.core} | R Documentation |
Kernel smoothing of a matrix column by column.
## S3 method for class 'matrix': colKernelSmoothing(Y, x=seq(length = nrow(Y)), w=NULL, xOut=x, kernel=c("gaussian", "uniform"), h, censorH=3, na.rm=TRUE, robust=FALSE, ..., verbose=FALSE)
Y |
A numeric JxI matrix (or a vector of length J.) |
x |
A (optional) numeric vector specifying the positions of
the J entries. The default is to assume uniformly distributed
positions. |
w |
A optional numeric vector of prior weights for each of
the J entries. |
xOut |
A numeric vector specifying K target positions where
the kernel is applied. |
kernel |
A character string or a function specifying the
kernel used. |
h |
A single positive numeric specifying the bandwidth of
the kernel. |
censorH |
A single positive numeric specifying the where to
truncate the kernel. If Inf , no truncation is done. |
na.rm |
If TRUE , missing values are excluded, otherwise not. |
robust |
If TRUE , robust estimators are used, otherwise not. |
... |
Not used. |
verbose |
See Verbose . |
Returns a numeric
KxI matrix
(or a vector
of length K).
Henrik Bengtsson (http://www.braju.com/R/)
J <- 100 I <- 4 Y <- matrix(rnorm(I*J, sd=1/2), ncol=I) # Introduce a gain in column 2 and 3 Y[30:50,2:3] <- Y[30:50,2:3] + 3 x <- 1:J xOut <- x Ys1 <- colKernelSmoothing(Y, x=x, xOut=xOut, kernel="gaussian", h=1) Ys5 <- colKernelSmoothing(Y, x=x, xOut=xOut, kernel="gaussian", h=5) xlim <- range(c(x,xOut)) ylim <- c(-3,5) layout(matrix(1:I, ncol=1)) par(mar=c(3,3,1,1)+0.1, pch=19) for (ii in 1:I) { plot(NA, xlim=xlim, ylim=ylim) points(x, Y[,ii], col="#999999") lines(xOut, Ys1[,ii], col=2) points(xOut, Ys1[,ii], col=2) lines(xOut, Ys5[,ii], col=3) points(xOut, Ys5[,ii], col=3) }