Description Usage Arguments Details Value Examples
This function performs non-parametric regression (signal denoising) using Empirical Bayes wavelet-based methods.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
x |
A vector of observations. Reflection is done automatically
if length of |
sigma |
A vector of standard deviations. Can be provided if known or estimated beforehand. |
v.est |
Boolean indicating if variance estimation should be performed instead. |
joint |
Boolean indicating if results of mean and variance estimation should be returned together. |
v.basis |
Boolean indicating if the same wavelet basis should be used for variance estimation as mean estimation. If false, defaults to Haar basis for variance estimation (this is much faster than other bases). |
post.var |
Boolean indicating if the posterior variance should be returned for the mean and/or variance estiamtes. |
filter.number |
Choice of wavelet basis to be used, as in
|
family |
Choice of wavelet basis to be used, as in
|
return.loglr |
Boolean indicating if a logLR should be returned. |
jash |
Indicates if the prior from method JASH should be used. This will often provide slightly better variance estimates (especially for nonsmooth variance functions), at the cost of computational efficiency. Defaults to FALSE. |
SGD |
Boolean indicating if stochastic gradient descent should be used in the EM. Only applicable if jash=TRUE. |
weight |
Optional parameter used in estimating overall variance. Only works for Haar basis. Defaults to 0.5. Setting this to 1 might improve variance estimation slightly. |
min.var |
The minimum positive value to be set if the variance estimates are non-positive. |
ashparam |
A list of parameters to be passed to |
homoskedastic |
indicates whether to assume constant variance (if v.est is true) |
reflect |
A logical indicating if the signals should be reflected. |
We assume that the data come from the model Y_t = μ_t + ε_t for t=1,...,T, where μ_t is an underlying mean, assumed to be spatially structured (or treated as points sampled from a smooth continous function), and ε_t \sim N(0, σ_t), and are independent. Smash provides estimates of μ_t and σ_t^2 (and their posterior variances if desired).
By default smash.gaus
simply returns a vector of estimated means.
However, if more outputs are requested (eg if return.loglr or v.est is TRUE) then
the output is a list with one or more of the following elements:
mu.res |
A list with the mean estimate, its posterior variance
if |
If v.est
is TRUE, then smash.gaus
returns the
following:
var.res |
A list with the variance estimate, its posterior
variance if |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | n=2^10
t=1:n/n
spike.f = function(x) (0.75*exp(-500*(x-0.23)^2) +
1.5*exp(-2000*(x-0.33)^2) + 3*exp(-8000*(x-0.47)^2) +
2.25*exp(-16000*(x-0.69)^2)+0.5*exp(-32000*(x-0.83)^2))
mu.s = spike.f(t)
# Gaussian case
mu.t = (1+mu.s)/5
plot(mu.t,type='l')
var.fn = (0.0001 + 4*(exp(-550*(t-0.2)^2) + exp(-200*(t-0.5)^2) +
exp(-950*(t-0.8)^2)))/1.35
plot(var.fn,type='l')
rsnr=sqrt(5)
sigma.t=sqrt(var.fn)/mean(sqrt(var.fn))*sd(mu.t)/rsnr^2
X.s=rnorm(n,mu.t,sigma.t)
mu.est=smash.gaus(X.s)
plot(mu.t,type='l')
lines(mu.est,col=2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.