Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #' @title Estimator for the value of mu. Mu is the drift component in the
- #' Geometric Brownian Motion model.
- #'
- #' @description Given a log price process, this function estimates the value of
- #' mu. Mu is the daily component of the returns which is attributable to upward,
- #' or downward, drift. This estimate can be annualized.
- #'
- #' @param X vector :: A log price process.
- #' @param annualize logical :: Annualize the parameter estimate.
- #' @return mu.est double :: The estimated value of mu.
- #'
- calibrateMu <- function(X, annualize = TRUE) {
- # Ensure the format of X is appropriate.
- X <- as.numeric(as.vector(X))
- # Estimate the value of mu.
- n <- length(X)
- mu.est <- (X[n] - X[1])/n
- if (!annualize) return(mu.est)
- else return(mu.est * 252)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement