DtD (version 0.1.0)

BS_fit: Fit Black-Scholes Parameters

Description

Function to estimate the volatility, \(\sigma\), and drift, \(\mu\). See vignette("Distance-to-default", package = "DtD") for details. All vectors with length greater than one needs to have the same length. The Nelder-Mead method from optim is used when method = "mle". Either time or dt should be passed.

Usage

BS_fit(S, D, T., r, time, dt, vol_start, method = c("iterative", "mle"),
  tol = 1e-12, eps = 1e-08)

Arguments

S

numeric vector with observed stock prices.

D

numeric vector or scalar with debt due in T..

T.

numeric vector or scalar with time to maturity.

r

numeric vector or scalar with risk free rates.

time

numeric vector with the observation times.

dt

numeric scalar with time increments between observations.

vol_start

numeric scalar with starting value for \(\sigma\).

method

string to specify which estimation method to use.

tol

numeric scalar with tolerance in get_underlying.

eps

convergence threshold.

Value

A list with the following components

ests

estimates of \(\sigma\), and drift, \(\mu\).

n_iter

number of iterations when method = "iterative" and number of log likelihood evaluations when method = "mle".

success

logical for whether the estimation method converged.

Examples

Run this code
# NOT RUN {
library(DtD)
set.seed(83486778)
sims <- BS_sim(
  vol = .1, mu = .05, dt = .1, V_0 = 100, T. = 1, D = rep(80, 20), r = .01)

with(sims,
     BS_fit(S = S, D = D, T. = T, r = r, time = time, method = "mle"))

# }

Run the code above in your browser using DataCamp Workspace