/* Absorptv.GAU: Calculates and draws 3D charts for the closed-economy model of R&D with absorptive capacity, over a grid of values of beta and delta. This version calculates both the Martin and Kamien-Zang AC specifications: to determine which is calculated, the procs thetanow and betanow must be amended. NFIGS=1: Page 1: Fig. 1: (i) Full Effectiveness of R&D; (ii) Effective Spillover Parameter NFIGS=2: Page 2: Fig. 2: Welfare without and With Cooperation (3 panels) NFIGS=3: Page 3: Fig. 3: Welfare Gains from Full Information Sharing */ /*************************************************************************/ library pgraph; /*************************************************************************/ /* USER-SPECIFIED ECONOMIC PARAMETERS */ nn=2; /* number of firms; N.B. NOT "n"! */ eta=0.4; /* effectiveness of R&D; N.B. Really eta-tilde: i.e., (theta-tilde)^2/(b.gamma) */ /*************************************************************************/ /* USER-SPECIFIED VARIABLES WHICH CONTROL OPERATION OF PROGRAM */ NFIGS=2; /* Print: =1: Figs. 1; =2: Fig. 2; =3: Fig. 3 */ stepsizB=.025; /* stepsize in "bbeta" (i.e., beta) loops */ stepsize=stepsizB; /* stepsize in delta loops */ m=1+1/stepsize; /* m: number of values of delta */ n=1+1/stepsizB; /* n=number of values of bbeta */ /*************************************************************************/ /* INITIALISE VECTORS */ bbetat=zeros(n,1); /* In final version, this is the "beta" vector */ delta=zeros(1,m); /* Careful: a row vector; this can be confusing */ theta=zeros(n,m); bbeta=zeros(n,m); /* In final version, this is the "beta-tilde" vector */ xxi=zeros(n,m); WO=zeros(n,m); /* Welfare in social optimum */ WN=zeros(n,m); /* Welfare with no cooperation */ WC=zeros(n,m); /* Welfare with cooperation */ WCIS=zeros(n,m); /* Welfare with cooperation and full information sharing (beta~=1)*/ x = .5; /* Output of each firm: only needed for Martin variant */ /*************************************************************************/ /* BEGIN i - beta DO LOOP */ i=1; b=0; WN0 = nn*(nn+2-eta*(4/3)^2)/(nn+1-eta*(4/3))^2; /* WN with beta=delta=0 */ /* Welfare levels NOT normalised by values at beta=delta=0. */ DO until i>n; bbetat[i,1]=b; /*************************************************************************/ /* BEGIN j - delta DO LOOP */ j=1; d=0; DO until j>m; delta[1,j]=d; /*************************************************************************/ /* Preliminary: Calculate some parameters which are common to all games */ theta[i,j]=thetanow; proc thetanow; /* Full effectiveness of R&D [In final version: theta-tilde / theta ] */ retp( 1+b*d*(1-d)*(nn-1)^(1-d) ); /* Kamien-Zang specification */ if d==0; retp( 1 ); endif; retp( 1 - b*(nn-1)*x*ln(d) / (1-x*ln(d))^2 ); /* Martin specification */ endp; bbeta[i,j]= betanow; proc betanow; /* In final version: beta with tilde */ retp( b*(1-d)^2*(nn-1)^(-d)/(1+b*d*(1-d)*(nn-1)^(1-d)) ); /* Kamien-Zang specification */ if d==0; retp( b ); endif; retp( - (b*x*ln(d)/(1-x*ln(d))) / ( 1 - b*(nn-1)*x*ln(d) / (1-x*ln(d))^2 ) ); /* Martin specification */ endp; xi=1+b*(1-d)*(nn-1)^(1-d); /* Marginal social return to R&D */ /* xi could alternatively be calculated as: (1+bbeta[i,j]*(nn-1)) * theta[i,j] */ xxi[i,j]=xi; /*************************************************************************/ /* CASE 1: COMPUTE WELFARE IN CASE N: NO COOPERATION ON R&D */ muN=1+(nn-1)*(2/(nn+1))*(0.5-bbeta[i,j]); /* marginal return to R&D in Game N */ WN[i,j] = nn*(nn+2-eta*muN^2)/((nn+1-eta*muN*xi)^2); /*************************************************************************/ /* CASE 2: COMPUTE WELFARE IN CASE O: SOCIAL OPTIMUM */ WO[i,j] = nn/(nn-eta*xi^2); /*************************************************************************/ /* CASE 3: COMPUTE WELFARE IN CASE C: COOPERATION ON R&D*/ muC=(2/(nn+1))*xi; /* marginal return to R&D in Game C */ WC[i,j] = nn*(nn+2-eta*muC^2)/((nn+1-eta*muC*xi)^2); /* Identical to WN except different mu */ /*************************************************************************/ /* CASE 4: COMPUTE WELFARE IN CASE I: COOP. + FULL INFO. SHARING (i.e., irrespective of the value of beta~ in this round, set it =1 in calculating mu and W )*/ xiIS=1+(1-d)*(nn-1)^(1-d); /* Marginal social return to R&D with full info. sharing */ muCIS=(2/(nn+1))*xiIS; /* marginal return to R&D in Game CIS */ WCIS[i,j] = nn*(nn+2-eta*muCIS^2)/((nn+1-eta*muCIS*xiIS)^2); /* Identical to WN except different mu */ /*************************************************************************/ j=j+1; /* END OF j LOOP */ d=d+stepsize; endo; /*************************************************************************/ i=i+1; /* END OF i LOOP */ b=b+stepsizB; endo; /*************************************************************************/ /* COMPUTE AND PRINT FIGURES */ graphset; fonts("simplex complex simgrma"); /* load fonts: \201, \202, \203 */ volume(1,1,1); /* Specifies ratios of length:width:height in all figures */ _paxes=1; /* Turn all axes on */ _ptitlht=0; /* Height of title characters: 0.13" (default) */ xtics(0,1,.2,0); ytics(0,1,.2,0); xlabel("\203b"); /* Label for x axis: beta */ ylabel("\203d"); /* Label for y axis: delta */ /*************************************************************************/ IF NFIGS==1; /* NFIGS=1: Print Fig. 1 */ GOTO FIG1; ELSEIF NFIGS==2; /* NFIGS=2: Print Fig. 2 */ GOTO FIG2; ELSE; GOTO FIG3; /* Default (NFIGS=3): Print Fig. 3 */ ENDIF; /*************************************************************************/ FIG1: /* NFIGS=1: Print Fig. 1 */ BEGWIND; MAKEWIND(4.4,4.13,0,1.5,1); /* Set up window for panel (i) */ MAKEWIND(4.4,4.13,4.4,1.5,1); /* Set up window for panel (ii) */ MAKEWIND(9, 6.5,0,0,1); /* Set up full-page window for text: Figure Title */ /*************************************************************************/ SETWIND(1); title("\202(i) Full Effectiveness of R&D"); zlabel("\203q \202~"); ztics(0,1.5,.5,0); surface(bbetat',delta',theta'); /* NB Axes reversed from first version, so all matrices transposed */ NEXTWIND; title("\202(ii) Effective Spillover Parameter"); zlabel("\203b \202~"); ztics(0,1,.2,0); surface(bbetat',delta',bbeta'); NEXTWIND; /* FIGURE TITLE */ graphset; _paxes = 0 ; /* Turn off axes */ _pnum = 0 ; /* Turn off axes numbering */ _ptitlht = 0 ; /* Axis Height in inches (Default = 0: 0.13 inches) */ fonts("simplex complex simgrma"); /* load fonts: \201, \202, \203 */ title("\202Fig. 1: Effects of the Difficulty of Absorption"); draw; GOTO PRINTEND; /*************************************************************************/ FIG2: /* NFIGS=2: Print Fig. 2 */ BEGWIND; MAKEWIND(4.4,3.8,0,2,1); /* Set up window for panel (i) */ MAKEWIND(4.4,3.8,4.4,2,1); /* Set up window for panel (ii) */ MAKEWIND(3,2.285,3,0.4,1); /* Set up small window for panel (iii) */ /* MAKEWIND(4.4,4.13,0,2,1); /* Set up window for panel (i) */ MAKEWIND(4.4,4.13,4.4,2,1); /* Set up window for panel (ii) */ MAKEWIND(9,6.855,0,0,1); /* Set up full-page window for text: Figure Title */ ORIGINAL */ MAKEWIND(9,6.5,0,0,1); /* Set up full-page window for text: Figure Title */ /*************************************************************************/ SETWIND(1); title("\202(i) Without Cooperation"); ztics(1,1.8,.1,0); zlabel("\202W[N]"); surface(bbetat',delta',WN'); /* surface(delta,bbetat,WN); */ NEXTWIND; title("\202(ii) With Cooperation"); ztics(1,1.8,.1,0); zlabel("\202W[C]"); surface(bbetat',delta',WC'); NEXTWIND; /* PANEL (iii) OF FIGURE 2 */ graphset; /* Need to reset everything since otherwise old axis labels get printed first */ /* _pbox = 1 ; /* TEMP: Useful for guaging size of this small window */ */ _paxht = 0.2 ; /* Need to reset axis-label and other heights since this window is smaller */ _ptitlht = 0.2 ; _pnumht = 0.17 ; _plotsiz = 0 ; axmargin ( 2.25,2.25,1,1); /* Creates an almost-perfect square plot */ xtics(0,1,.2,0); ytics(0,1,.2,0); fonts("simplex complex simgrma"); /* load fonts: \201, \202, \203 */ title("\202(iii)"); ylabel("\203d"); /* Label for y axis: delta (NB Reversed) */ xlabel("\203b"); /* Label for x axis: beta */ _pmsgctl = {.4 .5 .2 0 1 2 0 , .71 .1 .2 0 1 2 0 , .44 .04 .2 0 1 2 0 , 1.03 .34 .2 0 1 2 0 }; /* Control information (location, etc.) for messages */ _pmsgstr = "\202W[N]>W[C] \000W[N]