R/ebnm_fns.R
ebnm_deconvolver.Rd
Solves the empirical Bayes normal means (EBNM) problem using a non-parametric
exponential family with a natural spline basis.
Like ebnm_npmle
, there is no unimodal assumption, but whereas
ebnm_npmle
produces spiky estimates for \(g\),
ebnm_deconvolver
estimates are much more regular. See
deconvolveR-package
for details and
references. Identical to function ebnm
with argument
prior_family = "deconvolver"
.
ebnm_deconvolver(
x,
s = 1,
scale = "estimate",
g_init = NULL,
fix_g = FALSE,
output = ebnm_output_default(),
control = NULL,
...
)
A vector of observations. Missing observations (NA
s) are
not allowed.
Standard errors, which must be uniformly equal to 1 (i.e.,
s = 1
) since the deconvolveR method takes \(z\)-scores as input.
A deconvolveR prior is a finite mixture of point masses
$$\pi_1 \delta_{\mu_1} + \ldots + \pi_K \delta_{\mu_K},$$
where parameters \(\pi_k\) are estimated and the point masses are
evenly spaced over \((\mu_1, \mu_K)\).The distance between successive
point masses can be specified by the user via parameter
scale
, in which case the argument should be a scalar specifying the
distance \(d = \mu_2 - \mu_1 = \cdots = \mu_K - \mu_{K - 1}\);
alternatively, if scale = "estimate"
, then ebnm
sets the grid
via function ebnm_scale_npmle
.
The prior distribution \(g\). Usually this is left
unspecified (NULL
) and estimated from the data. However, it can be
used in conjuction with fix_g = TRUE
to fix the prior (useful, for
example, to do computations with the "true" \(g\) in simulations). If
g_init
is specified but fix_g = FALSE
, g_init
specifies the initial value of \(g\) used during optimization. This has
the side effect of fixing the scale
parameter. When supplied,
g_init
should be an object of class normalmix
or an ebnm
object in which the fitted
prior is an object of class normalmix
.
If TRUE
, fix the prior \(g\) at g_init
instead
of estimating it.
A character vector indicating which values are to be returned.
Function ebnm_output_default()
provides the default return values, while
ebnm_output_all()
lists all possible return values. See Value
below.
A list of control parameters to be passed to optimization
function nlm
.
Additional parameters to be passed to function
deconv
in package deconvolveR
.
An ebnm
object. Depending on the argument to output
, the
object is a list containing elements:
data
A data frame containing the observations x
and standard errors s
.
posterior
A data frame of summary results (posterior means, standard deviations, second moments, and local false sign rates).
fitted_g
The fitted prior \(\hat{g}\).
log_likelihood
The optimal log likelihood attained, \(L(\hat{g})\).
posterior_sampler
A function that can be used to
produce samples from the posterior. The sampler takes a single
parameter nsamp
, the number of posterior samples to return per
observation.
S3 methods coef
, confint
, fitted
, logLik
,
nobs
, plot
, predict
, print
, quantile
,
residuals
, simulate
, summary
, and vcov
have been implemented for ebnm
objects. For details, see the
respective help pages, linked below under See Also.
See ebnm
for examples of usage and model details.
Available S3 methods include coef.ebnm
,
confint.ebnm
,
fitted.ebnm
, logLik.ebnm
,
nobs.ebnm
, plot.ebnm
,
predict.ebnm
, print.ebnm
,
print.summary.ebnm
, quantile.ebnm
,
residuals.ebnm
, simulate.ebnm
,
summary.ebnm
, and vcov.ebnm
.