GaussianNPMLSimulate: Get posterior draws for theta

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

Description

Simulates draws from f(theta|y) using a given empirical Bayes estimate for g(theta).

Usage

1
GaussianEBSimulate(Y, sigma2=rep(1,length(Y)),mu,alpha,size=100,verbose=FALSE)

Arguments

Y

vector of data points

sigma2

vector of known variances

mu

vector of mass locations for g(theta)

alpha

vector of probability mass for each mu

size

number of Monte Carlo draws

verbose

indicator of whether to print progress information

Details

Draws samples from f(theta|y) via Monte Carlo. Assumes that Y is normal with mean theta and variance sigma2.

Value

theta

empirical Bayes posterior mean estimates of theta

sigma2

estimates of sigma2 (currently not estimated, assumed known)

mu

mass points from the NPML

alpha

probability mass for each mu

Author(s)

Greg Ridgeway gregr@rand.org

See Also

GaussianNPML,GaussianSBR

Examples

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

out.npml  <- GaussianNPML(Y,sigma^2)
GaussianEBSimulate(Y,sigma^2,mu=out.npml$mu,alpha=out.npml$alpha,size=100)

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