%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Fake data for SSVS model - following KPT p. 288
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Set random number generator, start stop watch, open output file
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
rand('state',37); % set arbitrary seed for uniform draws
randn('state',37); % set arbitrary seed for normal draws
% Generate & prepare data
%%%%%%%%%%%%%%%%%%%%%%
% generate data
%%%%%%%%%%%%%%%%%%%%%%%%%
n=1000; % set sample size
% we let our X's be correlated to make it a bit harder for the algorithm to
% detect which variable should be in or out
% This is optional.
Vx=[1 .4 .4 0 .6;
.4 1 .7 0 .3;
.4 .7 1 0 .3;
0 0 0 1 0;
.6 .3 .3 0 1];
ki=size(Vx,1);
int=mvnrnd(zeros(ki,1), Vx, n); %n by k
X=[ones(n,1) int]; %this is what we will use in the model
Xtrue=[ones(n,1), int(:,1:3)]; %this is the true X that builds y
% In our regression, we'll use the full X, but the last two X's should have no influence on y
k=size(X,2);
btrue = [2 .25 -.4 .6]';
sig2true=0.44; %"true" error variance
eps=sqrt(sig2true)*randn(n,1);
y=Xtrue*btrue+eps;
save c:\klaus\AAEC6564\mlab\worksp\mod8_SSVS_data btrue sig2true y X;