Displaying 1 result from an estimated 1 matches for "tp4472547p4472547".
2012 Mar 14
1
Metropolis-Hastings in R
...n,2)
theta1[1,]<-mu
for(i in 2:n){
theta<-theta1[i-1,]
phi<-theta+runif(-0.5,0.5)
k<-rbinom(1,1,alpha(theta,phi))
k1<-k1+k
theta1[i,]<-theta+k*(phi-theta)
}
plot(theta1)
Thanks alot :)
-Mike
--
View this message in context: http://r.789695.n4.nabble.com/Metropolis-Hastings-in-R-tp4472547p4472547.html
Sent from the R help mailing list archive at Nabble.com.