# wandafromx: Find weight and scale factor from data if Laplace prior is... In EbayesThresh: Empirical Bayes Thresholding and Related Methods

## Description

Given a vector of data and a single value or vector of sampling standard deviations, find the marginal maximum likelihood choice of both weight and scale factor under the Laplace prior.

## Usage

 1 2 wandafromx(x, s = 1, universalthresh = TRUE) negloglik.laplace(xpar, xx, ss, tlo, thi)

## Arguments

 x A vector of data. s A single value or a vector of standard deviations. If vector, must have the same length as x. universalthresh If universalthresh = TRUE, the thresholds will be upper bounded by universal threshold; otherwise, the thresholds can take any non-negative values. xx A vector of data. xpar Vector of two parameters: xpar[1] : a value between 0 and 1, which will be adjusted to range of w; xpar[2], scale factor "a". ss Vector of standard deviations. tlo Lower bound of thresholds. thi Upper bound of thresholds.

## Details

The parameters are found by marginal maximum likelihood.

The search is over weights corresponding to threshold t_i in the range [0, s_i sqrt(2 log n)] if universalthresh=TRUE, where n is the length of the data vector and (s_1, ... , s_n) is the vector of sampling standard deviation of data (x_1, ... , x_n); otherwise, the search is over [0,1].

The search uses a nonlinear optimization routine (optim in R) to minimize the negative log likelihood function negloglik.laplace. The range over which the scale factor is searched is (0.04, 3). For reasons of numerical stability within the optimization, the prior is parametrized internally by the threshold and the scale parameter.

## Value

A list with values:

 w The estimated weight. a The estimated scale factor.

## Author(s)

Bernard Silverman

## References

See ebayesthresh and http://www.bernardsilverman.com