GaussianSBR: Smoothing by Roughening, Gaussian

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/hhsim.R

Description

Implements the smoothing by roughening (SBR) estimate of g(theta).

Usage

1
GaussianSBR(Y, sigma2 = rep(1, length(Y)), n.iters = round(2 * log(length(Y))), n.masspoints = 200, verbose = FALSE)

Arguments

Y

vector of data points

sigma2

vector of known variances

n.iters

number of SBR iterations

n.masspoints

number of mass points for discrete SBR approximation

verbose

indicator of whether to print progress information

Details

See Shen and Louis (1999) for complete details.

Assumes a model of the form Y[k]~N(theta[k],sigma[k]) where theta[k]~g(theta). This function gets posterior means for theta using an empirical Bayes estimate for g. It sets up n.masspoints equally spaced points on the range of Y. Using the EM algorithm, it iteratively refines the estimate of g stopping after n.iters iterations. After many 1000s of iterations this will converge to the NPML for g.

Value

theta

empirical Bayes posterior mean estimates of theta

sigma2

estimates of sigma2 (currently not estimated, assumed known)

mu

mass points for the discrete approximation to SBR

alpha

probability mass for each mu

Author(s)

Greg Ridgeway gregr@rand.org

References

Laird NM, Louis TA (1991). Smoothing the non-parametric estimate of a prior distribution by roughening: An empirical study. Comput. Statist. and Data Analysis, 12:27-38.

Shen W, Louis TA (1999). Empirical Bayes Estimation via the Smoothing by Roughening Approach. J. Computational and Graphical Statistics, 8: 800-823.

See Also

GaussianNPML

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
k <- 100
theta <- rnorm(k,0,1)
sigma <- rep(1,k)
Y <- rnorm(k,theta,sigma)

out.sbr  <- GaussianSBR(Y,sigma^2,
                        n.iters=round(3*log(k)))
x <- with(out.sbr, sample(mu,size=100000,replace=TRUE,prob=alpha))
hist(x,main="SBR",prob=TRUE,xlab="theta",ylab="g(theta)")

plot(out.sbr$theta,theta)

gregridgeway/hhsim documentation built on May 17, 2019, 8:36 a.m.