# NOT RUN {
x <- rGaussian(1000,mu = c(1,1),Sigma = matrix(c(1,0.5,0.5,3),2,2))
obj <- GaussianNIW(gamma=list(m=c(0,0),k=1,v=2,S=diag(2)))
## out1 and out2 it should have the same values:
out1 <- dPosteriorPredictive(obj = obj, x = x,LOG = TRUE)
out2 <- numeric(nrow(x))
for(i in 1:nrow(x))
out2[i] <- marginalLikelihood(obj,x=x[i,,drop=FALSE],LOG = TRUE)
max(abs(out1-out2))
# }
Run the code above in your browser using DataLab