# BS_fit: Fit Black-Scholes Parameters In DtD: Distance to Default

## Description

Function to estimate the volatility, σ, and drift, μ. 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

 ``` 1 2 3 4 5 6 7 8 9 10 11 12``` ```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 σ. `method` string to specify which estimation method to use. `tol` numeric scalar with tolerance to `get_underlying`. The difference is scaled if the absolute of `S` is large than `tol` as in the `tolerance` argument to `all.equal.numeric`. `eps` numeric scalar with convergence threshold.

## Value

A list with the following components

 `ests` estimates of σ, and drift, μ. `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.

## Warning

Choosing `tol >= eps` or roughly equal may make the method alternate between two solutions for some data sets.

## Examples

 ```1 2 3 4 5 6 7``` ```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")) ```

DtD documentation built on March 26, 2020, 7:45 p.m.