--
##### SOURCE BEGIN #####
%% Bayes factors for simple linear regression
% We reproduce the example on p64 of Marin and Robert, 2007
% This computes logBF(i) = log p(D|X(:,:)) / p(D|X(:,-j)) for each feature j 
% using a g-prior
%%

% This file is from pmtk3.googlecode.com

X = loadData('caterpillar');
% from http://www.ceremade.dauphine.fr/~xian/BCS/caterpillar
y = log(X(:,11)); % log number of nests
X = X(:,1:10);
[n,d] = size(X);
X1 = [ones(n,1), X];

g = 100;
what = X1\y; % MLE
mu = g/(g+1)*what; % pos