# Script for CSC 411 Assignment #3. source("bayesm.r") postscript("ass3.ps",horiz=F,pointsize=9) # Read the data. X = as.matrix(read.table("trnx",head=F)) # Sample the posterior based on the first 15 data items. use = 15 set.seed(11) print (system.time ( post <- sample_posterior(300000, 12, X[1:use,], 3, -1, 1, 0.1, 0.5) )) par (mfrow=c(4,3), mar=c(3.1,3.1,0.5,0.5)) for (w in 1:12) { plot_2D_params (X[1:use,], post[w]) } # Sample the posterior based on all 49 data items. use = nrow(X) set.seed(10) print (system.time ( post <- sample_posterior(300000, 12, X[1:use,], 3, -1, 1, 0.1, 0.5) )) par (mfrow=c(4,3), mar=c(3.1,3.1,0.5,0.5)) for (w in 1:12) { plot_2D_params (X[1:use,], post[w]) } dev.off()