# R SCRIPT FILE FOR ANALYSING THE GG AND AA CURVES # # SET INITIAL VALUES OF THE GROWTH PARAMETERS # hatm <- 0.14 delta <- 0.05 varpi <- .015 alpha <- 20 # long-run adjustment cost parameter sralpha <- 100 # short-run adjustment cost version of alpha gamma <- .2 newgamma <- .1822857 # reflecting improvement in resource allocation tau <- .01 oplkr <- .03 newoplkr <- .0312 Ups <- .2 inf <- .02 # inflation rate # # # SET VALUES OF VARIABLES OBTAINED FROM GGAAssg.R --- saved in GGAAssg.xls # g <- 0.01405 # original values obtained with 2% inflation r <- 0.03961631 L <- 0.02671 newg <- .01482000 # new values after the efficiency improvement newr <- .04041088 newL <- .02775 # Yf <- .06193458 # changes in full-employment output from # newYf <- .06441026 # efficiency improvement # # CALCULATE THE VALUES OF lambda and varphi # varphi <- sqrt((1 - Ups)*3/oplkr) # recalculate these here lambda <- varphi/oplkr # rather than copy them newvarphi <- sqrt((1 - Ups)*3/newoplkr) # from GGAAssg.xls newlambda <- newvarphi/newoplkr # # CALCULATE mterm, acterm, tterm and dmterm FOR OPTIMUM LIQUIDITY/CAPITAL # RATIO # # Initially set KU = 1 # KU <- 1 # mterm <- hatm * (1 - gamma) - delta newmterm <- hatm * (1 - newgamma) - delta # mterm modified to account for improved resource tterm <- 1 - (1/(3*lambda)) * (varphi - (lambda * (L/KU)))^3 # allocation newtterm <- 1 - (1/(3*newlambda)) * (newvarphi - (newlambda * (newL/KU)))^3 # tterm modified # # to account for improved resource allocation # When K is normalized at unity, the full-employment level of output will # equal # Yf <- mterm * tterm newYf <- newmterm * newtterm # full-employment output under improved resource allocation # acterm <- 1 + (2 * alpha) * (g + (KU - 1)* Yf) newacterm <- 1 + (2 * alpha) * (g + (KU - 1)* newYf) # impose modifications on acterm dmterm <- ((varphi - (lambda * (L/KU)))^2) - inf newdmterm <- ((newvarphi - (newlambda * (newL/KU)))^2) - inf # impose modifications # # The full-employment level of r should also equal ssgterm # ssgterm <- ((1 + varpi)*(1 + g) / (1 - tau)) - 1 # cat(r);cat("\n") # Print the original values together with the cat(newr);cat("\n") # ones that result after the improvement cat(ssgterm);cat("\n") # of resource allocation cat(Yf);cat("\n") cat(newYf);cat("\n") cat(varphi);cat("\n") cat(newvarphi);cat("\n") cat(lambda);cat("\n") cat(newlambda);cat("\n") # # CALCULATE POINTS ON THE AA AND GG CURVES FOR KU = .96, .97, .98, .99, # 1.00, 1.01, 1.02, 1.03, 1.04, 1.05, 1.06 -- which can be viewed as the # ratio of actual output to full-employment output # yvec <- c(0.96,0.97,0.98,0.99,1.00,1.01,1.02,1.03,1.04,1.05,1.06) # set the levels # of KU for which interest rate levels on the GG and AA curves will be calculated. # # Start with the GG curve --- equation (7) in the document # KU <- 0.96 # acterm <- 1 + (2 * alpha * g) + (2 * sralpha * (KU - 1)* Yf) tterm <- 1 - (1/(3*lambda)) * (varphi - (lambda * (L/KU)))^3 rg <- (mterm / acterm) * tterm # level of r on the GG curve rggvec <- c(rg) # create the first element on a vector of values # KU <- 0.97 # acterm <- 1 + (2 * alpha * g) + (2 * sralpha * (KU - 1)* Yf) tterm <- 1 - (1/(3*lambda)) * (varphi - (lambda * (L/KU)))^3 rg <- (mterm / acterm) * tterm rggvec <- c(rggvec, rg) # add element to the vector of values # # Calculate the remaining values using a for loop # for (i in 1:9){ KU <- KU + .01 acterm <- 1 + (2 * alpha * g) + (2 * sralpha * (KU - 1)* Yf) tterm <- 1 - (1/(3*lambda)) * (varphi - (lambda * (L/KU)))^3 rg <- (mterm / acterm) * tterm rggvec <- c(rggvec, rg) # add elements one-by-one to the vector of values } # # rggvec is a list of values of r on the GG curve for the above-noted # values of KU # # Now perform the same calculations for the AA curve --- equation (8) in the document # KU <- .96 dmterm <- (varphi - (lambda * (L/KU)))^2 ra <- mterm * dmterm - inf # inf is inflation rate (fraction, not percent) raavec <- c(ra) for (i in 1:10){ KU <- KU + .01 dmterm <- (varphi - (lambda * (L/KU)))^2 ra <- mterm * dmterm - inf raavec <- c(raavec, ra) } # # raavec is a list of values of r on the AA curve for the above-noted # values of KU # # Impose a Monetary Shock taking the form of a 1.5% increase in L # L <- 1.015 * L KU <- .96 dmterm <- (varphi - (lambda * (L/KU)))^2 sra <- mterm * dmterm - inf sraavec <- c(sra) for (i in 1:10){ KU <- KU + .01 dmterm <- (varphi - (lambda * (L/KU)))^2 sra <- mterm * dmterm - inf sraavec <- c(sraavec, sra) } # Multiply raavec sraavec and rggvec by 100 to put the interest rates in # percentage terms # raavec <- 100 * raavec sraavec <- 100 * sraavec rggvec <- 100 * rggvec # yvec raavec sraavec rggvec # postscript("GGAA1r.eps",paper="letter",width=6.5,height=4.5,horizontal=FALSE) plot(yvec,raavec,type="l", xlim = c(.9575,1.0625), ylim = c(0.5,11), xlab="Ratio of Actual to Full-Employment Income", ylab="Interest Rate -- Percent",main="AA and GG Curves: Monetary Shock") lines(yvec[3:11],sraavec[3:11],lty=2) lines(yvec,rggvec,lty=1) #legend(1.001,6.75,c("AA","GG"),lty=c(1,2)) abline(v=1.0) #abline(h=3.963631) text(0.9575,5.9,"G") text(1.0627,2.65,"G") text(0.9575,0.59,"A") text(1.0623,10.75,"A") text(0.9775,0.97,"A'") text(1.0627,8.78,"A'") text(1.011,4.1,"b") text(0.9975,4.5,"a") dev.off() # # Impose Real Shocks # # The real interest rate associated with a level of income 4% # above the old full-employment income was the 9th element in # rggvec. # rgg9 <- rggvec[9] # # Raise all elements of rggvec by the proportion newr/rgg9 # srggvec <- (100*newr/rgg9) * rggvec # multiply by 100 because newr is a fraction, not a # percentage. # Make second figure to show the effects of real shocks # postscript("GGAA2r.eps",paper="letter",width=6.5,height=4.5,horizontal=FALSE) plot(yvec,raavec,type="l", xlim = c(.9575,1.0625), ylim = c(0.5,11), xlab="Ratio of Income to Initial Full-Employment Income", ylab="Interest Rate -- Percent",main="AA and GG Curves: Real Shocks") lines(yvec,rggvec,lty=1) lines(yvec,srggvec,lty=2) abline(v=1.0) abline(v=(newYf/Yf),lty=2) abline(h=(100*r),lty=3) text(0.9575,5.9,"G") text(1.0627,2.65,"G") text(0.9575,7.9,"G'") text(1.0627,3.57,"G'") text(0.9575,0.59,"A") text(1.0623,10.75,"A") text(0.9975,4.5,"a") text(1.042,4.37,"c") text(1.00195,5.67,"d") text(1.0095,5.45,"b") dev.off() # # Make third figure to show the effects of an increase in the distortionary # tax on savings using information obtained with GGAAssg.R # # make a new vector that incorporates the upward effect of an increase in # tau from .01 to .015 on r at Y/Yf of 1.00 # ssrggvec <- (0.04232256 / 0.03961631) * rggvec # numbers are from GGAAssg.xls # postscript("GGAA3r.eps",paper="letter",width=6.5,height=4.5,horizontal=FALSE) plot(yvec,raavec,type="l", xlim = c(.9575,1.0625), ylim = c(0.5,11), xlab="Ratio of Income to Initial Full-Employment Income", ylab="Interest Rate -- Percent",main="AA and GG Curves: Tax on Savings") lines(yvec,rggvec,lty=1) lines(yvec,ssrggvec,lty=2) abline(v=1.0) abline(v=(0.06192969/0.06193458),lty=2) text(0.9575,5.9,"G") text(1.0627,2.65,"G") text(0.9575,0.59,"A") text(1.0623,10.75,"A") abline(h=(100*r),lty=3) dev.off() # # Extend the results to small open economy by imposing a rest-of-world # established real interest rate -- choose the initial full-employment rate # wrldr <- rep(r,11) # generate horizontal interest rate line wrldr # # Plot the case of monetary policy under a fixed exchange rate # postscript("GGAA4r.eps",paper="letter",width=6.5,height=4.5,horizontal=FALSE) plot(yvec,raavec,type="l", xlim = c(.9575,1.0625), ylim = c(0.5,11), xlab="Ratio of Actual to Full-Employment Income", ylab="Interest Rate -- Percent",main="Open Economy: Monetary Shock, Fixed Exchange Rate") lines(yvec[3:11],sraavec[3:11],lty=2) lines(yvec,rggvec,lty=1) lines(yvec,100*wrldr,lty=1) abline(v=1.0) #abline(h=3.963631) text(0.9575,5.9,"G") text(1.0627,2.65,"G") text(0.9575,0.59,"A") text(1.0623,10.75,"A") text(0.9775,0.97,"A'") text(1.0627,8.78,"A'") #text(1.011,4.1,"b") text(0.9575,4,"r") text(1.0627,4,"Z") text(0.9975,4.5,"a") text(1.018,5,"---->") text(1.013,4.5,"<----") dev.off() # # Plot the case of monetary policy under a flexible exchange rate # # Create a GG curve that passes through the new equilibrium point # rggvecmfl <- 1.12*rggvec # postscript("GGAA5r.eps",paper="letter",width=6.5,height=4.5,horizontal=FALSE) plot(yvec,raavec,type="l", xlim = c(.9575,1.0625), ylim = c(0.5,11), xlab="Ratio of Actual to Full-Employment Income", ylab="Interest Rate -- Percent",main="Small Open Economy: Monetary Shock, Flexible Exchange Rate") lines(yvec[3:11],sraavec[3:11],lty=2) lines(yvec,rggvec,lty=1) lines(yvec,100*wrldr,lty=1) lines(yvec,rggvecmfl,lty=2) abline(v=1.0) #abline(h=3.963631) text(0.9575,5.9,"G") text(1.0627,2.65,"G") text(0.9575,0.59,"A") text(1.0623,10.75,"A") text(0.9775,0.97,"A'") text(1.0627,8.78,"A'") text(1.015,4.49,"b") text(0.9575,4,"r") text(1.0627,4,"Z") text(1.0020,3.5,"a") dev.off() # # Plot the case of a positive real shock under a fixed exchange rate # rggvecrfi <- 1.135*rggvec # postscript("GGAA6r.eps",paper="letter",width=6.5,height=4.5,horizontal=FALSE) plot(yvec,raavec,type="l", xlim = c(.9575,1.0625), ylim = c(0.5,11), xlab="Ratio of Actual to Full-Employment Income", ylab="Interest Rate -- Percent",main="Small Open Economy: Real Shock, Fixed Exchange Rate") lines(yvec,rggvecrfi,lty=2) lines(yvec[3:11],sraavec[3:11],lty=2) lines(yvec,rggvec,lty=1) lines(yvec,100*wrldr,lty=1) abline(v=1.0) text(0.9575,5.9,"G") text(0.9575,6.7,"G'") text(1.0627,2.50,"G") text(1.0627,3.10,"G'") text(0.9575,0.59,"A") text(1.0623,10.75,"A") text(1.015,4.5,"b") text(0.9575,4,"r") text(1.0627,4,"Z") text(1.0020,3.5,"a") dev.off() # # Plot the case of a positive real shock under a flexible exchange rate # rggvecrfl <- 1.20*rggvec #make the shock slightly larger than in the fixed exchange rate case # postscript("GGAA7r.eps",paper="letter",width=6.5,height=4.5,horizontal=FALSE) plot(yvec,raavec,type="l", xlim = c(.9575,1.0625), ylim = c(0.5,11), xlab="Ratio of Actual to Full-Employment Income", ylab="Interest Rate -- Percent",main="Small Open Economy: Real Shock, Flexible Exchange Rate") lines(yvec,rggvecrfl,lty=2) lines(yvec,rggvec,lty=1) lines(yvec,100*wrldr,lty=1) abline(v=1.0) text(0.9575,5.9,"G") text(1.0627,2.65,"G") text(0.9575,0.59,"A") text(1.0623,10.75,"A") text(0.9575,4,"r") text(1.0627,4,"Z") text(0.9975,4.5,"a") text(0.975,5.5,"<----") text(0.985,5,"---->") dev.off() # # Put results in matrix form and print them to screen # GGAAmatr <- cbind(yvec, raavec, sraavec, rggvec, srggvec, ssrggvec, rggvecmfl, rggvecrfi, rggvecrfl) # GGAAmatr #