%THIS FILE SE+TS UP A BASIC ORGANISATION, ICT AND OTHER FACTORS PRODUCTION FUNCTION MODEL %NICK BLOOM, JANUARY 2006 clear; clear global; %Define some key production function parameters markup=0.5; %Markup, which defines retu rns to scale (assume imperfect competition and CRS). Higher markup yields more compact state space alp=1/40; %ICT factor input share assumed at 2.5% cap=0.3; %Physical capital share of output alpha=alp*(1/(1+markup)); cappa=cap*(1/(1+markup)); bet1a=(1-alp-cap)*(1/(1+markup)); lam=1/40; lambda=lam*(1/(1+markup)); %lambda equals alpha allows coefficient on IT to double going from 0 to 1 scale=10; %Coefficient on ICT, Other factors and org complementarity ac=[1 4 2]; scaleac=175; ac=ac*scaleac; anum=size(ac,2);%Quadratic adjustment costs parameter for firm in US, firm in Europe & firm in UK fc=[1/500 1/500 1/500]; %Fixed cost adjustment parameter assumes lose 1/2 weeks of revenue from every adjustment (same as Bloom 2006 figures for capital) pcap=1; wage=1; r=0.1; itdep=0.3; pcdep=0.1; %"PCAP" is price normal capital goods, "Wage" - i.e. cost of labor, discount rate is 10%, itdep the rate of decay of ICT prices and pcdep the rate of decay of physical capital pdrop1=0.15; pdrop2=0.25; %Decay of ICT prices for 2-step decay model %Set up some of the state and control variables onum=40; ostart=0; ofinish=1; oinc=(ofinish-ostart)/(onum-1); o0=(ostart:oinc:ofinish); %Org is 1 state %pnum=40; pstart=log(75); pfinish=log(1*exp(-pdrop*(pnum-1))); pinc=(pfinish-pstart)/(pnum-1); p0=exp([pstart:pinc:pfinish]); %Uniform price decay model pnum=50; tdrop=21; pstart=log(0.065); pfinish=log(exp(pstart)*exp(-pdrop1*(tdrop-1))); pinc=(pfinish-pstart)/(tdrop-1); p01=exp([pstart:pinc:pfinish]); %Two step price decay model pstart=pfinish; pfinish=log(exp(pstart)*exp(-pdrop2*((pnum-tdrop)))); pinc=(pfinish-pstart)/((pnum-tdrop)); p02=exp([pstart:pinc:pfinish]); p0=[p01,p02(2:end)]; %Two step price decay model itcoc=p0(2:end).*(r+ itdep -((p0(2:end)-p0(1:end-1))./(p0(1:end-1)))); itcoc=[itcoc,2*itcoc(end)-itcoc(end-1)]; %Generates the IT costs of capital including interest, depreciation and capital loss pccoc=(r+pcdep); %Physical capit cost-of-capital cnum=150; cstart=reallog(60); cfinish=reallog(125000); cinc=(cfinish-cstart)/(cnum-1); c0=exp(cstart:cinc:cfinish); %Computers - control xnum=14; xstart=reallog(19); xfinish=reallog(25); xinc=(xfinish-xstart)/(xnum-1); x0=exp(xstart:xinc:xfinish); %Physical Capital - control io0=repmat(o0',[1 onum]) - repmat(o0,[onum 1]); %Change in org o0=single(o0);itcoc=single(itcoc);c0=single(c0);x0=single(x0);io0=single(io0); ac=single(ac); %Making everything single precision for speed %DOing this for speed - taking exponentials very slow so want to do first before expand matrices bc0_small=repmat(c0',[1 onum]); bx0_small=repmat(x0',[1 onum]); bo0_small=repmat(o0 ,[cnum 1]); bc0_smalla=bc0_small.^(alpha +lambda.*bo0_small); clear bo0_small bc0_small bo0_small=repmat(o0 ,[xnum 1]); bx0_smalla=bx0_small.^(cappa -lambda.*bo0_small); clear bo0_small bx0_small %Expand matrices to full dimesnion of returns [c,x,d0,0,p] bc0_a=single(permute(repmat(bc0_smalla,[1 1 xnum onum pnum]),[1 3 2 4 5])); bx0_a=single(permute(repmat(bx0_smalla,[1 1 cnum onum pnum]),[3 1 2 4 5])); clear bc0_small bx0_small bo0_small bx0_smalla bc0_smalla; %RETURNS vector - dimesnion of returns [c,x,d0,0,p]. Build up bit by bit to conserve memory %First just sales returns=scale.*bc0_a.*bx0_a; clear bc0_a bx0_a; %RETURNS VECTOR - including adjustment costs as a function of sales returns=repmat(returns,[1 1 1 1 1 anum]); % add in the extra productivity from being a US firm % ustfp=1; % returns=returns.*repmat(permute([1,1,ustfp],[3 4 5 6 1 2]),[cnum xnum onum onum pnum 1]); % for the third adjustment cost state add in a loss factor for not being decentralized to mimic loss from different org as US firm loss=1; returns(:,:,:,:,:,3)=returns(:,:,:,:,:,3) - abs(returns(:,:,:,:,:,3).*(repmat(permute(loss*((o0-1).^2), [4 3 1 2]),[cnum xnum onum 1 pnum 1]))); % quadratic and fixed costs of returns for as=1:anum; returns(:,:,:,:,:,as)=returns(:,:,:,:,:,as).*(1 - permute(repmat(fc(as)*(io0>0),[1,1,cnum,xnum,pnum]),[3 4 1 2 5]) )- permute(repmat(ac(as)*io0.^2,[1,1,cnum,xnum,pnum]),[3 4 1 2 5]); end; %RETURNS vector - dimesnion of returns [c,x,d0,0,p,acost] %Remove cost of physical capital bx0_pc=repmat(pccoc.*x0,[cnum,1,onum,onum,pnum anum]); returns=returns - bx0_pc; clear bx0_pc; %Remove cost of IT capital and wages bc0=repmat(c0',[1,xnum,onum,onum,pnum anum]); bitcoc=permute(repmat(itcoc',[1 cnum xnum onum onum anum]),[2 3 4 5 1 6]); returns=returns- bitcoc.*bc0 - wage; clear bc0 bitcoc; %Some tests - callibrating the size of the fixed and quadratic adjustment cost terms and what the approximate optimal step-size would be: %gap=[1:100]/1000; costs=(1./gap).*(ac(1).*(gap).^2 + fc(1)); close;plot(gap,costs); title('Optimimum gap between values of org given adjustment costs'); %Price transition matrix - falls every period x=[zeros(pnum,1),eye(pnum)]; xx=x(:,1:end-1);xx(end,end)=1;xx(1,1)=1; xx(1,2)=0; trans=xx; clear x xx; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % STAGE 2 - RUNNING THE NUMERICAL CONTRACTION MAPPING (SOLVING THE VALUE MAXIMISATION ITERATION) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% v2=single(ones(onum,pnum,anum)); %Initial guess for value function N=15; %Number of loops - stick with about 50 but can use 20 for experimentation %The key part of the program - the contraction mapping loop for n=1:N; v1=v2; for as=1:anum; v1h(:,:,as)=v1(:,:,as)*trans'; end; %Expectations over the price fall - note this is determininistic but still needs a transiation matrix v2=squeeze(max(max(max(returns+ 1/(1+r).*permute(repmat(v1h,[1 1 1 cnum xnum onum]),[4 5 1 6 2 3]))))); %This is the contraction mapping display([n,N]); %display({'n','Total'}); end; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % STAGE 3:GENERATING OPTIMAL POLICY CORRESPONDENCE DATA (THE OPTIMAL INVESTMENT FUNCTIONS ETC.) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% cstar=zeros(onum,pnum,anum); xstar=cstar; ostar=cstar; ratio=cstar; %Predefine variables for speed final=permute(repmat(v1h,[1 1 1 cnum xnum onum]),[4 5 1 6 2 3]); %Create this matrix - need it for recovering optimal parameters %This set of code then solves for the optimal correspondence for each point in the state space (org,pICT). for os=1:onum; for ps=1:pnum; for as=1:anum; k=1; %sometimes get numerical rounding errors so need to set next line rounded to nearest 1/10000 maxxed=(repmat(v2(os,ps,as),[cnum xnum onum]) == (returns(:,:,:,os,ps,as) + 1/(1+r).*final(:,:,:,os,ps,as))); cstar(os,ps,as)=max(max(max(maxxed.*repmat(c0',[1 xnum onum])))); xstar(os,ps,as)=max(max(max(maxxed.*repmat(x0 ,[cnum 1 onum])))); ostar(os,ps,as)=max(max(max(maxxed.*(permute(repmat(o0',[1 cnum xnum]),[2 3 1]))))); end; end; end; %Some tests - callibrating the size of the fixed and quadratic adjustment cost terms and what the approximate optimal step-size would be: usquad=ac(1)*(o0(2)-o0(1))^2; euquad=ac(2)*(o0(2)-o0(1))^2; avfixed=fc(1)*max(max(max(returns(:,:,:,round(end/2),round(end/2),round(end/2))))); %The matrices are the large ones - once dropped data becomes managable clear final returns maxxed %This traces time path - starts at coc=1 & steady state, then assumes that coc=2 and follows this onwards using org value from last period for as=1:anum; o_count=1; for ps=1:pnum; o_value=ostar(o_count,ps,as); if ps==1; o_value1=o_value; end; if (as==3)&(ps<29); o_value=ostar(o_count,ps,2); end; acosts(ps,as)=ac(as)*(o_value-o_value1)^2; org(ps,as)=o_value; org_count(ps,as)=o_count; computer(ps,as)=cstar(o_count,ps,as); other(ps,as)=xstar(o_count,ps,as); o_count=1+round((o_value-ostart)/oinc); o_value1=o_value; value(ps,as)=v2(o_count,ps,as); output(ps,as)=scale.*cstar(o_count,ps,as)^(alp+lam*o_value)*xstar(o_count,ps,as)^(cap-lam*o_value); revenue(ps,as)=scale.*cstar(o_count,ps,as)^(alpha+lambda*o_value)*xstar(o_count,ps,as)^(cappa-lambda*o_value); % input0(ps,as)=cstar(o_count,ps,as)^(alpha)*xstar(o_count,ps,as)^(1-alp); % input1(ps,as)=cstar(o_count,ps,as)^(alpha+lambda*mean(org(ps,:)))*xstar(o_count,ps,as)^(beta-lambda*mean(org(ps,:))); %Average factor shares changing per year across countries % input2(ps,as)=cstar(o_count,ps,as)^(alpha+lambda*mean(mean(org(25:35,:))))*xstar(o_count,ps,as)^(beta-lambda*mean(mean(org(25:35,:)))); %Average factor share per year 1995-2005 % input3(ps,as)=cstar(o_count,ps,as)^(alpha+lambda*mean(mean(org(max(ps-5,1):ps,as))))*xstar(o_count,ps,as)^(beta-lambda*mean(mean(org(max(ps-5,1):ps,as)))); %Average factor share last 5 years % input4(ps,as)=cstar(o_count,ps,as)^(alpha+lambda*org(ps,as))*xstar(o_count,ps,as)^(beta-lambda*org(ps,as)); %Factor share per year end; end; %prod0=log(output)-log(input0); %Add a constant on here just to make sure always positive %prod1=log(output)-log(input1); %Add a constant on here just to make sure always positive %prod2=log(output)-log(input2); %Add a constant on here just to make sure always positive %prod3=log(output)-log(input3); %Add a constant on here just to make sure always positive %prod4=log(output)-log(input4); %Add a constant on here just to make sure always positive %prod_ac=log(output-acosts)-log(input0); %dprod0=prod0(2:end,:)-prod0(1:end-1,:); %dprod1=prod1(2:end,:)-prod1(1:end-1,:); %dprod2=prod2(2:end,:)-prod2(1:end-1,:); %dprod3=prod3(2:end,:)-prod3(1:end-1,:); %dprod4=prod4(2:end,:)-prod4(1:end-1,:); labprod=log(output); dlabprod=labprod(2:end,:)-labprod(1:end-1,:); dorg=org(2:end,:)-org(1:end-1,:); ratio=computer./other; %IT to physical capital ratio %Generate MA(5) of TFP growth dim=size(dlabprod,1);x59=0.2*(eye(dim)+circshift(eye(dim),-1)+circshift(eye(dim),1)+circshift(eye(dim),-2)+circshift(eye(dim),2)); x59(1,1)=0.6; x59(2,1)=0.4; x59(end,end)=0.6; x59(end-1,end)=0.4;x59(1,end-1)=0;x59(1,end)=0;x59(2,end)=0; x59(end-1,1)=0;x59(end,1)=0;x59(end,2)=0; dim=size(labprod,1);x60=0.2*(eye(dim)+circshift(eye(dim),-1)+circshift(eye(dim),1)+circshift(eye(dim),-2)+circshift(eye(dim),2)); x60(1,1)=0.6; x60(2,1)=0.4; x60(end,end)=0.6; x60(end-1,end)=0.4;x60(1,end-1)=0;x60(1,end)=0;x60(2,end)=0; x60(end-1,1)=0;x60(end,1)=0;x60(end,2)=0; dlabprod_ma=x59*dlabprod; labprod_ma=x60*labprod; costshare=(repmat(itcoc',[1 anum])'.*computer')./(scale*revenue'); costshare_ma=x60*costshare'; dcostshare_ma=x59*(costshare(:,2:end)-costshare(:,1:end-1))'; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % STAGE 4: PLOTTING OUTPUT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% aps=10; %This is the number of periods dropped at the start and end to get rid of fixed price endings ape=10; year=1975; stop; save '/home/nick/ICT/data1' %ICT Prices %close;plot(year+[aps:pnum-ape],log(itcoc(aps+1:end-ape)),'.b'); title('ICT Prices (in logs) - US and EU'); pause %Figure 4 More decentralized at lower ICT prices, and more decentralized with lower adjustment costs close;plot(year+[aps:pnum-ape],org(aps:pnum-ape,1),'-g',year+[aps:pnum-ape],org(aps:pnum-ape,2),'.b'); %Figure 5 Ratio of ICT/Other factors rises over time close;plot(year+[aps:pnum-ape],log(ratio(aps:end-ape,1)),'-g',year+[aps:pnum-ape],log(ratio(aps:end-ape,2)),'.b'); %Figure 6 Lab prod levels close;plot(year+[aps:pnum-ape],labprod_ma(aps:pnum-ape,1),'-g',year+[aps:pnum-ape],labprod_ma(aps:pnum-ape,2),'.b'); %Figure 7 More decentralized at lower ICT prices, and more decentralized with lower adjustment costs close;plot(year+[aps:pnum-ape],org(aps:pnum-ape,1),'-g',year+[aps:pnum-ape],org(aps:pnum-ape,2),'.b',year+[aps:pnum-ape],org(aps:pnum-ape,3),'xr');