#' Probability density function for Black-Scholes dynamics
#'
#' @param x log-return
#' @param t time in trading years
#' @param rate rate of return
#' @param volat volatility
#'
#' @description {The probability density function of the log-return of an asset following
#' a geometric Brownian motion.}
#' @return numeric
#' @export dblackscholes
dblackscholes <- function(x, t, rate, volat)
{
drift <- (rate-0.5*volat^2)*t
volatility <- sqrt(t)*volat
return(stats::dnorm(x, drift, volatility))
}
#' Cumulative distribution function for Black-Scholes dynamics
#'
#' @param x log-return
#' @param t time in trading years
#' @param rate rate of return
#' @param volat volatility
#'
#' @description {The cumulative distribution function of the log-return of an asset following
#' a geometric Brownian motion.}
#' @return numeric
#' @export pblackscholes
pblackscholes <- function(x, t, rate, volat)
{
drift <- (rate-0.5*volat^2)*t
volatility <- sqrt(t)*volat
return(stats::pnorm(x, drift, volatility))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.