# Tag Info

## Hot answers tagged monte-carlo

6

You probably wonder whether $\mathbb{E}^\mathbb{P}[P_T\mid\mathcal{F}_t]= \mathbb{E}^\mathbb{Q}[P_T\mid\mathcal{F}_t]$. Note the $T$ as index, i.e. the future unknown payoff and not the current price $P_t$. Now, why should $P_t$ be a martingale under both, $\mathbb{P}$ and $\mathbb{Q}$? Most likely, it is not. Indeed, the reason why you use $\mathbb{Q}$ in ...

6

Forward rates are determined from current spot rates bootstrapped from traded instruments. The reason is that if the forwards were different from the ones inferred from the spot rates, there would be arbitrage. For example, you can replicate a forward 6 month rate in 6 months with a long position in the one years rate and a short position in the 6 month ...

5

Just to add to the answer by @KeSchn : There are at least two things going on here. First of all let $\{Q_i \}$ denote a set of equivalent probability measures, which includes your $P$ and $Q$ above. Any $F^i(t)$ defined as $F^i(t) = E_t^{Q_i} [P_T]$ will be a martingale by application of the tower law. With the definition above, it will not be the case ...

4

Your code looks fine and it is encouraging that both MC simulations yield similar results. Please look at this simplified code for the analytical part of the Monte Carlo simulation. As you know, $$S_T=S_0\exp\left(\left(r-\frac{1}{2}\sigma^2\right)T+\sigma W_T\right).$$ A call is path-independent, so there is no need to simulate the entire path. I guess you ...

4

As with many things, particularly in machine learning and AI, I think you will find that these processes do not have a unique, logically or mathematically defined description. More so I would say that depending upon the context they can mean different things and might even mean the same thing. However, in my experience this is their most common usage. ...

4

Let the risk-neutral dynamics under your LV model be given by $$\frac{d S_t }{S_t } = \mu_t dt + \sigma(t,S_t) dW_t$$ Let's drop the drift contribution (not relevant here) and apply Itô's lemma to obtain: $$d \ln(S_t) = -\frac{1}{2}\sigma^2(t,S_t) dt + \sigma(t,S_t) dW_t$$ In order to simulate from this SDE, you need to choose a particular discretisation ...

4

There are two mistakes in the code: 1) In the line vt[t] = np.abs(vt[t-1] + kappa*(theta-np.abs(vt[t-1]))*dt + xi*np.sqrt(np.abs(vt[t-1]))*W_v[t]) you forgot to multiply W_v[t] by np.sqrt(dt). This is the reason the volatility increases so much. 2) The line St[t] = St[t-1]*np.exp((mu - 0.5*vt[t])*dt + np.sqrt(vt[t]*dt)*W_S[t]) should be St[t] = St[t-...

4

Simplest explanation is Feynman-Kac theorem https://en.wikipedia.org/wiki/Feynman%E2%80%93Kac_formula Blackscholes is a parabolic PDE Solution can be written as a conditional expectation over an integration term. Conditional expectation means you need to simulate it using some distribution which leads to monte-carlo

3

1) Do we need to deal with infinite dimensional spaces? Yes, I think you need an infinite dimensional pay-off space. Your remark that a finite sample spans a finite dimensional space of pay-offs is true. But you would like to prove convergence of the method for any pay-off, i.e. for all possible samples of all sizes. 2) In the case that we want to insist ...

3

In my understanding, the mortgage prepayment option, at any point in time, is a function of the value of the mortgage from that point in time forward. This value, in turn, is a function of the future evolution of the interest rates and any optimal decision taken by the mortgagor along that path and all paths that evolve from any future 'branch'. So in ...

3

There might be some differences in how we define things, but there should be only one set of assumptions (i.e., for each asset, there should be only one expected return and expected volatility). Your simulations, which generate potential realizations of returns, should conform to these expected returns and volatilities. It's also not necessary to run ...

3

Let's try a simple approach, ignoring the difference between sample and population variance, and assuming the process is just the standard brownian - with no drift and sigma term. Generalisation should be easy. We define a process Y as equal to standard brownian, but we are assuming finite sampling with difference between two observations equal to $\Delta t$...

3

We recently released qmcpy which does both Monte Carlo and quasi-Monte Carlo with guaranteed accuracy. For a MC/qMC problem in our framework you need to define your function, measure, discrete distribution (iid standard uniform, iid standard Gaussian, ...), and an algorithm to determine the number of points needed to meet your error tolerance. Lots of ...

3

The convergence of your monte carlo has little to do with the programming language you are using and is explained by the distribution and the central limit theorem. You should be able to implement the exact same thing in different languages. The best way to get a feel for the convergence would be to visualize it. import matplotlib.pyplot as plt from scipy....

3

The GBM model can be written as: $$\delta S_t= \mu S_t \delta t+\sigma S_t\delta t$$ The above is short-hand for the following SDE: $$S(t)=S(0)+\int^{t}_{0}\mu S(h)dh+\int^{t}_{0}\sigma S(h)dW(h)$$ Solving the above SDE yields an expression that you implemented in your code: $$S(t)=S_0exp\left((\mu-0.5 \sigma^2)t+\sigma \sqrt{t} Z\right)$$ The Black-...

3

Intuitively, they should both be short correlation, that is the less correlated the assets are the higher the value of the worst of/best of option. The best of option payoff is sandwiched by an exchange option payoff (plus other vanilla forward/option payoffs on single stock, insensitive to correlation):  X_T -K + (Y_T-X_T)^+ \leq \max(X_T - K ,Y_T - K,0) \...

2

It is happening because you're using the same (psuedo/quasi) random numbers for each time step. in your code here: def GBM(Ttm, TradingDaysInAYear, NoOfPaths, UnderlyingPrice, RiskFreeRate, Volatility): dt = float(Ttm) / TradingDaysInAYear paths = np.zeros((TradingDaysInAYear + 1, NoOfPaths), np.float64) paths[0] = UnderlyingPrice for t in ...

2

The code below is part of a VBA project I did to calculate VaR with Monte Carlo returns. If you eliminate the -1 at the end all values are positive. You just need to add your own risk free and standard deviation. Excel RAND() is same as VBA RND(). For i = 1 To 10000 stockReturn(i) = Exp((RiskFree - 0.5 * StDv ^ 2) + StDv * Application.NormInv(Rnd()...

2

...this technique works only when returns are generated from normal distributions? Yes and no. Multiplying them by $C$ will produce the correlation that you wanted, but it won't preserve the distribution in general. Remember that when we apply $C$ to a vector of i.i.d. random variables $\boldsymbol{x}$ that the resultant vector element is $\sum_j C_{ij}x_j$,...

2

To compliment some of the other answers and comments, I think it's useful to consider two other note worthy factors when deciding to do a PDE or MC approach. (Noting that if the dimensionality is high your hands are tied and MC methods are likely the only tracable means). If I were tasked with using MC or PDE methods these would be two considerations I would ...

2

what you are doing is not really an application of the central limit theorem (CLT) but rather an application of the law of large numbers. If I understood your problem correctly you start with the following information: The future discounting rate has a uniform distribution: $r \sim U(1\%, 20\%)$. The future capital has a uniform distribution: $k \sim U(500, ... 2 They are independent. The point is that$y$is derived from your easily sampled distribution$g$randomly. Now you have a random test (via$v$) that decides whether to accept$y$or not as part of the random sample of the harder to sample$f$. The procedure uses$M$in the accept-reject method and whilst you can derive conservative estimates with$M$quite ... 2 For the first question, you can just plug in t for T and S for K:$\sigma^2 \left(t, S \right)=\left. \sigma^2 \left(T,K\right) \right|_{T=t,K=S}$For the Monte Carlo part, the barrier would apply to the history of the stock price over some window (which could be from today to the option maturity, but other variations are possible) instead of just the ... 2 In order to test the convergence you can add the computation of confidence interval at a given probability. We add in the code the computation of the variance and the interval.$V\_T = \frac{1}{M-1} \times \sum (e^{-rT}C\_T - C\_0)^2I_M = [C_0-q\times \sqrt{\frac{V\_T}{M}}; C_0+q\times \sqrt{\frac{V\_T}{M}}]$With$M$the number of simulation and a ... 2 When you simulate a sample path of a standard Brownian motion, you are generating a sequence$(B_t)_{t \in \mathbb{\Pi}}$where$\mathbb{\Pi} := \{t_0, ..., t_n\}$is your time partition. You can view that sequence as$n$draws of the same random variable, although no one could say that this isn't also 1 draw each of$n\$ independent normal random variables. ...

2

The average of simulated discount factors from the Hull-White model and market discount factor are the same in theory but very similar in the simulation due to numerical error. I draw one figure which compares two discount factors and shows their difference. red line : mean of simulated discount factors blue line : market discount factor green line : ...

2

Yes, clearly when 2 countries have widely different inflation rates and interest rates we do observe a deterioration of the exchange rate between them over the long term (in the real world, not risk neutral world). For ex. CHF vs USD for last 50 years. In Economics there is a hypothesis called the Uncovered Interest Parity which claims this is generally true ...

2

Your simple approach is perfectly reasonable for (somewhat rough) single-period risk. However, when you compound it (via the random walk/brownian motion) you are not accounting for mean reversion of rates and will get risks that are too high, as you have found. Reasonable stochastic models for rates have mean-reversion terms in them that, at their simplest,...

1

You have to initialize the tenor matrix to zero instead of NA. If you compare a number with NA it will yield an NA. Evaluating NA like this in an if-statement gives the error described.

1

As you have already noted, the Delta-Gamma (DG) approximation, and its 'brother', the Delta-Gamma-Normal (DGN) are used to approximate the distribution of future portfolio returns, e.g. for the value at risk. At this point, let us have a look at the DG-approximation to the theoretical PnL of a portfolio of financial products as a function of a move of ...

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