gmleb: General maximum likelihood empirical Bayes estimator of Jiang...

View source: R/gmleb.R

gmlebR Documentation

General maximum likelihood empirical Bayes estimator of Jiang and Zhang (2009)

Description

Estimates mean vector of a homoscedastic sequence of independent Gaussian observations using the nonparametric maximum likelihood procedure of Jiang and Zhang (2009)

Usage

gmleb(x1, s1, init = NULL, grid = NULL, M = 300, tol = 1e-05, maxit = 1000)

Arguments

x1

Gaussian sequence

s1

standard deviation of Gaussian sequence

init

initial values for masses of discrete prior, default is discrete uniform over support points

grid

grid of support points for discrete prior, default is M equally spaced points between min(x1) and max(x1)

M

number of grid points

tol

error tolerance of convergence of log likelihood

maxit

maximum number of iterations

Value

estimated values of means of primary Gaussian sequence

Examples

## generate data
n = 250
set.seed(1)
theta1 = rnorm(n)
x1 = theta1 + rnorm(n)
## loss of MLE
mean((theta1 - x1)^2)
## loss of GMLEB
mean((theta1 - gmleb(x1, 1)$theta_hat)^2)

sdzhao/cole documentation built on May 2, 2022, 9:42 a.m.