Project 1: Saving for a Car

Author

Your Name

The question

In one or two sentences, explain the decision this model will help make.

Model and assumptions

Briefly describe how each quantity changes during one month:

  • new-car price;
  • current-car trade-in value; and
  • savings balance.

State two assumptions made by this model.

Base-case simulation

# Time in years; one update per month
start_time <- 0
end_time <- 5
delta_t <- 1 / 12
time <- seq(start_time, end_time, by = delta_t)
month <- 0:(length(time) - 1)

# Parameters and initial conditions
annual_inflation_rate <- 0.05
annual_interest_rate <- 0.04
annual_depreciation_rate <- 0.08
monthly_contribution <- 600

new_car_initial <- 30000
trade_in_initial <- 13000
savings_initial <- 6000

# Create the three stock vectors.
# TODO

# Store the three initial conditions.
# TODO

# Update all three stocks one month at a time.
for (i in 2:length(time)) {
  # TODO
}

# Combine the results and calculate the cash needed.
# TODO

Verification

Calculate the new-car price, trade-in value, and savings after the first month by hand. Show your calculation, then display the first two rows of your simulation and explain whether they agree.

# Display the first two rows here.
# TODO

Result

Find the first month when savings are at least as large as the cash needed.

# Use the first affordable position to display the crossing month and the
# preceding month. Remember that a vector position is not a month number.
# affordable_positions <- which(results$savings >= results$cash_needed)
# TODO

In a few sentences, report the first affordable month and explain how you confirmed it was the first.

Graph

Create one graph showing savings and cash needed over time.

# Your graph goes here. Include a title, labeled axes, two distinguishable
# lines, and a legend.
# TODO

What does the graph show? Describe where the two lines cross.

One experiment

Change the monthly contribution from $600 to either $400 or $800.

Before running the modified model, predict whether the buyer will afford the car earlier or later and explain why.

Prediction: Replace this sentence with your prediction.

# Duplicate or adapt your simulation for the new monthly contribution.
# A function is not required.
# TODO

Report the new purchase month. Was your prediction correct? Explain the difference from the base case.

Conclusion

Write a short recommendation to the buyer. Include:

  • the base-case purchase month;
  • what the experiment revealed; and
  • two important limitations of the model.
Back to top