set.sigma {BBEST}R Documentation

Set the experimental uncertainty


This function either sets the pointwise experimental uncertainty or estimates it using aws library.


set.sigma(data, sigma=NA, x.bkg.only=NA, n.regions=10, hmax=250, sigma2=c(0.1))



an object of type data. See for details.


numeric vector which, if not NA, determines the pointwise experimental uncertainty.


if parameter sigma is NA, determines the peak-free region used to estimate the noise.


if both parameters sigma and x.bkg.only are NA, the grid is split into n.regions equal regions. The noise is then estimated for each of these regions. See details


specifies the maximal bandwidth


specifies the estimation of the signal's variance


We assume the experimental uncertainty to have a Gaussian distribution with x-dependent amplitude. Splitting the grid into n.regions segments and estimating Gaussian standard deviations over each of these segments allows us to approximate the true distribution.

The function uses aws package that uses a Propagation-Separation Approach for signal smoothing. The use of sigma2 argument allows to obtain a smoother or rougher result.


An object of type data. Elements


numeric vector containing the estimated noise level.


if both parameters sigma and x.bkg.only are NA contains a smoothed estimate of the regression function.

are replaced with their new values.


Polzehl J, Papafitsoros K, Tabelow K (2020). Patch-Wise Adaptive Weights Smoothing in R. Journal of Statistical Software, 95(6), 1-27. Joerg Polzehl, Felix Anker (2020): aws: Adaptive Weights Smoothing. Version 2.5.


## Not run: 
# Setting x and y
x <- seq(.7, 30, 0.01)
y <- sin(x)
# Adding x-dependent noise
y <- y + rnorm(sd=0.05+x/240, n=length(x))

# estimating noise
dat <- list(x=x, y=y)
dat <- set.sigma(dat, n.regions=1, sigma2 = 0.005)
# use
# dat <- set.sigma(dat, n.regions=5)
# to see the difference

# Plotting results: noisy function and a
# smoothed estimate +/- 2 standard deviations
plot(x, y, t="l")
lines(dat$x, dat$smoothed, col=3, lwd=2)
lines(dat$x, dat$smoothed+2*dat$sigma, col=2)
lines(dat$x, dat$smoothed-2*dat$sigma, col=2)
abline(v=seq(min(x), max(x),length=5), col=4)

## End(Not run)

[Package BBEST version 0.1-8 Index]