Risky climate business

Category 5 hurricanes are the most devastating kind, with sustained winds of at least 157 mph. A high percentage of framed homes are destroyed, with total roof failure and wall collapse. Fallen trees and power poles isolate residential areas. Power outages last for weeks to possibly months. From 1924-2022, roughly 6% of hurricanes strengthened to a Category 5. By 2035, the number climbed to 10%.

It is 2036. You are a real estate investor looking to maximize your return on investment over the next 25 years. You have the opportunity to invest in two types of properties: beachfront and interior. Beachfront properties provide higher returns, but are vulnerable to hurricanes that can wipe out a significant portion of your investment.

Your goal is to invest wisely by balancing the higher returns of beachfront properties against the risk of losing your investment due to a hurricane. You will need to make strategic allocation decisions based on your investment goals and your risk tolerance.

The game consists of multiple investment time blocks, and you will need to decide how to allocate your funds in each block. Each block represents a 5-year period during which you will earn returns on your investments. You can choose to allocate all your funds to beachfront properties, all to interior properties, or a mix of both. Professor Rao will tell you which blocks you are currently choosing.

The beachfront properties have a mean return of 10% per year, while the interior properties have a mean return of 6% per year. There is a 5% chance of a category 5 hurricane occurring each year. If it happens, you will lose 50% of your investment in the beachfront property.

You will start with an initial investment of $100,000,000 and will need to decide how to allocate your funds for each time block. At the end of the game, your final wealth will be determined by your choices and Nature’s dice.

Good luck!

Code

Let’s define a function to make our simulation code a bit cleaner. This function will simulate the investment returns from a single time block.

# Define function to simulate wealth for one block of periods
simulate_block <- function(initial_wealth, block_allocation, beachfront_return, interior_return, disaster_prob, disaster_reduction, print_disasters=TRUE) {
  # Initialize wealth
  wealth <- initial_wealth
  
  # Simulate disaster outcome
  disaster_vector <- rbinom(n=5, size=1, prob=disaster_prob)

  # Simulate each period
  for (i in 1:5) {
    disaster <- disaster_vector[i]

    # Calculate rate of return on investment based on allocation
    investment_return <- block_allocation * beachfront_return * (disaster) +
      block_allocation * (1 - disaster_reduction*block_allocation^2) * (1-disaster) +
      (1 - block_allocation) * interior_return
      
    # Add investment return to wealth
    wealth <- wealth * (1 + investment_return)
  }
  
   # Print disaster_vector with nice formatting if print_disasters==TRUE
  if(print_disasters==TRUE){
    cat("Disaster vector: [", paste(disaster_vector, collapse = ", "), "]\n")
  }
  
  # Return final wealth
  return(list(wealth=wealth, disaster_vector=disaster_vector)) # Returning both the final wealth (a single number) and the disaster series (a binary vector) as two separate objects in a list.
}

What’s the optimal investment?

“Optimal” here meaning “maximizes our final expected wealth.” We know climate change will increase the probability of a disaster, so let’s think about how to invest over two blocks: the first with a low disaster probability (0.05) and the second with a high disaster probability (0.15). To do this we’ll want two code chunks: one to implement a strategy once for a given realization of shocks, and one to run the strategy many times and plot histograms of disaster frequencies across simulations and final wealth under a given strategy.

First, here’s the code to implement a strategy once.

# Set parameters
n_periods <- 10 # Number of periods
n_blocks <- n_periods/5 # Number of blocks
initial_wealth <- 1 # Initial wealth in hundred million dollars
beachfront_return <- 0.1 # Annual return for beachfront property
interior_return <- 0.06 # Annual return for interior property
disaster_prob_low <- 0.05 # Probability of a disaster (low)
disaster_prob_high <- 0.15 # Probability of a disaster (high)
disaster_reduction <- 0.5 # Reduction in wealth due to a disaster
final_wealth <- initial_wealth # Initialize the object
block_allocation_schedule <- c(1,1) # Change these numbers to change the investment pattern

# Simulate block 1 with low disaster probability
block_allocation <- block_allocation_schedule[1]
block_wealth_low <- simulate_block(initial_wealth, block_allocation, beachfront_return, interior_return, disaster_prob_low, disaster_reduction)$wealth
## Disaster vector: [ 0, 0, 0, 0, 0 ]
# Simulate block 2 with high disaster probability
block_allocation <- block_allocation_schedule[2]
block_wealth_high <- simulate_block(block_wealth_low, block_allocation, beachfront_return, interior_return, disaster_prob_high, disaster_reduction)$wealth
## Disaster vector: [ 0, 0, 0, 0, 1 ]
# Update final wealth
final_wealth <- block_wealth_high

# Print final wealth
cat("Final wealth: ", final_wealth, "\nFinal ROI: ", final_wealth/initial_wealth - 1)
## Final wealth:  42.2877 
## Final ROI:  41.2877

Next, here’s the code to run a strategy many times and plot histograms of disaster frequencies across simulations and final wealth under the given strategy. Once again, we’ll write this code in two steps: first we write a function to perform the calculations we want to do repeatedly (which in turn contains a loop), then we call the function once (or many times) with a bunch of parameters.

# Putting the library call here since it's the only place we need it.
library(ggplot2)
library(cowplot)

# Define function to simulate multiple runs of investment strategy and plot histograms of disaster frequency and final wealth
simulate_strategy <- function(block_allocation_schedule, initial_wealth, beachfront_return, interior_return, disaster_prob_low, disaster_prob_high, disaster_reduction, n_simulations) {
  # Initialize lists for storing results
  final_wealths <- vector(mode = "numeric", length = n_simulations)
  disaster_frequencies <- vector(mode = "numeric", length = n_simulations)
  
  # Simulate each run
  for (i in 1:n_simulations) {
    # Simulate block 1 with low disaster probability
    block_allocation <- block_allocation_schedule[1]
    block_wealth_low_list <- simulate_block(initial_wealth, block_allocation, beachfront_return, interior_return, disaster_prob_low, disaster_reduction, FALSE)
    block_wealth_low <- block_wealth_low_list$wealth
    block_disasters_low <- block_wealth_low_list$disaster_vector

    # Simulate block 2 with high disaster probability
    block_allocation <- block_allocation_schedule[2]
    block_wealth_high_list <- simulate_block(block_wealth_low, block_allocation, beachfront_return, interior_return, disaster_prob_high, disaster_reduction, FALSE)
    block_wealth_high <- block_wealth_high_list$wealth
    block_disasters_high <- block_wealth_high_list$disaster_vector

    # Update final wealth and disaster frequency
    final_wealths[i] <- block_wealth_high
    disaster_frequencies[i] <- mean(c(block_disasters_low, block_disasters_high))
  }
  
  # Set strategy title
  strategy_title <- paste("Investment Strategy:", paste(block_allocation_schedule, collapse = "-"))
  
  # Plot histograms
  wealth_hist <- ggplot() +
    geom_histogram(aes(x = final_wealths), bins = 10, color = "black", fill = "green", alpha = 0.5) +
    labs(title = paste0("Histogram of Final Wealth. ", strategy_title), x = "Final Wealth") +
    theme_minimal() +
    theme(plot.title = element_text(size = 14, hjust = 0.5))

  disaster_hist <- ggplot() +
    geom_histogram(aes(x = disaster_frequencies), bins = 10, color = "black", fill = "blue", alpha = 0.5) +
    labs(title = "Histogram of Disaster Frequencies", x = "Disaster Frequency") +
    theme_minimal() +
    theme(plot.title = element_text(size = 14, hjust = 0.5))
    
  cat("Expected final wealth from ",  paste(paste(block_allocation_schedule, collapse = "-"), " strategy: "), mean(final_wealths), "\n")
  
  plot_grid(wealth_hist, disaster_hist, ncol = 1)
  
  return("ok")
}

Now, to call the function to evaluate a strategy.

# Set parameters
n_periods <- 10 # Number of periods
n_blocks <- n_periods/5 # Number of blocks
initial_wealth <- 1 # Initial wealth in hundred million dollars
beachfront_return <- 0.1 # Annual return for beachfront property
interior_return <- 0.06 # Annual return for interior property
disaster_prob_low <- 0.05 # Probability of a disaster (low)
disaster_prob_high <- 0.15 # Probability of a disaster (high)
disaster_reduction <- 0.5 # Reduction in wealth due to a disaster
final_wealth <- initial_wealth # Initialize the object

# Simulate strategy