set.sigma: Set the experimental uncertainty

Description Usage Arguments Details Value References Examples

View source: R/interface.R

Description

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

Usage

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

Arguments

data

an object of type data. See set.data for details.

sigma

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

x.bkg.only

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

n.regions

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

hmax

specifies the maximal bandwidth

sigma2

specifies the estimation of the signal's variance

Details

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.

Value

An object of type data. Elements

sigma

numeric vector containing the estimated noise level.

smoothed

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

are replaced with their new values.

References

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. https://CRAN.R-project.org/package=aws.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## 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)

BBEST documentation built on Jan. 8, 2021, 2:22 a.m.