Displaying 1 result from an estimated 1 matches for "s2_m1".
Did you mean:
s2_f1
2011 Dec 03
2
density function always evaluating to zero
...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) )
kernel <- h^((v-1)/2) * exp((-(h/2) * sum(e^2)) - (v*s2_m0)*h)
x <- const * kernel
return(x)
}
# calculate approximation of p(y|m_0)
m0 <-f(alpha_sample,h_sample_m0)
post_m0 <- sum(m0) / nrDraws
--
View this message in context: http://r.789695.n4.nabble.com/densit...