Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #' @title Estimator for the value of mu. Mu is the drift component in the
  2. #' Geometric Brownian Motion model.
  3. #'
  4. #' @description Given a log price process, this function estimates the value of
  5. #' mu. Mu is the daily component of the returns which is attributable to upward,
  6. #' or downward, drift. This estimate can be annualized.
  7. #'
  8. #' @param X vector :: A log price process.
  9. #' @param annualize logical :: Annualize the parameter estimate.
  10. #' @return mu.est double :: The estimated value of mu.
  11. #'
  12. calibrateMu <- function(X, annualize = TRUE) {
  13. # Ensure the format of X is appropriate.
  14. X <- as.numeric(as.vector(X))
  15.  
  16. # Estimate the value of mu.
  17. n <- length(X)
  18. mu.est <- (X[n] - X[1])/n
  19.  
  20. if (!annualize) return(mu.est)
  21. else return(mu.est * 252)
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement