% datachar2.m % reads in data and characterizes it. % this version copied from datachar.m 12/02 and modified % this is the current version. Lots of interesting stuff editied out % this version only keeps what goes in the paper. % There are two parts to this program, completely separate. The first % part tracks histories, the second part does returns. close all; clear all; diary off; delete datachar.txt; diary datachar.txt; % ---------------------- % set options % ---------------------- dostockgraph = 0; % graphs of events vs. stock market to identify beta redofig = 0; % overwrites *.fig and *.eps figures. Now, most graphs are saved as .fig, then manually cleaned and saved as eps files % if you overwrite you will lose the manual editing of the fig % file though not the eps. set(0,'DefaultAxesColorOrder',[0 0 0]); % for publication all black. % ------------------------------------ % load data */ % ----------------------------------- load \aaj\offroad\matlab_data\returns.txt; x = returns; %cmpnyn = x(:,1); /* company number */ %indnum = x(:,2); /* industry number */ %segnum = x(:,3); /* segment number */ %rnddat = x(:,4); /* round date */ %raised = x(:,5); /* amount raised */ %postvl = x(:,6); /* value post financing */ %xitdat = x(:,7); /* date of exit, ipo, aquisition, etc. */ %xittyp = x(:,8); /* exit type. 1 = ipo 2=acquisition 3=out of bus % 4 = private 5 = registered ipo, not complete 6 added, new round */ %xitval = x(:,9); /* value after exit */ %rturns = x(:,10);/* gross return */ %flagpct= x(:,11); /* 1 if investors own >100 <0 of firm */ %postipo= x(:,12); /* 1 if a round occurs after ipo */ %ipo60 = x(:,13); /* 1 if ipo occurs within 60 days */ %/* load s&P. this is an index of cumulated return value */ load \aaj\offroad\matlab_data\sp500.txt; z = sp500; spdate = z(:,1) + z(:,2)/12; % /* decimal date. end of month so */ % /* 12/31/97 = 1998. this is ok. */ spind = z(:,3); clear z; disp('total raw rounds before any cleaning'); disp(rows(x)); xr = x; % version of x for round to round calculations % ---------------------------------------- % Do round to round return calculation % adapted from doit3.m % ----------------------------------------- % determine round by seeing if last company is same as this one */ roundno = zeros(rows(x),1); roundno(1) = 1; i = 2; while i <= rows(x); if xr(i,1) == xr(i-1,1); % same company */ roundno(i) = roundno(i-1)+1; if ddate(xr(i,4)) < ddate(xr(i-1,4)); disp('Error: an earlier round appears after a later round. look at x(i) i='); disp(i); end; else; roundno(i) = 1; end; % compute round to round returns if this is a second or higher round if (roundno(i) > 1); % Return to investors of previous round: % (Post(2) value - (2) amount raised) = total value at (2) to all investors of round 1, previous rounds % (Amount raised (1) / Post(1) value) = fraction of firm owned by round 1 investors after round 1 % (Post(2) value - (2) amount raised) * (Amount raised(1) / Post(1) value) = total value at (2) to round 1 investors % (Post(2) value - (2) amount raised) * (Amount raised(1) / Post(1) value) / ((1) amount raised) = gross return to 1 investors % or, more directly % (Post(2) value - (2) amount raised) / Post(1) value = gross return to 1 investors (and all others in that period) if (xr(i,6) >0)&(xr(i,5)>0)&(xr(i-1,6)>0); xr(i-1,10) = (xr(i,6) - xr(i,5))/xr(i-1,6); % Assign round to round return to last round else; xr(i-1,10) = -99; % numbers were wrong, so we know there was another round, but can't do return end; % date of exit for investors of previous round xr(i-1,7) = xr(i,4); % last round's date of exit = this round date % exit type for previous round xr(i-1,8) = 6; % NEW CODE: 6 = there is another round % this REPLACES IPO or other evenual outcome indication % exit value for previous round -- this should not be used, but just in case xr(i-1,9) = xr(i,6); end; i = i+1; end; % ----------------------------------- */ % generic filters and trans3formations */ % copied from doit3. Keep this consistent with doit3 so we're % studying the same sample! % ----------------------------------- */ disp('Cleaning round to ipo/acquisition data'); x(:,10) = x(:,10).*(x(:,8) ~= 3) ; % assign zero return to all out of business rounds */ disp('elminated observations with unknown fate:'); disp(sum(x(:,8)==-99)); x = x(find(x(:,8)~=-99),:); disp('Eliminated observations with >100% or <0% value:'); disp(sum(x(:,11)==1)); x = x(find(x(:,11)~=1),:); % no longer needed. Sim ignores date information less than 6 months old. % disp('Eliminated observations with ipo < 60 days past investment round'); % disp(sum(x(:,13)==1)) % x = x(find(x(:,13)~=1),:); %x = x(:,1:10); used in doit3, but extras are kept below though not used. % disp('Deleting observations with new round < 60 days'); % x = x( (x(:,7)~=-99)&(x(:,4)~=-99)&((ddate(x(:,7))-ddate(x(:,4))) >= 2/12),:); % doit3 only does this for stockind > 0. Here, do it always as that % is the base case. disp('Eliminated observations with missing round date'); disp(sum(x(:,4)==-99)); x = x(find(x(:,4)~=-99),:); disp('Eliminating observations that start '); disp(' in second quarter 2000. Need one quarter lag for probability:'); disp(sum(ddate(x(:,4)) >= 2000.25)); x = x(ddate(x(:,4)) < 2000.25,:); disp('If out date is before begin date, treat out date as missing. This affects'); indx = find((x(:,7) ~=-99) & (ddate(x(:,7)) < ddate(x(:,4)))); disp(rows(indx)); x(indx,:)=[x(indx,(1:6)) -99*ones(rows(indx),1) x(indx,8:end)]; disp('Remaining data:'); disp(rows(x)); disp('Cleaning round to round data'); xr(:,10) = xr(:,10).*(xr(:,8) ~= 3) ; % assign zero return to all out of business rounds */ disp('elminated observations with unknown fate:'); disp(sum(xr(:,8)==-99)); xr = xr(find(xr(:,8)~=-99),:); disp('Eliminated observations with >100% or <0% value'); disp(sum(xr(:,11)==1)); xr = xr(find(xr(:,11)~=1),:); % disp('Eliminated observations with ipo < 60 days past investment round'); % disp(sum(xr(:,13)==1)) % xr = xr(find(xr(:,13)~=1),:); % %x = x(:,1:10); used in doit3, but extras are kept below though not used. % % disp('Checking deletion of no observations with new round < 60 days'); % xr = xr( (xr(:,7)~=-99)&(xr(:,4)~=-99)&((ddate(xr(:,7))-ddate(xr(:,4))) >= 2/12),:); disp('Eliminated observations with missing round date'); disp(sum(xr(:,4)==-99)); xr = xr(find(xr(:,4)~=-99),:); disp('Eliminating observations that start '); disp(' in second quarter 2000. Need one quarter lag for probability.'); disp(sum(ddate(xr(:,4)) >= 2000.25)); xr = xr(ddate(xr(:,4)) < 2000.25,:); disp('If out date is before begin date, treat out date as missing. This affects'); indx = find((xr(:,7) ~=-99) & (ddate(xr(:,7)) < ddate(xr(:,4)))); disp(rows(indx)); xr(indx,:)=[xr(indx,(1:6)) -99*ones(rows(indx),1) xr(indx,8:end)]; disp('Remaining data: '); disp(rows(xr)); % ------------------------------------------- % do graphs of events vs. stock market for % stylized facts of beta % ----------------------------------------- if dostockgraph; % create stock return series */ begindx = find(spdate == 1987); endindx = find(spdate == 2000.5); dates = (begindx:12*0.25:endindx)'; logspret = log(spind(dates(2:end))./spind(dates(1:end-1))); % note spind is monthly and lasts longer mas = 4; % smoothing for stocks, in quarters 8 = 2 years, etc. bigdates = (begindx-(mas-1)*12/4:12*0.25:endindx)'; lagspret = log(spind(bigdates(1+mas:end))./spind(bigdates(1:end-mas))); % the first element of logspret is now the return from dec 31 87 to % march 31 87, etc. This has only been checked for _h=0.25, quarterly! % testsp.prg checks it against the crsp return. */ load \aaj\offroad\matlab_data\tb3ms.txt; z = tb3ms; tbdat = floor(z(:,1)); %/* convert from e.g. 1987.02 to 1987+1/12 */ tbdat = tbdat + ((z(:,1)-tbdat)*100-1)/12; tbrat = z(:,2); clear z; indxs = (1:3:size(tbrat,1))'; indxs = indxs(indxs=1987+(t-1)/4) & (ddate(x(:,7))<1987+t/4 )& (x(:,7)~=-99) & (x(:,4) ~=-99)); % projects that IPO in last qtr numstart(t) = sum( (ddate(x(:,4))>=1987+(t-1)/4) & (ddate(x(:,4))<=1987+t/4)& (x(:,4)~=-99) & (x(:,4) ~=-99)); numacq(t) = sum( (x(:,8)==2) & (ddate(x(:,7))>=1987+(t-1)/4) & (ddate(x(:,7))<1987+t/4) & (x(:,7)~=-99) & (x(:,4) ~=-99)); numout(t) = sum( (x(:,8)==3) & (ddate(x(:,7))>=1987+(t-1)/4) & (ddate(x(:,7))<1987+t/4) & (x(:,7)~=-99) & (x(:,4) ~=-99)); numnewrnd(t) =sum((x(:,8)==6)& (ddate(x(:,7))>=1987+(t-1)/4) & (ddate(x(:,7))<1987+t/4) & (x(:,7)~=-99) & (x(:,4) ~=-99)); %xittyp = x(:,8); /* exit type. 1 = ipo 2=acquisition 3=out of bus % 4 = private 5 = registered ipo, not complete 6: new round*/ t = t+1; end; numleft = numacq+numout+numip; spindsm = spind(dates(2:end)); % cut to present sample xtrend = [ones(size(spindsm,1),1) (1:size(spindsm,1))']; trend = xtrend*(xtrend\log(spindsm)); spdet = log(spindsm)-trend; figure; px = (1987.25:0.25:2000.5)'; subplot(2,2,1); plot(px(1:53),numstart(1:53),'-',px(1:53),400+1000*lagspret(1:53)); axis([1987 2001 -inf inf]); % legend('started','left'); % title('number started, left'); subplot(2,2,2) plot(px,numip,px(1:53),100+300*lagspret(1:53)); axis([1987 2001 -inf inf]); title('number IPO'); subplot(2,2,3); plot(px,numacq,px(1:53),100+300*lagspret(1:53)); title('number acquired'); axis([1987 2001 -inf inf]); subplot(2,2,4); plot(px,numout,px(1:53),100+300*lagspret(1:53)); title('number out of business'); axis([1987 2001 -inf inf]); % ------------------- % history of age categories still private % ------------------------- t = 1; while t <= 54; num1yr(t) = sum( (ddate(x(:,4))>=1987+(t-4)/4) & (ddate(x(:,4))<=1987+t/4) & ... ( ((ddate(x(:,7)) >= 1987+t/4) & (x(:,7)~=-99)) | (x(:,8)==4) | (x(:,8)==5) ) & (x(:,4)~=-99) ); num2yr(t) = sum( (ddate(x(:,4))>=1987+(t-8)/4) & (ddate(x(:,4))<=1987+t/4) & ... ( ((ddate(x(:,7)) >= 1987+t/4) & (x(:,7)~=-99)) | (x(:,8)==4) | (x(:,8)==5) ) & (x(:,4)~=-99) ); num3yr(t) = sum( (ddate(x(:,4))>=1987+(t-12)/4) & (ddate(x(:,4))<=1987+t/4) & ... ( ((ddate(x(:,7)) >= 1987+t/4) & (x(:,7)~=-99)) | (x(:,8)==4) | (x(:,8)==5) ) & (x(:,4)~=-99) ); num4yr(t) = sum( (ddate(x(:,4))>=1987+(t-16)/4) & (ddate(x(:,4))<=1987+t/4) & ... ( ((ddate(x(:,7)) >= 1987+t/4) & (x(:,7)~=-99)) | (x(:,8)==4) | (x(:,8)==5) ) & (x(:,4)~=-99) ); num5yr(t) = sum( (ddate(x(:,4))>=1987+(t-20)/4) & (ddate(x(:,4))<=1987+t/4) & ... ( ((ddate(x(:,7)) >= 1987+t/4) & (x(:,7)~=-99)) | (x(:,8)==4) | (x(:,8)==5) ) & (x(:,4)~=-99) ); t = t+1; end; figure; plot(px,[num1yr' num2yr' num3yr' num4yr' num5yr']); title('number of still private projects started in last 1-5 years') ; %/* --------------------------------------- */ %/* Hazard rate as function of stock market */ %/* ----------------------------------------*/ fracip = zeros(54,1); fracreg = zeros(54,1); fracacq = zeros(54,1); fracout = zeros(54,1); fracstillpriv = zeros(54,1); fracnewrnd = zeros(54,1); %/* initialize fraction ipo and acquire in ea qtr */ denom1 = zeros(54,1); t = 2; while t <= size(fracip,1); fracip(t) = sum( (x(:,4)~=-99) & (x(:,8)==1) & (ddate(x(:,7))>=1987+(t-1)/4) & (ddate(x(:,7))<1987+t/4) & ((x(:,7))~=-99)); % projects that IPO in last qtr denom1(t) = sum( (x(:,4)~=-99) & (ddate(x(:,4))<=1987+(t-1)/4) & ... (( (ddate(x(:,7))~=-99) & (ddate(x(:,7)>=1987+(t-1)/4) ) ) | (x(:,8)==4) ) ...% either out later or still priv ); % projects still priv in qtr-1 fracacq(t) = sum( (x(:,4)~=-99) & (x(:,8)==2) & (ddate(x(:,7))>=1987+(t-1)/4) & (ddate(x(:,7))<1987+t/4) & ((x(:,7))~=-99)); fracout(t) = sum( (x(:,4)~=-99) & (x(:,8)==3) & (ddate(x(:,7))>=1987+(t-1)/4) & (ddate(x(:,7))<1987+t/4) & ((x(:,7))~=-99)); fracstillpriv(t) = sum((x(:,8)==4)&(ddate(x(:,7))>=1987+(t-1)/4) & (ddate(x(:,7))<1987+t/4) & ((x(:,7))~=-99)); % note registered for IPO all have -99 date x(:,7), so do not show fracnewrnd(t) = sum((x(:,8)==6)&(ddate(x(:,7))>=1987+(t-1)/4) & (ddate(x(:,7))<1987+t/4) & ((x(:,7))~=-99)); %xittyp = x(:,8); /* exit type. 1 = ipo 2=acquisition 3=out of bus % 4 = private 5 = registered ipo, not complete 6: new round*/ indx = find( (x(:,4)~=-99) & (x(:,8)==1) & (ddate(x(:,7))>=1987+(t-1)/4) & (ddate(x(:,7))<1987+t/4) & ((x(:,7))~=-99) & x(:,10)>0 ) ; if size(indx,1) > 3; avretip(t) = mean(log(x(indx,10))); % a few early have none, and one has a single observation with log r = -5.4 else; avretip(t) = NaN; end; indx = find( (x(:,4)~=-99) & (x(:,8)==2) & (ddate(x(:,7))>=1987+(t-1)/4) & (ddate(x(:,7))<1987+t/4) & ((x(:,7))~=-99) & x(:,10)>0 ) ; if size(indx,1) > 3; avretaq(t) = mean(log(x(indx,10))); % a few early have none, and one has a single observation with log r = -5.4 else; avretaq(t) = NaN; end; t = t+1; end; %/* graph ipo, acquired and out decisions as functions of stock return */ T = rows(logspret); ma =2; % 4; % smoothing for fractions, in quarters. 4 = 1 year, etc. 0 = no smoothing px = (1987.5:0.25:2000.5)'; py = [ 100*fracip(2:rows(fracip))./denom1(2:rows(denom1))... 100*fracacq(2:rows(fracacq))./denom1(2:rows(denom1))... 100*fracout(2:rows(fracacq))./denom1(2:rows(denom1))]; if ma>0; % note SUMS not moving averages -- divide by ma if you want m.a. py(:,1:3) = filter(ones(ma,1),1,py(:,1:3)); avretip = filter(ones(ma,1),1,avretip); avretaq = filter(ones(ma,1),1,avretaq); end; py(:,4) = lagspret(2:end); figure; plot(px, 5*(4*py(:,1)/ma)+75,'-v',px,50*(avretip(2:end)/ma-1)+50,px,100*py(:,4)); axis([1987 2000 -inf inf]); set(gca,'Ytick',-0:25:125); % edit and save by hand to ipoands.eps; this is IPO figure; plot(px, 5*(4*py(:,2)/ma)+60,'-v',px, 50*(avretaq(2:end)/ma)+20,px,100*py(:,4)); axis([1987 2000 -inf 90]); % title('Acquired'); edit and save by hand to acquands.eps figure; plot(px,5*(4*py(:,3)/ma)+50,'-v',px, 100*py(:,4),'-'); axis([1987 2000 -inf inf]); %title('Out of bus.'); % The huge wave of IPOs in the late 90s is masked because of the huge number of projects started % Same but for round to round sample fracip = zeros(54,1); fracreg = zeros(54,1); fracacq = zeros(54,1); fracout = zeros(54,1); fracstillpriv = zeros(54,1); fracnewrnd = zeros(54,1); %/* initialize fraction ipo and acquire in ea qtr */ denom1 = zeros(54,1); t = 2; while t <= size(fracip,1); fracnewrnd(t) = sum( (xr(:,4)~=-99) & (xr(:,8)==6) & (ddate(xr(:,7))>=1987+(t-1)/4) & (ddate(xr(:,7))<1987+t/4) & ((xr(:,7))~=-99)); % projects that get new round last qtr fracip(t) = sum( (xr(:,4)~=-99) & (xr(:,8)==1) & (ddate(xr(:,7))>=1987+(t-1)/4) & (ddate(xr(:,7))<1987+t/4) & ((xr(:,7))~=-99)); % projects that IPO in last qtr denom1(t) = sum( (xr(:,4)~=-99) & (ddate(xr(:,4))<=1987+(t-1)/4) & ... (( (ddate(xr(:,7))~=-99) & (ddate(xr(:,7)>=1987+(t-1)/4) ) ) | (xr(:,8)==4) ) ...% either out later or still priv ); % projects still priv in qtr-1 fracacq(t) = sum( (xr(:,4)~=-99) & (xr(:,8)==2) & (ddate(xr(:,7))>=1987+(t-1)/4) & (ddate(xr(:,7))<1987+t/4) & ((xr(:,7))~=-99)); fracout(t) = sum( (xr(:,4)~=-99) & (xr(:,8)==3) & (ddate(xr(:,7))>=1987+(t-1)/4) & (ddate(xr(:,7))<1987+t/4) & ((xr(:,7))~=-99)); fracstillpriv(t) = sum((xr(:,8)==4)&(ddate(xr(:,7))>=1987+(t-1)/4) & (ddate(xr(:,7))<1987+t/4) & ((xr(:,7))~=-99)); % note registered for IPO all have -99 date xr(:,7), so do not show fracnewrnd(t) = sum((xr(:,8)==6)&(ddate(xr(:,7))>=1987+(t-1)/4) & (ddate(xr(:,7))<1987+t/4) & ((xr(:,7))~=-99)); %xrittyp = xr(:,8); /* exit type. 1 = ipo 2=acquisition 3=out of bus % 4 = private 5 = registered ipo, not complete 6: new round*/ indx = find( (xr(:,4)~=-99) & (xr(:,8)==6) & (ddate(xr(:,7))>=1987+(t-1)/4) & (ddate(xr(:,7))<1987+t/4) & ((xr(:,7))~=-99) & xr(:,10)>0 ) ; if size(indx,1) > 3; avretnewrnd(t) = mean(log(xr(indx,10))); % a few early have none, and one has a single observation with log r = -5.4 else; avretip(t) = NaN; end; t = t+1; end; %/* graph ipo, acquired and out decisions as functions of stock return */ T = rows(logspret); ma =2; % 4; % smoothing for fractions, in quarters. 4 = 1 year, etc. 0 = no smoothing px = (1987.5:0.25:2000.5)'; py = [ 100*fracnewrnd(2:rows(fracnewrnd))./denom1(2:rows(denom1))]; if ma>0; % note SUMS not moving averages -- divide by ma if you want m.a. py = filter(ones(ma,1),1,py); avretnewrnd = filter(ones(ma,1),1,avretnewrnd); end; py(:,2) = lagspret(2:end); figure; plot(px, 5*(4*py(:,1)/ma)+50,'-v',px,100*(avretnewrnd(2:end)/ma)+25,px,100*py(:,2)); axis([1987 2000 -inf inf]); set(gca,'Ytick',-0:25:225); % edit and save by hand to newrndands.eps; this is IPO end; % ends dostockgraph % ------------------------------------ %/* graph cumulative outs over time */ % ------------------------------------ figure; %xittyp = x(:,8); /* exit type. 1 = ipo 2=acquisition 3=out of bus % 4 = private 5 = registered ipo, not complete 6: new round*/ dtes = x(:,7); dtes = dtes((x(:,8)==3)&(x(:,7)~=-99)); dtes = ddate(dtes); dtes = sort(dtes); dtesip = x(:,7); dtesip = dtesip((x(:,8)==1)&(x(:,7)~=-99)); dtesip = ddate(dtesip); dtesip = sort(dtesip); plot(dtes, (1:size(dtes,1))'/size(dtes,1)*100,... dtesip, (1:size(dtesip,1))'/size(dtesip,1)*100); legend('Out of business','Ipo'); if redofig; print -depsc2 outhist.eps; end; %/* -------------------------------- */ %%/* basic numbers in each categories */ %/* -------------------------------- */ format bank; format compact; disp('Table 1. '); disp('Panel A. Basic statistics -- ipo/acq sample and round to round sample'); totrec = rows(x); totrecr = rows(xr); disp(' Total number of financing rounds '); disp( [totrec totrecr]); disp(' Number of companies'); disp([x(totrec,1) xr(totrecr,1)] ); disp(' Average number of rounds '); disp([ totrec/x(totrec,1) totrecr/xr(totrecr,1)]); disp(' Percent of rounds with return '); disp([100*sum(x(:,10) ~= -99)/totrec 100*sum(xr(:,10) ~= -99)/totrecr]); disp(' Total money raised ($M)'); disp( [sum(x(:,5) .* (x(:,5) > -99)) sum(x(:,5) .* (x(:,5) > -99))]); disp('Panel B. Percent of rounds in various exit categories '); table = zeros(6,3); tabler = table; i = 1; while i <= rows(table); table(i,1) = 100*sum((x(:,8) == i) & (x(:,10) ~= -99))/totrec; table(i,2) = 100*sum((x(:,8) == i) & (x(:,10) == -99))/totrec; table(i,3) = 100*sum((x(:,8) == i))/totrec; tabler(i,1) = 100*sum((xr(:,8) == i) & (xr(:,10) ~= -99))/totrecr; tabler(i,2) = 100*sum((xr(:,8) == i) & (xr(:,10) == -99))/totrecr; tabler(i,3) = 100*sum((xr(:,8) == i))/totrecr; i = i+1; end; % rows labels catlbl1 =... [' ipo '; ' acquisition '; 'out of business '; 'remains private '; ' ipo registered '; ' new round ']; % column headings catlbl2 = [' return '; ' no ret.'; ' total ']; disp('ipo and acaquire sample'); texprint(table,' %6.1f ',catlbl2,catlbl1); disp('round to round sample'); texprint(tabler,' %6.1f ',catlbl2,catlbl1); disp('Percentage of rounds in each exit category. No further selection.'); disp('Total number of rounds: '); disp([ totrec totrecr]); disp('Panel C. Percent of raised money in various exit categories '); table = zeros(6,4); for i = 1:size(table,1); table(i,1) = 100*sum(x(:,5) .*... ((x(:,8) == i) & (x(:,10) ~= -99) & (x(:,5) ~= -99)))/... sum(x(:,5).*(x(:,5) ~= -99)); table(i,2) = 100*sum(x(:,5) .*... ((x(:,8) == i) & (x(:,10) == -99) & (x(:,5) ~= -99)))/... sum(x(:,5).*(x(:,5) ~= -99)); table(i,3) = 100*sum(x(:,5) .*... ((x(:,8) == i) & (x(:,5) ~= -99)))/... sum(x(:,5).*(x(:,5) ~= -99)); table(i,4) = 100*sum( ((x(:,8) == i) & (x(:,5) ~= -99)))/... sum((x(:,5) ~= -99)); end; % column labels catlbl2 = [' return '; ' no ret.'; ' total '; ' unweight ' ]; texprint(table,' %6.1f ',catlbl2,catlbl1); disp('Percentage of rounds in each exit category. Rounds must have valid amount'); disp('raised. Unweighted gives total number in each category that have a valid '); disp('amount raised. Total number of rounds: '); disp(sum(x(:,5) ~= -99)); %/* ------------------------------ */ %/* various states by date and age */ %/* ------------------------------ */ xs = x; xsr = xr; % saved for later disp('********************** '); disp('Doing various states by date and age'); disp('round to round sample'); outcomeproc; % script to do computations figure; plot(px1,100*py1); %/*Title("Outcome history");*/ xlabel('Years since investment'); ylabel('Percentage'); % legend('Out of business','IPO or acquired','Still private',0); axis([0 10 0 100]); text(7,70,'IPO or acquired'); text(2.5,85,'Still going'); text(1,5,'Out of business'); % if redofig; % print -depsc2 f1.eps; % end; px1ip = px1; py1ip = py1; % save to merge graphs below. figure; %/*Title("Outcome history -- dated subsamples");*/ plot(px1,100*py1,px1a,100*py1a,px3,100*py3,px4,100*py4,px5,100*py5); xlabel('Years since investment'); ylabel('Percentage'); %legend('Out of business','IPO or acquired','Still private',0); axis([0 10 0 100]); text(7,75,'IPO or acquired'); text(2.1,90,'Still going'); text(4,15,'Out of business'); % if redofig; % print -depsc2 f2.eps; % end; x = xr; disp(' '); disp('round to ipo/acq sample'); outcomeproc; save histories px1 py1 px1ip py1ip; % send to graphit figure; indxs = (12:12:size(px1ip,1))'; plot(px1,100*py1,'--',px1ip,100*py1ip,'-',px1ip(indxs),100*py1ip(indxs,:),'v'); %/*Title("Outcome history");*/ xlabel('Years since investment'); ylabel('Percentage'); axis([0 8 0 100]); % text(2,87,'IPO, acquired, or new round'); % text(2.1,30,'Still going'); % text(1,5,'Out of business'); % if redofig; % print -depsc2 f1rnd.eps; % end; % save by hand as f1.eps figure; %/*Title("Outcome history -- dated subsamples");*/ plot(px1,100*py1,px1a,100*py1a,px3,100*py3,px4,100*py4,px5,100*py5); xlabel('Years since investment'); ylabel('Percentage'); axis([0 5 0 100]); %legend('Out of business','IPO, acquired or new round','Still going',0); text(2,87,'IPO, acquired, or new round'); text(3,30,'Still going'); text(1,5,'Out of business'); % if redofig; % print -depsc2 f2rnd.eps; % end; x = xs; xr = xsr; clear xs xsr; %/* --------------------- */ %/* Characterize Returns */ %/* --------------------- */ disp(' ************************'); disp('Table 2. Returns'); xs = x; % save xrs = xr; % special run for histogram that compares normal distribution if 1; breaks = [0 100]; timbrk = [0 100]; % /* time bins in years for graphs */ szl = [0.2]; sz = [ 0.25]; % window widt for levels histogram rettbl; px1b = (lnrgrid); py1b = lpvals(:,1)./sum(lpvals(:,1))'; norm = exp(-1/2*(lnrgrid-ml(1)).^2.0./sl(1).^2); norm = norm./sum(norm); px1b_a = px1b; py1b_a=py1b; figure; % title("Smoothed histogram of log returns"); subplot(2,1,1); plot(100*px1b,py1b,'-',100*px1b,norm,'--'); xlabel('100 \times log return'); axis([-500 600 -inf inf]); %if redofig; % print -depsc2 f7.eps; %end; pxlev = rgrid; pylev = pvals(:,1)./sum(pvals(:,1))'; normlev = exp(-1/2*(log(rgrid(2:end))-ml(1)).^2.0./sl(1).^2)./rgrid(2:end); % y = e^x; dy = y dx; f(y) = f(x)/(dy/dx) normlev = normlev./sum(normlev); subplot(2,1,2); plot(100*(pxlev-1),pylev,'-',100*(pxlev(2:end)-1),normlev,'--'); axis([-100 2000 -inf inf]); xlabel('Percent arithmetic return'); stop; end; % ********************* breaks = [0 100; % time bins for tables. 0 1/2; 1/2 1; 1 2; 2 3; 3 4; 4 5; 5 100]; timbrk = [0 100; % /* time bins in years for graphs */ 0.0 1.0; 1.0 3.0; 3.0 5.0; 5.0 100]; szl = [0.35; 0.35; 0.35; 0.35; 0.6];% window width for log return histogram -- conforms to timbrk sz = [ 0.25; 0.5; 0.5; 0.5; 0.5]; % window widt for levels histogram disp('************** Case 1: all rounds that eventually end in ipo and acquisitions'); rettbl; px1b = (lnrgrid); py1b = lpvals(:,1)./sum(lpvals(:,1))'; norm = exp(-1/2*(lnrgrid-ml(1)).^2.0./sl(1).^2); norm = norm./sum(norm); px1b_a = px1b; py1b_a=py1b; figure; % title("Smoothed histogram of log returns -- age categories"); plot(100*lnrgrid,lpvals(:,2:end)./(ones(size(lpvals,1),1)*sum(lpvals(:,2:end)))); axis([-400 500 0 inf]); set(gca,'Ytick',[]); legend('0-1','1-3','3-5','5+'); % text(200,0.04,'0-1'); % text(200,0.035,'1-3'); % text(200,0.03,'3-5'); % text(200,0.025,'5+'); % if redofig; % saveas(gca,'f9.fig'); % % print -depsc2 f9.eps; % end; disp('************** Case 2: all rounds that eventually end in IPOs'); x = xs(xs(:,8)==1,:); rettbl; px1b = (lnrgrid); py1b = lpvals(:,1)./sum(lpvals(:,1))'; norm = exp(-1/2*(lnrgrid-ml(1)).^2.0./sl(1).^2); norm = norm./sum(norm); px1b_b = px1b; py1b_b=py1b; disp('************** Case 3: all rounds that eventually end in acquisitions'); x = xs(xs(:,8)==2,:); rettbl; px1b = (lnrgrid); py1b = lpvals(:,1)./sum(lpvals(:,1))'; norm = exp(-1/2*(lnrgrid-ml(1)).^2.0./sl(1).^2); norm = norm./sum(norm); px1b_c = px1b; py1b_c=py1b; disp('************** Case 4: rounds that end in IPO, Acq, and new rounds'); x = xrs; rettbl; px1b = (lnrgrid); py1b = lpvals(:,1)./sum(lpvals(:,1))'; norm = exp(-1/2*(lnrgrid-ml(1)).^2.0./sl(1).^2); norm = norm./sum(norm); px1b_d = px1b; py1b_d=py1b; if 0; figure; plot(100*px1b,[py1b norm]); if redofig; print -depsc2 f7rnd.eps; end; end; figure; % title("Smoothed histogram of log returns -- age categories"); plot(100*lnrgrid,lpvals(:,2:end)./(ones(size(lpvals,1),1)*sum(lpvals(:,2:end)))); axis([-400 500 0 inf]); set(gca,'Ytick',[]); legend('0-1','1-3','3-5','5+'); %text(200,0.04,'0-1'); %text(200,0.035,'1-3'); %text(200,0.03,'3-5'); %text(200,0.025,'5+'); % if redofig; % saveas(gca,'f9nrd.fig'); % % print -depsc2 f9rnd.eps; % end; disp('************** Case 5: rounds that end in another round'); x = xrs(xrs(:,8)==6,:); rettbl; px1b = (lnrgrid); py1b = lpvals(:,1)./sum(lpvals(:,1))'; norm = exp(-1/2*(lnrgrid-ml(1)).^2.0./sl(1).^2); norm = norm./sum(norm); px1b_e = px1b; py1b_e=py1b; disp('************** Case 6: rounds that end in ipo directly'); x = xrs(xrs(:,8)==1,:); rettbl; px1b = (lnrgrid); py1b = lpvals(:,1)./sum(lpvals(:,1))'; norm = exp(-1/2*(lnrgrid-ml(1)).^2.0./sl(1).^2); norm = norm./sum(norm); px1b_f = px1b; py1b_f=py1b; disp('************** Case 7: rounds that end in acquisition directly'); x = xrs(xrs(:,8)==2,:); rettbl; px1b = (lnrgrid); py1b = lpvals(:,1)./sum(lpvals(:,1))'; norm = exp(-1/2*(lnrgrid-ml(1)).^2.0./sl(1).^2); norm = norm./sum(norm); px1b_g = px1b; py1b_g=py1b; figure; plot(100*px1b_a,py1b_a,... 100*px1b_b,py1b_b,... 100*px1b_c,py1b_c,... 100*px1b_d,py1b_d,... 100*px1b_e,py1b_e,... 100*px1b_f,py1b_f,... 100*px1b_g,py1b_g); legend('eventual ipo or acq','eventual ipo','evantual acq','ipo,acq,round','round','ipo','acquisition',0); axis([-400 500 0 inf]); figure; plot(100*px1b_e,py1b_e,... 100*px1b_f,py1b_f,... 100*px1b_g,py1b_g); legend('New round','IPO','Acquired',0); axis([-400 500 0 inf]); if redofig; saveas(gca,'f7all.fig'); % print -depsc2 f7all.eps; end; diary off;