Skip to content

Instantly share code, notes, and snippets.

@NoRaincheck
Created November 10, 2016 23:09
Show Gist options
  • Save NoRaincheck/ae8164de20935349629e9f049d0d4cf1 to your computer and use it in GitHub Desktop.
Save NoRaincheck/ae8164de20935349629e9f049d0d4cf1 to your computer and use it in GitHub Desktop.
mu <- 2.5
tau <- 0.5
xn <- rnorm(50, mu, 1/tau)
# test for convergence
library(purrr)
mu_i = 0
alpha = 0.01
for(i in 1:10000000){
mu_i <- mu_i - alpha * (tau *(mu_i - mean(xn)))
print(mu_i)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment