# Tag Info

6

the problem is that the pay-off has discontinuous first derivative. Try a contract with pay-off that is twice differentiable and it will probably work. The problem is that all the value comes from the tiny number of paths within $\Delta S$ of the strike, and these paths have huge value. This is a well-known problem. As the bump size goes to zero, the ...

6

You have the right idea, but it seems you don't know $\mu$, so using it in your error check doesn't seem correct. Also, checking the result every 10,000 iterations may not be optimal for deciding when to stop. To be clear, let $E(X) = \mu$ and $Var(X) = \sigma$. We're invoking the CLT when we write P\left( \left|\frac{\bar{X}_n - ... 6 It really, really, really depends on your parameters, i.e. r, \sigma, K, T, S_0. For example, here are some results from implementing the stopping criteria I explain in my answer here. These are the number of iterations requires in order for there to be an approximate 0.95 probability that the MC call price differs from the exact call price by ... 5 By definition the fair value of an option is given by an expectation value of the payoff, \mathbf{E}\left[\textrm{payoff}(\textit{paths})\right]. The probability distribution of the paths is the risk neutral measure. This is just an integral expression of the form you wrote. This applies to all option prices. Many options are, of course, special in the ... 5 importance sampling is well known to be tricky. See the extensive discussion in Glasserman's book. I presume that you are simply meanshifting and multiply by the ratio of normal densities. For this sort of problem, I'd use a more stratified algorithm instead and force every path to end in the money. To do this I'd compute the uniform that goes to the ... 5 I wouldn't repeat the same algorithm on Excel, because if you make a mistake in your Python code, it's likely that you'll also make the same mistake in your Excel code. Quants usually test an implementation with an analytical formula (not always possible). You should start off with something easy by pricing an European option with your MC algorithm. You ... 5 American calls on a non-dividend paying stock are worth the same as European ones so there is no point to using least-squares. 4 the LIBOR market model the Heston model -- Euler and Milstein are actually bad for this and much more sophisticated methods are necessary local volatility models 4 You don't need to use the Sobol sequence to generate quasi-random numbers in MATLAB. We know the Heston model is represented by the bi-variate system of stochastic differential equations (SDE): \begin{align} & d{{S}_{t}}=rS_tdt+{\sqrt\upsilon_t} d{{W}_{1}}(t) \\ & d{{\upsilon}_{t}}=\kappa(\theta-\upsilon_t) ... 4 First you need to correct the formula to: W_t^2 = \rho W_t^1 + \sqrt{1-\rho^2} Z_t, $$where Z_t is a BM independent of W_t^1 If you calculate the variance and the covariance, then you see that it is true:$$ V[W_t^1] = t $$and$$ V[W_t^2] = \rho^2 t + 1-\rho^2 t = t, $$which is the desired variance. For the covariance you get$$ Cov[W_t^1,W_t^2] ...

4

Here is the general approach you can follow to generate two correlated random variables. Let's suppose, X and Y are two random variable, such that: $$X \sim N(\mu_1, \sigma_1^2)$$ $$Y \sim N(\mu_2, \sigma_2^2)$$ and $$cor(X,Y)=\rho$$ Now consider: $y=bx + e_i$, where $x$ $(=\frac{X-\mu_1}{\sigma_1}$) and $y$ $(=\frac{Y-\mu_2}{\sigma_2}$) both follow ...

3

In inflation world, the deal payoff is always based on a certain lag convention. That is, the value $I(T)$ always refers to a published index level several months ago or is interpolated based on those published index levels. For example, for a payoff on July 15, 2015, the indexed level referred is the published index level for May, 2015, based on the 2m ...

3

Yes, your solution is correct, given the implementation of McSimulation and the interface of SequenceStatistics. We should probably have defined SequenceStatistics as returning instances of Array... As you might have seen, trying to return std::vector<Real> from the path pricer wouldn't work; the result type needs to define arithmetic operations such ...

3

Sigh. I'm not sure that there's a best way to do multi-threaded MC in QuantLib. I'm afraid that you're underestimating the amount of development you'd need for option 2. You're not going to get away with some OpenMP code as you suggest, because calculations on different paths are not trivially parallel: the RNGs we have are not parallel, and even if you ...

3

You can calibrate the model by discretizing in time, and using a forward induction method as originally proposed by Jamishidian in 1991: F.Jamshidian, Forward Induction and Construction of Yield Curve Diffusion Models, J.Fixed Income 6, 62-74 (1991). Although he formulated this induction in the language of the binomial tree, the method is more general, and ...

3

Yes you can! Any SDE that has an analytic solution can be simulated exactly. The vasicek model has dynamics $dr=a(b-r)dt+\sigma dW_t$. By Ito's lemma, $$d\left(e^{at}r\right)=e^{at}\left(a(b-r)dt+\sigma dW_t\right) +a e^{at} r dt$$ Simplifying, $$d\left(e^{at}r\right)=e^{at} ab +e^{at}\sigma dW_t$$ Integrating, e^{aT} r_T=r_0+b(e^{aT}-1)+\sigma \int_0 ... 3 you just add in any auxiliary variables accumulated along the path that determine the pay-off to the regression variables. So path-dependence is not a problem. If you have previous decisions, you may need to do different regressions based on their possible values or make them into a continuous variables that can be used for regression. 3 A butterfly in general has a payoff of the form \begin{align*} (X_T-K_c)^+ + (K_p-X_T)^+-(X_T-K_{atm})^+-(K_{atm}-X_T)^+, \end{align*} where X_T is the asset value at maturity T, while K_c, K_p, and K_{atm} are strike levels. 3 I believe the question to be too vague to be a good interview question. If you want to do Mean Variance Optimization (MVO) it's hard to see the point of Monte Carlo simulation. One of the good thing of MVO is its analytic tractability. Clearly, the topic is not widely discussed as this Google Search has this question as the first result (I was in incognito ... 2 For a swap, we have a sequence of re-setting and payment dates. The # of forward rates corresponding to the # of payment dates. For example, let us assume that we have n payment dates t_1, \ldots, t_n, where 0< t_1 < \cdots < t_n. Then there are n forward rates. During the simulation, for time steps prior to t_1, there exist n ... 2 For non-normal asset price models you could look at the theory of Lévy-processes. If we assume that you work in the physical probability measure P and that the random numbers that you have generated are daily log-returns, then you can do the following: Asset i has starting price S_0^i and for the future prices you can put S_t^i = S_0^i ...

2

You don't say anything about the model or discretization so it is a little hard to judge. However, if you are using an exact discretization, the time step-size should be irrelevant. If you are using an approximate one, the more steps you use, the more accurate it should get. Possible sources of error: 1) random number generator is not good enough and ...

2

First let me say that in the Black-Scholes model as you have it, there is of course no need for intermediate steps when pricing vanilla calls, since the SDE has the closed-form solution you included. Intermediate steps would be required for complicated payoffs or other SDEs. To answer your question though, you do need to use additional dimensions. Think ...

2

This will depend on the nature of the problem. You already mention a perfectly good strategy - observe your current estimate after N samples - did it change significantly? If you have a grasp of the scale of the answer to the problem then you may be able to set a convergence criteria on the basis of this change. However let's say you have a far out of the ...

2

Since you are using geometric brownian motion (GBM) as your model, there is a strong (and therefore weak) solution to the SDE. That is to say, your simulation that presumably looks like $$S^A_T \sim S^A_0 \exp\left( \left(r-q-\frac12 \sigma^2\right) T + z \sigma \sqrt{T} \right)$$ for standard gaussian $z$ has precisely the correct distribution. ...

2

This question has already been answered on Stack Overflow. As it is important to Quant Finance, so I have added R code here. Others users may add code of other programming software to simulate ARMA(1,0)-GARCH(1,1) model. sim.GARCH <- function( horizon=5, N=1e4, h0 = 2e-4, mu = 0, omega=0, alpha1 = 0.027, beta1 = 0.963 ){ ret <- zt ...

2

As your code works for the short maturity case, I assume that it is correct. The volatility of $80 \%$ is simply huge. Thus the area covered by the paths is huge too. As you can read e.g. here the sampling error is proportional to the variance of the process, which is huge in your case. As a brute force solution you can just enlarge the number of samples. ...

1

You need to use more dimensions. If the number of dimensions (i.e. steps) is large, you may also have to use a Brownian bridge as described in the book by Joshi or Jäckel.

Only top voted, non community-wiki answers of a minimum length are eligible