Learn R Programming

TurboNorm (version 1.20.0)

turbotrend: turbotrend: a fast scatterplot smoother

Description

A fast scatterplot smoother based on B-splines with second order difference penalty

Usage

turbotrend(x, y, w = rep(1, length(y)), n = 100, lambda=10^seq(-10, 10, length=1000), iter=0, method=c("original", "demmler"))

Arguments

x,y
vectors giving the coordinates of the points in the scatter plot.
w
vector of weights of with same length as the data for a weighted smoothing. Default all weights are 1.
n
an integer indicating the number of intervals equal to 1 + number of knots. Currently the intervals must be langer than 10.
lambda
Optionally a user-defined penalty parameter can be provided, if not generalized cross-validation is used to find the optimal penalty parameter.
iter
Number of robustifying iterations similar as lowess.
method
method for solving the system of linear equations either using the data in the original space or transformed to the Demmler-Reinsch basis.

Value

An object of type pspline is returned as a list with the following items:
x
original data vector x
y
fitted y-values with same length as vector x
w
vector of weights
n
number of bins
ytrend
binnend fitted y-values
xtrend
binned x-values
lambda
if scalar penalty parameter used else if vector of two lower and upper bound of the grid
iter
number of robustifying iterations
gcv
generalized cross-validation
edf
effective degrees of freedom (trace of the smoother matrix)
call
function call which produced this output

Details

some details about implementation

References

van Iterson M, Duijkers FA, Meijerink JP, Admiraal P, van Ommen GJ, Boer JM, van Noesel MM, Menezes RX (2012). A novel and fast normalization method for high-density arrays. SAGMB, 11(4).

Paul .H.C. Eilers and Brain D. Marx (1996). Flexible smoothing with B-splines and Penalties. Statistical Science, Vol 11, No. 2, 89-121.

See Also

loess,lowess, smooth, smooth.spline and smooth.Pspline

Examples

Run this code

library(marray)
data(swirl)

x <- maA(swirl)[,1]
y <- maM(swirl)[,1]
xord <- x[order(x)]
yord <- y[order(x)]

plot(xord, yord, main = "data(swirl)  &  smoothing splines + lowess")
lines(turbotrend(xord, yord), col = "red", lwd=2)
lines(smooth.spline(xord, yord), col = "green", lwd=2)
lines(lowess(xord, yord), col = "purple", lwd=2)
legend("topleft", c("piecewise constant P-splines", "Cubic B-splines", "lowess"), text.col=c("red","green","purple"), bty="n")

Run the code above in your browser using DataLab