%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Data for Tobit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

rand('state',37); % set arbitrary seed for uniform draws
randn('state',37); % set arbitrary seed for normal draws

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% data generation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

n=1000; % number of observations

btrue=[-1 2 0.8]';
X=[ones(n,1) 1.5+2*randn(n,1) 0.5+1.3*randn(n,1)];

sig2true=1.44; %"true" error variance
eps=sqrt(sig2true)*randn(n,1);
ystar=X*btrue+eps;

% min(y)% approx -11
% max(y)% approx 20

y=ystar;
f0=find(ystar<=0);
f1=find(ystar>0);

y(f0)=0;

l0=length(f0);
l1=length(f1);

test=[l0;l1] %make sure we have enough obs's in each bin
% stick with 293 / 707, i.e. close to 30% truncation

save c:\klaus\AAEC6564\mlab\worksp\mod5_tobit_data;
