search for: alpha_sampl

Displaying 1 result from an estimated 1 matches for "alpha_sampl".

Did you mean: alpha_sample
2011 Dec 03
2
density function always evaluating to zero
...;- crossprod(z,y) alpha.ols <- MI * zy resid_m0 <- y - z * alpha.ols s2_m0 <- sum(resid_m0^2)/v # use gibbs sampler to sample from posterior densities n <- length(y) k <- 1 v <- n - k # set up gibbs sampler nrDraws <- 10000 h_sample_m0 <- rgamma(nrDraws, v/2, v*s2_m0/2) alpha_sample <- matrix(0, nrow = nrDraws, ncol = 1) for(i in 1:nrDraws) { alpha_sample[i] <- rnorm(1,alpha.ols,(1/h_sample_m0[i]) * MI) } # define posterior density for model 0 f <- function(alpha,h) { e <- y - alpha * x1^2 const <- (2*pi)^(-n/2) / ( gamma(v/2) * (v*s2_m1/2)^(-v/2)...