# R SCRIPT FILE TO CALULATE THE DEMAND FUNCTION FOR LIQIDITY # # Define and set the magnitudes of the parameters # mhat <- .14 # optimal output flow as fraction of capital stock delta <- .05 # depreciation rate gamma <- .2 # resource missallocation parameter phi <- 8.94 # first demand for money parameter lambda <- 298.14 # second demand for money parameter # # Set the range of levels of the liquidity/capital ratio as # 0 through 3000 # LKR <- rep(0,3000) # start with 3000 zeros for (j in 2:3001){ # set values to represent alternative LKR[j]=LKR[j-1]+1 # levels of the liquidity/capital ratio } # ranging from 0 through 3000 # # Adjust the scale of the liquidity/capital ratio and then # calculate the optimum level of the income/capital ratio. # Then construct an additional income/capital ratio that is # 20 percent higher # LKR <- LKR/100000 # set the scale of the liquidity capital ratio YKR <- (mhat*(1-gamma)-delta) # optimum liquidity ratio of income to capital YKR2 <- 1.2*YKR # increase above income/capital ratio by 20 percent # # Calculate the marginal return to liquidity for the two income/capital ratios # MRL <- YKR*(phi - lambda*LKR)^2 # marginal return to liquidity MRL2 <- YKR2*(phi - lambda*LKR)^2 # marginal return to liquidity when income/capital # ratio is increased by 20 percent LYR <- LKR/YKR # calculate the liquity/income ratio # plot(100*LKR,100*MRL,type="l", # plot the two variables as percentages xlab="Liquidity as Percentage of the Capital Stock", ylab="Marginal Return -- Percent Per Annum", main="Marginal Return to Liquidity") # # LYRS <- LYR[2500:3000] # select only the last 500 elements of the MRLS <- MRL[2500:3000] # series MRL2S <- MRL2[2500:3000] # plot(100*LYRS,100*MRLS,lty=1,type="l", xlab="Real Stock of Liquidity as Percentage of Income", ylab="Nominal Interest Rate", main="The Demand Function for Liquidity") lines(100*LYRS,100*MRL2S,lty=2,type="l") legend(44.8,14,c("Real Income = 100","Real Income = 120"),lty=c(1,2)) # # Save above plots in jpg and endapsulated postscript files # jpeg(filename = "mrliq.jpg", width = 800, height = 500, #units = "px", pointsize = 12, quality = 150, bg = "white", res = NA, restoreConsol = TRUE) plot(100*LKR,100*MRL,type="l", xlab="Liquidity as Percentage of the Capital Stock", ylab="Marginal Return -- Percent Per Annum", main="The Marginal Return to Liquidity") dev.off() # postscript("mrliq.eps",paper="letter",width=6.5,height=4.5,horizontal=FALSE) plot(100*LKR,100*MRL,type="l", xlab="Liquidity as Percentage of the Capital Stock", ylab="Marginal Return -- Percent Per Annum", main="The Marginal Return to Liquidity") dev.off() # jpeg(filename = "demliq.jpg", width = 800, height = 500, #units = "px", pointsize = 12, quality = 150, bg = "white", res = NA, restoreConsol = TRUE) plot(100*LYRS,100*MRLS,type="l", xlab="Real Stock of Liquidity", ylab="Nominal Interest Rate", main="The Demand Function for Liquidity") lines(100*LYRS,100*MRL2S,lty=2,type="l") legend(44.8,14,c("Income = 100","Income = 120"),lty=c(1,2)) dev.off() # postscript("demliq.eps",paper="letter",width=6.5,height=4.5,horizontal=FALSE) plot(100*LYRS,100*MRLS,type="l", xlab="Real Stock of Liquidity", ylab="Nominal Interest Rate", main="The Demand Function for Liquidity") lines(100*LYRS,100*MRL2S,lty=2,type="l") legend(44.8,14,c("Income = 100","Income = 120"),lty=c(1,2)) dev.off() #