# NOT RUN {
#Example with 5 signals, rest is noise
truth <- c(rep(0, 95), rep(8, 5))
y <- truth + rnorm(100)
(tau.hat <- HS.MMLE(y, 1)) #returns estimate of tau
plot(y, HS.post.mean(y, tau.hat, 1)) #plot estimates against the data
# }
# NOT RUN {
#Example where the data variance is estimated first
truth <- c(rep(0, 950), rep(8, 50))
y <- truth + rnorm(100, mean = 0, sd = sqrt(2))
sigma2.hat <- var(y)
(tau.hat <- HS.MMLE(y, sigma2.hat)) #returns estimate of tau
plot(y, HS.post.mean(y, tau.hat, sigma2.hat)) #plot estimates against the data
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab