# You can use this code in Q6b, but you'll only get partial credit if you run
# the checks called for by the question.  If you use it and don't run the
# checks, you'll get zero points for Q6b --- but your grades for other problems
# will be unaffected.

# This is part of the solutions, so please don't share it, even after the
# semester is over.


# Simulate the basic model
# Inputs:
  # Vector of MAPE values (MAPE);
  # Vector of residuals (resids)
# Output:
  # Data frame, with columns "MAPE" and "Return_10_fwd"
# Presumes:
  # MAPE is a vector of numbers, none of them zero
  # resids is a vector of numbers
sim.basic <- function(MAPE, resids) {
    Return_10_fwd <- 1/MAPE + sample(resids, size=length(MAPE), replace=TRUE)
    return(data.frame(MAPE = MAPE, Return_10_fwd = Return_10_fwd))
}
