This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' @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) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment