# You can use this code in Q6c, 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 Q6c --- 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.


# Estimate a model linear in 1/MAPE
# Inputs:
  # A data frame (data)
# Outputs:
  # The slope coefficient of 1/MAPE
# Presumes:
  # The input data frame has a column called MAPE
  # The input data frame has a column called Return_10_fwd
  # Both columns are real numbers
est.invMAPE <- function(data) {
    est <- lm(Return_10_fwd ~ I(1/MAPE), data=data)
    return(coefficients(est)["I(1/MAPE)"])
}
