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

1 |

`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. |

some details about implementation

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 |

Maarten van Iterson, Chantal van Leeuwen

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.

`loess`

,`lowess`

, `smooth`

, `smooth.spline`

and `smooth.Pspline`

1 2 3 4 5 6 7 8 9 10 11 12 13 | ```
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")
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.