Robust fitting of local regression models for estimating a baseline or a background signal

1 2 3 4 |

`x, y` |
Abscissa and ordinate of the points on the scatterplot. |

`span` |
Specifies the amount of smoothing; span is the fraction of points used to compute each fitted value; as span increases the output becomes smoother. |

`NoXP` |
Another way of specifying the amount of smoothing; NoXP is the Number of X Points used to compute each fitted value; it must be larger than 3. |

`maxit` |
The number of iterations in the robust fit; if maxit=c(0,0), the nonrobust fit is returned; the first entry specifies the number of iterations using an asymmetric biweight function, whereas the second entry specifies the number of iterations using the usual (symmetric) biweight function. |

`b` |
Tuning constant in the biweight function. |

`weight` |
Optional weights to be given to individual observations. |

`Scale` |
function specifying how to calculate the scale of the residuals. |

`delta` |
Nonnegative parameter which may be used to save
computation. By default, if |

`SORT` |
Boolean variable indicating whether x data must be sorted. Change it only when the x are sorted and you want to safe computer time. |

`DOT` |
If TRUE disregard outliers totally; that is, observations with weight 0 are disregarded even when the neighbourhood is determined. |

`init` |
Values of an initial fit. |

List containing components

`x ` |
Sorted input vector x with duplicate points removed |

`y ` |
Corresponding input vector y |

`fit ` |
Fitted values at x |

`rw ` |
Robust weights of (x,y)-Points used in last iteration of fit |

`scale ` |
Scale used in last iteration of fit |

Andreas Ruckstuhl

Ruckstuhl, Andreas F., Matthew P. Jacobson, Robert W. Field and James
A. Dodd (2001); Baseline Subtraction Using Robust Local Regression
Estimation; Journal of Quantitative Spectroscopy and Radiative
Transfer **68**: 179 – 193

Ruckstuhl, Andreas F., et al.; Estimation of background concentrations of atmospheric trace gases using robust local regression; to be published

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ```
data(MS)
MS1 <- log10(MS[MS$mz>12000&MS$mz<1e5,])
MS1.rfb2 <- rfbaseline(x=MS1$mz, y=MS1$I, NoXP=2200, maxit=c(5,0))
plot(x=MS1$mz, y=MS1$I, type="l",
xlab="log(mass/charge)", ylab="log(intensity)")
lines(MS1.rfb2$x, MS1.rfb2$fit, col="orange", lwd=3)
MS1.rfb3 <- rfbaseline(x=MS1$mz, y=MS1$I, NoXP=1100, maxit=c(5,0),
DOT=TRUE, Scale=function(x) mad(x, center=0))
plot(x=MS1$mz, y=MS1$I, type="l",
xlab="log(mass/charge)", ylab="log(intensity)")
lines(MS1.rfb3$x, MS1.rfb3$fit, col="orange", lwd=3)
## 'delta=0' needs much more computer time
## Not run:
MS1.rfb4 <- rfbaseline(x=MS1$mz, y=MS1$I, NoXP=2200,
delta=0, maxit=c(5,0))
plot(x=MS1$mz, y=MS1$I,ty="l",
xlab="log(mass/charge)", ylab="log(intensity)")
lines(MS1.rfb4$x, MS1.rfb4$fit, col="orange", lwd=3)
## End(Not run)
``` |

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.