Description Usage Arguments Details Value Examples
Calculate the density of mixture distribution, consisting each outer scenario distibution, with given weights.
1 |
x |
vector of random variables. |
beta |
vecotr of weights for each outer scenario distribution. |
outer |
vector of parameters simulated in outer scenario. |
df |
density functions for the class of distributions inner simulation random variables follow. |
The MLR density is equivalent to having beta as equal wights.
Density of the input random variable vector.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | library(functional)
r = 5e-2 # risk-free rate
S0 = 100 # initial stock price
vol = 30e-2 # annual volatility
tau = 1/12 # one month
T = 1 # time to maturity (from time 0)
N_Out = 10 # number of outer samples
T2M = T - tau
min <- qlnorm(1e-4, meanlog = (r-0.5*vol^2)*tau + log(S0), sdlog = (vol*sqrt(tau)))
max <- qlnorm(1-1e-4, meanlog = (r-0.5*vol^2)*tau + log(S0), sdlog = (vol*sqrt(tau)))
S_tau <- seq(from = min, to = max, length.out = N_Out)
mu <- log(S_tau) + (r-0.5*vol^2)*T2M
sig <- vol * sqrt(T2M)
df <- Curry(dnorm, sd = sig)
x <- seq(from = 4, to = 6, length.out = 10)
beta <- rep(1/N_Out, N_Out)
f.beta(x, beta, mu, df)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.