Suppose we observe 300 individual estimates which are distributed , with known.

Now if we assume , the James-Stein rule gives an estimator for which dominates .

Below is code for a little RStudio script to see how changing the balance of variance between data y and the variance of the means changes the amount of optimal shrinkage. For more info, read the paper referenced below! It uses the RStudio’s manipulate library: info on that.

# Stein's estimation rule and its competitors - an empirical Bayes approach
# B Efron, C Morris, Journal of the American Statistical, 1973
n <- 300
sigma.means <- 5
means <- rnorm(n, 0, sigma.means)
# sigma.y <- 5
library(manipulate)
manipulate({
y <- rnorm(n,means,sigma.y)
A <- sum((y/sigma.y)^2)/(n - 2) - 1
B <- 1/(1 + A)
eb <- (1 - B) * y
par(mfrow=c(2,1),mar=c(5,5,3,1))
plot(means, y, main="y ~ N(mean, sigma.y)\nmean ~ N(0, sigma.mean=5)")
points(means, eb, col="red")
legend("topleft","James-Stein estimators",col="red",pch=1)
s <- seq(from=0,to=1,length=100)
par(mar=c(5,5,1,1))
plot(s, sapply(s, function(b) sum((means - (1 - b)*y)^2)),
type="l", xlab="possible values for B", ylab="sum squared error")
points(B, sum((means - eb)^2),col="red",pch=16)
legend("top","James-Stein B",col="red",pch=16)
}, sigma.y = slider(1,10))

### Like this:

Like Loading...

*Related*

Hey Mike, there’s certain javascript thingies like http://www.mathjax.org/ that you can use to, on most modern browsers, display LaTeX or MathML trivially if you want!

ah yeah, I was being lazy and forgot that wordpress includes this. I just have to use dollarlatex y_i dollar

Hey Mike, I was look at your Freebase Influence node, any tutorial or guidance on how to actually use that node to find out the list of people influenced & influencedBy. For example, I am looking to find the most influential man in history?

looking*