Displaying 1 result from an estimated 1 matches for "mcslice1d".
2007 Feb 13
0
Really need help here
...r=1000,beta=-.04,sig=.38,m=10,M=10){
#------------------- Data Generating -------------------------#
G <- rgamma(T,1/nu,1/nu)
J <- rnorm(T,beta*G,sig*sqrt(G))
#------------------- Gibbs Sampler ---------------------------#
nu.stor <- rep(NA,n.iter)
for(i in 1:n.iter){
G <- MCslice1D(dgamma(x,1/nu,1/nu,log=TRUE)+dnorm(J, beta*x, sig*sqrt(x),log=TRUE),w=20,m=10,x0=G)
nu <- MCslice1D(log(dinvgamma(x,m,M))-T*log(x)*1/x-T*log(gamma(1/x))+(1/x-1)*sum(log(G))-sum(G)/x, w=3,m=12, x0=nu)
nu.stor[i] <- nu
}
return(list(nu=nu.stor))
}