Julian Simon liked to proclaim that

The only true measure of scarcity is price …

In this lab we are going to take advantage of a database put together by David Jacks. The data for his paper “From Boom to Bust: A Typology of Real Commodity Prices in the Long Run” (2013, NBER Working Paper 18874) has consistent series of commodity prices for everything ranging from barley to zinc. For our lab we’ve selected prices since 1900.

We’re going to ask the following:

  1. What has been the long-term trend in commodity prices?

  2. Was Simon lucky to have won the bet?

  3. Do commodity price trends differ by commodity in a way that we can understand? (This section will be more exploratory than in past labs. Here the important point is to report what you find, not to find a specific “right” answer.)

  4. Finally, we will use our Malthusian “harvest” model to learn about renewable resources. (We may or may not get to this in class this week. If not, then this part of the lab will be pushed into next week, when we have no lab).

# Do not edit this chunk, but *do* press the green button to the answer key for the quiz info (the unreadable string below)
tot = 0
answer.key = "eJzNVk2P4zYMvedXEDmMd4FASZzMYHeBwSIzLdBeiqKz94EiM7YaWfLqYz359yVlJ/Phaw69GKFok3yP5FPET5vaPfq1WMM90HMmlPMeVRTShv7smP82n4lG2ziaf3utMID0CNpW+IIVRAfrr6sVSFvlc1n9m0Ikx8F5eulgZNTOUhhtQ/RJsRXGcP9gZ6RCiA3CXzvodWzg5JKHoQb4hKIWCyh2BUWCn8lFDJ8pFL7QdzYHvkSSBrqxulzBJP8FcZkRl1PE7Jg/XBBns4mxC9+WS7Si10fdYaWlcL5esrV8bLxrdWon8MqrwcuRdopqrbStme5LHQv4cgsdeoU2gibgXUcdsNGcIAWsZoIpiA15nEXoku9cQAE7n0uiZ0j7EHVMlDfT1XkqgSBQHmohmu+vtJWZ53I6KINj/jjSNppP9M5pAdYBH36gp7xa98dIPxhNEUAZlJ7QSzAugjvAL8ftNzqeCLaJjUt1k/PlUeGw5Wp9y9w1uqYg5JOWj3mkFwN3lcNgi0gh3RGMPtKID4kgEtnVAoK2FIv5a5NqOC1nKFcEhzuT/OlNyl4GitR/SCXeEl1moifzOTjmF56z9WdtHS9diq4lpApaDEHWdLJ3Kb6jc4/c14KKHcMWM5GJY/jUqGI8L8YPBDykTKKiIIFR03gcKDwB7V0yFRAJdiai66WvoHgsJm2+1hb8T8FeOrbJHdtMO7Z5qyijuTMmC6VHGZyVe4MLwBeFXYRH6BtNI0Q1vlYOP2iAZC2JHH1gkFDpigdyhPogJrxvrsb7UPFFV2gl6N1RZ3umUzkbvTOGBJ890kfY8wIq+oWGGSUiq6TQBwFPiHAW1L7vhY5eE2ciHZf5OhFd0313Hae+V659bmnD8CbKcLyXMT5XrrfGyerGaHt81tX99uvd6vZGHfh3uc0rKImdoFIIFAMOpM6Qt6yiG4Fo9BhocYnhQEQofLN2m6wkm6m+DY5LE0fzj0EuRiZamg1oeTYD4VYsNx96srma5I2RdoxK8QxlGRsLCamuMcQwgL64Z6I4F1YsaMZkhN8bb3jUWI/2GLPmO/uOkDITMtGhzXglXQgZdtMGpN6T8mqL36Cggmz85LyutZVGUApB5CcTP2doTIByFT2aZI98qwUcaBneOqsofzeh8lqyckYCFms6+IUwQM/9DK9jTrcrj94i/8cJDp50S8M1yEIj6bP+HXPb3KHtdJS270dpNEfmhhuZhWG9umPcga/PSNbqIwPbqw3TGOmuXHJS/guRlXQlbr+I+X+1gFbM"
library(quizify)
source.coded.txt(answer.key)

Note: the most helpful reading for this lab is David Lam (2011), “How the World Survived the Population Bomb”

Part 2. Visualizing commodity prices

Let’s see how the price of Chromium varies over time.

year.vec <- rownames(commod)
plot(year.vec, commod$Chromium, type = "l")
abline(v = 1980)                        # the date of "the bet"

Q2.1 How would you describe the history of Chromium prices?

A. Steadily rising

B. Steadily falling

C. Very volatile, with little clear long-term trend

D. Very volatile, with a clear upward trend

##  "Replace the NA with your answer (e.g., 'A' in quotes)"
answer2.1 = 'C'
quiz.check(answer2.1)
Your  answer2.1 : C
Correct.
Explanation:  There's clearly a lot of volatility. Although the price in 2015 is higher than in 1900, this doesn't look like a clear trend, since for much of the 20th century the price was lower than in 1900.

What does “trendless” data look like?

Imagine a “random walk”, in which prices go up or down each year by some random amount that averages zero. Each realization of this random walk will have, by luck, some trend, but the underlying process generating the randomness has no trend – on average the change is “zero”. It is very easy to falsely interpret a random walk as having an underlying trend. The subject of how to make inferences about the trend of a time series is covered in an econometrics or statistics class. For now, we will just look at some realizations of the random walk to get a feeling for what random realizations of trendless data can look like.

## here's the function
plot.random.walk <- function(seed)
{
    set.seed(seed)                      # this initializes the random
                                        # number generator used in
                                        # sample(). If we use the same
                                        # seed, we will get the same
                                        # set of "random" numbers.
    random.steps <- sample(x = c(-1,1), size = 40, replace = TRUE)
    ## this selects the number -1 or 1 randomly 40 times
    random.walk <- cumsum(random.steps)
    ## this turns the random steps into a walk by summing them up.
    ## cumsum(c(1,2,3)) returns a vector with values 1, 3, and 6.
    plot(1:40, random.walk, type = "l")
}

Here’s an example

plot.random.walk(seed = 23)             # Here we set seed to 23

Modify the code below to try 1,2, 3, and 4 as “seeds”

plot.random.walk(seed = 23)

plot.random.walk(seed = 23)

plot.random.walk(seed = 23)

plot.random.walk(seed = 23)

Q.2.2 Which of the following seems to be true

A. Even if price changes are random, averaging zero, the realization of a random process can look like it has a trend.

B. A historical trend is the one reality we observe and we shouldn’t let anyone confuse us with alternative random realizations.

C. Thinking about randomness may help us understand and interpret the reality we see and thus is a subject worth of study.

##  "Replace the NA with your answer (e.g., 'A' in quotes)"
answer2.2 = 'C'
quiz.check(answer2.2)
Your  answer2.2 : C
Sorry, incorrect. Try again.
Hint: Ignore automatic message about your answer being 'incorrect.'
.There is no 'correct' answer. But of course a professor would lean
.toward 'C'

Repeating for Tin

Plot the price of tin. You can use the same code we used for Chromium, modifying just slightly.

## put your code for Tin here
year.vec <- rownames(commod)
plot(year.vec, commod$Tin, type = "l")
abline(v = 1980) 

## (Hint: you can copy and modify the commands we used for Chromium)

Q2.3 Why do you think Ehrlich chose Tin as one of his commodities to bet on?

  1. Tin is difficult to substitute for

  2. Tin had shown a sharp increase in price for the decade or so before 1980 and so it looked like it would continue.

  3. The price had been going down before 1980 and was ready for a recovery

  4. There was evidence that the tin mines were running out of ore

##  "Replace the NA with your answer (e.g., 'A' in quotes)"
answer2.3 = 'B'
quiz.check(answer2.3)
Your  answer2.3 : B
Correct.
Explanation:  Apparently, tin prices were controlled in part by a cartel of producers. See https://www.itri.co.uk/index.php?option=com_mtree&task=att_download&link_id=49605&cf_id=24 for a discussion from an industry research source.

Part 3. Replicating actual bet

In the original bet, Ehrlich was allowed to choose any commodities he wished. He chose Chromium, Copper, Tin, Tungsten, and Nickel. In our data, we don’t have Tungsten. We can check to see if Simon still wins with the four commodities we have.

See the Lam reading, p. 1242 for an account of the bet.

We will use a function to compare commodities over time. This uses the indexing by label we did above. It returns the change in value of a $1000 purchase of the commodity basket in the start year. So if the function returns +100, this means that the value of the commodity basket increased by $100.

Q3.1 If the value of the basket increased by $100, who would win?

A. Simon

B. Ehrlich

C. Neither, because the value of the basket doesn’t tell us if all of the commodities increased in price at the same time.

##  "Replace the NA with your answer (e.g., 'A' in quotes)"
answer3.1 = 'B'
quiz.check(answer3.1)
Your  answer3.1 : B
Correct.
Explanation:  An increase in prices suggests an increase in
.'scarcity', what Ehrlich was betting on.
bet.fun <- function(start, end, basket.vec, data)
{
    ## start = 1980
    ## end = 1990
    ## data = commod
    ## basket.vec <- c("Copper", "Chromium", "Nickel", "Tin")
    year <- rownames(data)
    start.price <- data[year == start, basket.vec]
    end.price   <- data[year == end, basket.vec]
    ## we invest 1000, buyin an equal $ amount in each commodity.
    start.funds <- 1000
    dollars.per.commod <- start.funds/length(basket.vec) # e.g. $250 with 4
    ## amount purchased of each commodity
    holdings.vec <- dollars.per.commod/start.price
    ## value at the end
    value.at.end <- sum(holdings.vec * end.price)
    change.in.value <- value.at.end - start.funds
    return(change.in.value)
}
who.wins.fun <- function(change.in.value)
{
    ifelse(change.in.value > 0, "ehrlich", "simon")
}

Let’s try this for 1980 to 1990 with Ehrlich’s basket.

ehrlich.basket.vec <- c("Copper", "Chromium", "Nickel", "Tin")
original.bet.result <- bet.fun("start" = 1980,
                      "end" = 1990,
                      "basket.vec" = ehrlich.basket.vec,
                      "data" = commod)
who.wins.fun(original.bet.result)
[1] "simon"

Q3.2 How much would Simon have won with our version of the “bet”?

A. About 300 dollars

B. He wouldn’t have won. He would have lost about 300 dollars

C. About 500 dollars

D. About 100 dollars

##  "Replace the NA with your answer (e.g., 'A' in quotes)"
answer3.2 = 'A'
quiz.check(answer3.2)
Your  answer3.2 : A
Correct.
Explanation:  A negative number means prices went down, and so Simon would have won.

Part 4. Does Simon win in other periods?

Commodities are highly volatile. Even if commodities were generally rising, Ehrlich could have been unlucky about the timing of his bet.

Let’s check over all years since 1900. We can construct a “loop” using R that will repeat the bet according to our instructions. We can then save the output in a vector and make a judgement about whether Ehrlich was simply unlucky.

Here’s a simple example of a loop, in which we repeat an action 7 times, incrementing the value of “i”, and printing this value along with a label “iteration”.

for (i in 1:7)   ## the variable "i" takes the value 1, 2, 3, ...
{
    ## anything in between {} is done once
    ## for each value that "i" takes
    print(c("iteration", i))
}
[1] "iteration" "1"        
[1] "iteration" "2"        
[1] "iteration" "3"        
[1] "iteration" "4"        
[1] "iteration" "5"        
[1] "iteration" "6"        
[1] "iteration" "7"        

Now let’s do a loop to see who won the bet in every year of the last century.

start.vec <- 1900:2005        ## a vector of years to start the bet
bet.result.vec <- rep(NA, length(start.vec)) ## an empty vector to be
                                             ## used to store the
                                             ## results
names(bet.result.vec) <- start.vec ## labeling the elements (you can ignore)
for (i in 1:length(start.vec))
{
    bet.result.vec[i] <- bet.fun(start = start.vec[i],
                                 end = start.vec[i] + 10,
                                 basket.vec = ehrlich.basket.vec,
                                 data = commod)
}
print(bet.result.vec)
       1900        1901        1902        1903        1904        1905        1906        1907        1908        1909 
-258.700000 -156.431856   49.123809   -2.021327 -127.212088  -95.459327  -52.223399  -21.845369  293.912953 -175.917402 
       1910        1911        1912        1913        1914        1915        1916        1917        1918        1919 
-424.804605 -552.181803 -531.713958 -479.901991 -406.828864 -457.454997 -483.863734 -488.154673 -501.451139 -259.693188 
       1920        1921        1922        1923        1924        1925        1926        1927        1928        1929 
 -81.082163  216.717344  243.454453  252.717049  341.054540  365.566495  331.228393  386.168194  276.108124  306.675598 
       1930        1931        1932        1933        1934        1935        1936        1937        1938        1939 
 392.074108  414.174885  351.395641   38.681985  -29.656863  -72.914365 -150.671378 -113.895743   74.669806  -21.202224 
       1940        1941        1942        1943        1944        1945        1946        1947        1948        1949 
  -3.043024  132.044717  202.843571  269.671205  213.919871  395.367748  542.721218  291.148075  176.863221  283.016148 
       1950        1951        1952        1953        1954        1955        1956        1957        1958        1959 
  92.501372  -34.354117   84.176895   16.043674  199.861978  170.674010   38.283426  107.300058  183.451841  109.764135 
       1960        1961        1962        1963        1964        1965        1966        1967        1968        1969 
 286.654596  400.477990  181.086693  314.033040  526.655925  591.149632  599.870085  591.992619  507.597248  647.651367 
       1970        1971        1972        1973        1974        1975        1976        1977        1978        1979 
 627.592390  308.600045   97.417259  -38.528232 -294.608549 -353.756361 -475.654892 -441.250784   71.947758  -57.956949 
       1980        1981        1982        1983        1984        1985        1986        1987        1988        1989 
-306.220473 -275.830073 -193.578232 -353.610315 -237.373103   35.802145   16.675437  -96.471592 -524.143483 -588.938139 
       1990        1991        1992        1993        1994        1995        1996        1997        1998        1999 
-354.297500 -393.554388 -372.843395  -10.989176  366.094672   68.122978  768.730531 1523.535732 2017.405153 1150.647495 
       2000        2001        2002        2003        2004        2005 
1747.100492 2599.771715 2193.400721 1525.633810  609.806673  216.228316 

To summarize our results, let’s look at them in several ways.

Plot the numbers

plot(start.vec, bet.result.vec)
no non-missing arguments to min; returning Infno non-missing arguments to max; returning -InfError in plot.window(...) : need finite 'ylim' values

In the graph, it looks like Ehrlich would have won more of the time. But not a lot more.

Let’s tabulate how many times Ehrlich and Simon would have won:

## Convert to a vector of "simon" and "ehrlich", depending on who won
winners.vec <- who.wins.fun(bet.result.vec)
print(winners.vec)
     1900      1901      1902      1903      1904      1905      1906      1907      1908      1909      1910      1911 
  "simon"   "simon" "ehrlich"   "simon"   "simon"   "simon"   "simon"   "simon" "ehrlich"   "simon"   "simon"   "simon" 
     1912      1913      1914      1915      1916      1917      1918      1919      1920      1921      1922      1923 
  "simon"   "simon"   "simon"   "simon"   "simon"   "simon"   "simon"   "simon"   "simon" "ehrlich" "ehrlich" "ehrlich" 
     1924      1925      1926      1927      1928      1929      1930      1931      1932      1933      1934      1935 
"ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich"   "simon"   "simon" 
     1936      1937      1938      1939      1940      1941      1942      1943      1944      1945      1946      1947 
  "simon"   "simon" "ehrlich"   "simon"   "simon" "ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" 
     1948      1949      1950      1951      1952      1953      1954      1955      1956      1957      1958      1959 
"ehrlich" "ehrlich" "ehrlich"   "simon" "ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" 
     1960      1961      1962      1963      1964      1965      1966      1967      1968      1969      1970      1971 
"ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" 
     1972      1973      1974      1975      1976      1977      1978      1979      1980      1981      1982      1983 
"ehrlich"   "simon"   "simon"   "simon"   "simon"   "simon" "ehrlich"   "simon"   "simon"   "simon"   "simon"   "simon" 
     1984      1985      1986      1987      1988      1989      1990      1991      1992      1993      1994      1995 
  "simon" "ehrlich" "ehrlich"   "simon"   "simon"   "simon"   "simon"   "simon"   "simon"   "simon" "ehrlich" "ehrlich" 
     1996      1997      1998      1999      2000      2001      2002      2003      2004      2005 
"ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" "ehrlich" 
## count number of times each won using the "table()" function
table(winners.vec)
winners.vec
ehrlich   simon 
     62      44 

Q4.1 What percent of the time would Ehrlich have won of the 106 simulated bets from 1900 to 2005?

A. About 62 percent

B. About 58 percent

##  "Replace the NA with your answer (e.g., 'A' in quotes)"
answer4.1 = 'B'
quiz.check(answer4.1)
Your  answer4.1 : B
Correct.
Explanation:  62/106 is about 0.58.

Make a fancier plot. (You don’t need to understand this code.)

plot(start.vec, bet.result.vec, type = "n") #an empty plot
abline(h = 0)
e <- which(winners.vec == "ehrlich")    # T or F, to subset text()
s <- which(winners.vec == "simon")
text(x = start.vec[e], y = bet.result.vec[e], labels = "e", col = "blue")
text(x = start.vec[s], y = bet.result.vec[s], labels = "s", col = "red")
text(1960, 1500, "Ehrlich wins", col = "blue")
text(1960, -250, "Simon wins", col = "red")

5. Generalizing the bet to other commodities

A change in the supply of a particular commodity may or may not cause a large price change – depending on the availability of substitutes. (Note: the results from this section will be useful for your write-up of the graded questions at the end of the lab.)

The following code provides a template for a single commodity, in this case “Chromium”.

start.vec <- 1900:2005
result.vec <- rep(NA, length(start.vec))
for (i in 1:length(start.vec))
  {
  result.vec[i] <- bet.fun(start = start.vec[i],
                      end = start.vec[i] + 10,
                      basket.vec = c("Chromium"),
                      data = commod)
}
winner.vec <- who.wins.fun(result.vec)
cat("counts:\n")
counts:
table(winner.vec)
winner.vec
ehrlich   simon 
     61      45 
cat("proportions:\n")
proportions:
prop.table(table(winner.vec))
winner.vec
  ehrlich     simon 
0.5754717 0.4245283 

Well done. You are finished with the computing portion of Lab 4.

Part 5. Graded Questions

1. What relationship did Ehrlich expect to hold between commodity prices and population growth?

Ehrlich expected population growth to invoke scarcity (and thus driving up commodity prices).

As a Forbes article puts it, “Ehrlich insisted that commodities would become more expensive: they were running out in the face of the population explosion. Simon asserted the opposite: more people meant more brains meant better methods of extraction and lower usage per unit of production. Thus prices should fall. Simon won: but that’s not quite the end of the matter. With different commodities, or over different timescales with the same ones, Ehrlich could have.”

2. Who won the bet in 1990? Given our analysis of other time periods, would you say that the winner was “lucky” or “right”, or both? [Explain your answer in 50 to 100 words.]

Simon won in 1990, which was the end of the decade-duration bet. I agree with the Forbes article in that Simon was “lucky” in the time period the bet happened to occur in, and the commodities being betted upon. In our computational part of the lab, we found that over our investigated time period, Ehrlich had won about 58% of the time. So suppose Simon won to pure chance, at 42% (< 50%) chance. I’d call that lucky for a bet with money involved.

(As noted in the lab, this section is for you to explore and describe what you found. Whether what you find is conclusive or inconclusive, you can still get full credit by reporting whatever you found.)

3. Choose another easily substitutable commodity from the database. Conduct the analysis of its price as the previous part of the lab and answer the following questions.

3.1) Why do you think this commodity would be easily substitutable, explaining what “service” it provides with 1 or 2 sentences.

I chose Coffee as the commodity to investigate, with a meta particular interest in whether or not this commodity is easily substitutable. Although this may cause difficulty in our analysis, I argue that there are many consumers who ‘require’ coffee to function, but theoretically it can be skipped upon. In fact, nowadays some people search for other sources of caffeine or taurine for this purpose. One could expect tea (another commodity in our data set) to be positively or negatively correlated with our coffee price trends.

3.2) Attach a plot of the change of prices (“bet.result”) of the chosen commodity.

## get commodity data from a file on our server
file <- "/data175/Real_commodity_prices_1900_2015.csv"
commod <- read.table(file, sep = ",") # read the data into, with column header
# head(commod) # looks at first few lines
year.vec <- rownames(commod)
plot(year.vec, commod$Coffee, type = "l")
abline(v = 1980)                        # the date of "the bet"

start.vec <- 1900:2005        ## a vector of years to start the bet
bet.result.vec <- rep(NA, length(start.vec)) ## an empty vector to be
                                             ## used to store the
                                             ## results
bet.fun <- function(start, end, basket.vec, data)
{
    ## start = 1980
    ## end = 1990
    ## data = commod
    ## basket.vec <- c("Coffee") # for this analysis we only look at a single commodity basket, of Coffee
    year <- rownames(data)
    start.price <- data[year == start, basket.vec]
    end.price   <- data[year == end, basket.vec]
    ## we invest 1000, buyin an equal $ amount in each commodity.
    start.funds <- 1000
    dollars.per.commod <- start.funds/length(basket.vec) # e.g. $250 with 4 ; unnecessary for a single commodity basket
    ## amount purchased of each commodity
    holdings.vec <- dollars.per.commod/start.price
    ## value at the end
    value.at.end <- sum(holdings.vec * end.price)
    change.in.value <- value.at.end - start.funds
    return(change.in.value)
}
who.wins.fun <- function(change.in.value)
{
    ifelse(change.in.value > 0, "ehrlich", "simon")
}
# 
# names(bet.result.vec) <- start.vec ## labeling the elements (you can ignore)
# for (i in 1:length(start.vec))
# {
#     bet.result.vec[i] <- bet.fun(start = start.vec[i],
#                                  end = start.vec[i] + 10,
#                                  basket.vec = ehrlich.basket.vec,
#                                  data = commod)
# }
# print(bet.result.vec)
winners.vec <- who.wins.fun(bet.result.vec)
plot(start.vec, bet.result.vec, type = "n") #an empty plot
no non-missing arguments to min; returning Infno non-missing arguments to max; returning -InfError in plot.window(...) : need finite 'ylim' values

Hint 1: there would only be your chosen commodity in the “basket.vec”. You can either modify the original “ehrlich.basket.vec” or create your own “basket.vec”. Remember to modify for-loop consistently.

Hint 2: you don’t need to show whether Ehrlich or Simon win about this commodity. But labelling the plot with different colors can help you understand the general trend.

Hint 3: NOT REQUIRED. To make it a better graph, you can add a title to the graph indicating the commodity you choose adding ‘main = “commodity name”’ to the syntax.

4. Choose a commodity from the database which you think would be hard to substitute for. And explain why you think this commodity would NOT be easily substituted, explaining what “service” it provides. (In 1 or 2 sentences) [Note: you don’t need to analyze the data for this problem.]

The most prime commodity that comes directly to mind is gold. As a commodity, it always has its uses from fashion to utility from electronics to other applications. Suppose demand for the utility for gold goes down. Then if the price drops, we can imagine more people would buy the dip for fashion purposes. It extends both ways. Moreover, we can’t forget the saying “it’s as good as gold.”

5. What are two reasons prices might not reflect the long-term availability of a commodity? [A sentence on each.]

Firstly, we only have current and past (historical) data on prices. Predicted or forecasted prices are dependent on future events, so we cannot use forecasted prices to implicate or draw inferences about the long-term availability of a commodity.

Secondly, we do not know how future technologies will affect the availability or demand for that given commodity. It may happen that a technology makes it so a competing commodity is much more useful than our first commodity, almost depleting demand for our first commodity, which would create a higher actual availability than predicted. Additionally, we could have a technology create new and better ways to provide more of our commodity, making the actual availability higher than projected and predicted. Alternatively, we could have new technologies actually require this commodity, which drives demand for the commodity higher and may make the actual long-term availability of the commodity much lower than projected.

6. For the following questions, use the “app” available http://shiny.demog.berkeley.edu/josh/harvest/ to gather data on the relationship between harvest rate “h” and the sustainable (steady-state) yield. You can do this by moving the slider from 0 upwards by increments of 0.02.

6.1 There is a slight bug in the app, so that it reports sustainable yields even when harvest rate is unsustainable. How can you inspect the graphs to check on sustainability?

The app shows a harvest over time even when our harvest rate h is absurdly high. If the bottom-right chart says sustainable yield = 0, then we know we are over the harvest rate. It would end up looking like (due to our restrictions on zoom) our graph is discontinuous.

6.2 When h = 0.01, the sustainable yield is 0.0678, what is the sustainable yield when h = 0.02 and h = 0.04?

h = 0.02 => sustainable yield = 0.108 ; h = 0.04 => sustainable yield = 0.0239

6.3 What harvest rate maximizes the sustainable yield? [Hint: try all of the slider values]

At all other variables at default values (as in 6.2), we see that the sustainable yield increases as x goes from 0 to 0.022, then starts decreasing indefinitely. So the harvest rate h = 0.022 gives the maximum sustainable yield for our discrete measures.

6.4 What harvest rate maximizes the yield during the first year of harvesting (this is about year 10 on the slider, or year 0 on the time axes of the graph)? (You can either report the value you find with the “app” or your theoretical answer)

Considering only the sustainable yield at t= 10 on the slider (t = 0 on graph), we see the yield is constant at 0 for all values of h. Perhaps the questions should ask us to look at the range t = 10 to t = 20, and take the “area under the curve” for this region. Investigating this, we see that the first year’s harvest yield strictly increases as we increase h (even when inducing the “bug” where it’s past sustainability).

So for the harvest rate that maximizes the first year’s total yield from harvesting, we take the highest h value that is still sustainable, which is at about h = 0.076.

6.5 Would harvest rates be higher in year “1” if we harvested at the sustainable rate found in part 6.3, or if they were .02 higher than the sustainable rate?

The harvest rates would be higher at h = 0.022 + 0.02 compared to h = 0.022, based on the trend we discussed the previous problem (that the harvest rates in year 1 increase with higher values of h). We verify this in the app. If we are comparing h = 0.022 to h = 0.076 + 0.02, then we can expect the first year’s harvest to be higher at 0.02 past the sustainable rate. Although our results are good for the first year, we can expect our harvest rates to be worse eventually.

6.6 When Becker advocates for attention to sustainability, how did Lam reply to his warning? (In 1 or 2 sentences).

Lam notes “Although I agree with Becker’s concern about water, I am less concerned that we will run out of oil or any other resource that has clear property rights and active markets. ( https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4298828/ )”. Lam draws a distinction between protected/restricted resources and free resources like water, in terms of attention to sustainability.

On discussing the illegal loging problem in Indonesia, he writes “The point is that it will take institutional change, not simply the end of population growth, to solve the problem.” Essentially, Lam agrees with the call for attention to sustainability, but he adds notes that stopping population growth is not the only factor involved in the solution.

Congratulations! You are finished with Lab 4.

LS0tCnRpdGxlOiAiRWNvbi9EZW1vZyBDMTc1IExhYiA0OiBUaGUgQmV0IC0tIE92ZXIgYW5kIG92ZXIgYWdhaW4iCm91dHB1dDogaHRtbF9ub3RlYm9vawotLS0KCgpKdWxpYW4gU2ltb24gbGlrZWQgdG8gcHJvY2xhaW0gdGhhdAoKPiBUaGUgb25seSB0cnVlIG1lYXN1cmUgb2Ygc2NhcmNpdHkgaXMgcHJpY2UgLi4uCgpJbiB0aGlzIGxhYiB3ZSBhcmUgZ29pbmcgdG8gdGFrZSBhZHZhbnRhZ2Ugb2YgYSBkYXRhYmFzZSBwdXQgdG9nZXRoZXIKYnkgRGF2aWQgSmFja3MuIFRoZSBkYXRhIGZvciBoaXMgcGFwZXIgIkZyb20gQm9vbSB0byBCdXN0OiBBIFR5cG9sb2d5Cm9mIFJlYWwgQ29tbW9kaXR5IFByaWNlcyBpbiB0aGUgTG9uZyBSdW4iICgyMDEzLCBOQkVSIFdvcmtpbmcgUGFwZXIKMTg4NzQpIGhhcyBjb25zaXN0ZW50IHNlcmllcyBvZiBjb21tb2RpdHkgcHJpY2VzIGZvciBldmVyeXRoaW5nCnJhbmdpbmcgZnJvbSBiYXJsZXkgdG8gemluYy4gRm9yIG91ciBsYWIgd2UndmUgc2VsZWN0ZWQgcHJpY2VzCnNpbmNlIDE5MDAuCgpXZSdyZSBnb2luZyB0byBhc2sgdGhlIGZvbGxvd2luZzoKCjEuIFdoYXQgaGFzIGJlZW4gdGhlIGxvbmctdGVybSB0cmVuZCBpbiBjb21tb2RpdHkgcHJpY2VzPwoKMi4gV2FzIFNpbW9uIGx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