################################################################################# # Bayesian model selection and statistical modeling # Chapman & Hall/CRC Taylor and Francis Group # # Bayesian model selection and statistical modeling # Chapman & Hall/CRC Taylor and Francis Group # # Chapter6: Section6.1.1 # # Multinomial probit models # # Author : Tomohiro Ando # ################################################################################ library(MNP) library(MCMCpack) # Dutch voting behavior data data(Nethvote) n <- nrow(Nethvote) fit <- mnp(vote~distPvdA+distVVD+distCDA+income+age, data = Nethvote, p.var = 10000, p.df = 10, n.draws = 101000, burnin = 1000, thin = 100, verbose = TRUE) p <- 3*6 V <- var((fit$param)[,-(p+1)]) A <- diag(10000,p) S <- summary.mnp(fit) M <- as.vector((S$coef)[,1]) LogLike <- (-p/2)*log(2*pi)+(-1/2)*log(det(A))-sum( M%*%solve(A)%*%M )/2 nu <- 10+1 SS <- as.vector((S$cov)[,1]) K <- diag(1,4) K[2,2] <- SS[1] K[2,3] <- K[3,2] <- SS[2] K[2,4] <- K[4,2] <- SS[3] K[3,3] <- SS[4] K[3,4] <- K[4,3] <- SS[5] K[4,4] <- K[4,4] <- SS[6] Prior <- lndIWishart(nu, diag(1,4), K) Margianllikelihood <- LogLike+Prior+p/2*log(2*pi)-log(n)*p/2-log(det(V))/2 print(Margianllikelihood)