1. Trang chủ
  2. » Tài Chính - Ngân Hàng

Matematik simulation and monte carlo with applications in finance and mcmc phần 7 ppt

35 390 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Matematik Simulation and Monte Carlo with Applications in Finance and MCMC Part 7 PPT
Trường học University
Chuyên ngành Mathematics
Thể loại Lecture slides
Năm xuất bản 2023
Thành phố Unknown
Định dạng
Số trang 35
Dung lượng 598,21 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

a Using 5000 replications, each replication generating a primary and antithetic waiting time for five customers, the mean such time was 1.287 and the standard error was 0.00777.. To obta

Trang 1

9.5 Solutions 5

1 (a) Using 5000 replications, each replication generating a primary and antithetic

waiting time for five customers, the mean such time was 1.287 and the standard

error was 0.00777 The estimated variance reduction ratio is approximately 2.5

(b) Using the same seed, the corresponding results were 5.4751, 0.00820, and 14

The v.r.r is now better as Wiis now more linear in Aiand Si−1 than in (a) Why?

4 (b) (i) t= 28386

5 The conditional probability density function is

fXX∈a

i−1 aix= −N ln x

on support ai−1 ai, since for equiprobable intervals, P X∈ ai −1 ai= 1/N For

large N , there is little variation in f over ai−1 ai, except for i= 1, so a uniform

envelope is appropriate Therefore, for i≥ 2,

1 generate X∼ U ai−1 aigenerate R∼ U 0 1

if R < − ln X

− ln ai −1

deliver X else goto 1

For i= 1, we could continue to use inversion For large n this will not degrade the

Points are sampled uniformly over D by sampling uniformly over 0 1m and

then sorting the coordinates so that 0 < x1 < · · · < xm < 1 The Maple

code below shows the numerical derivation of a 95 % confidence interval

for the integral Note that the naive approach of sampling points uniformly

over 0 1m and accepting only those that lie in D would be hopelessly

inefficient

Trang 2

> for i from 1 to n do;

for j from 1 to m do;

1 Put call parity gives c t+Ke−rT−t= p t+x t e−r f T −t Using the result derived

for the delta of the corresponding call option,

2 Use put call parity with rf= 0 This gives (a) p = £12086, (b) p = £18638, and (c)

p= £26894 The seller of a put will initially hedge his or her position by having

Trang 3

a portfolio consisting of−1 put and  blocks of shares, where  = − −d (see

Problem 1) and d= r+ 2/2 T− t + ln xt/K /√

T− t The number ofshares shorted initially is (a) 328, (b) 440, and (c) 553

3 (a) Let P X T t x t denote the payoff for the bond holder at time T, given that

the current FTSE is at x t Then

XT  X0− 1  1≤ XT 

than of X T  and let

Trang 4

d2 = ln16/b-r-05∗sigmaˆ2∗T-t/sqrtT-t/sigma;

P = 05∗b∗expr-05∗sigmaˆ2∗T-t

+sigma∗sqrtT-t∗z-1∗exp-05∗zˆ2/sqrt2∗Pi;

price = exp-r∗T-t∗1+ intP z = d1d2

to Ke−rTertso the value of portfolio A is Ke−rT−t+ V x t  t while that of B

is x t Equating these two gives the desired result

(b) We have V/x t= 1, V/t = r V x t  t − x t , and 2V/x t2= 0; theresult follows by substitution

(c) A portfolio that is a long one forward contract and a short one share will havethe value at time t given by V x t  t− x t = −Ke−rT−t Since there is no

uncertainty in−Ke−rT−t for all t∈ 0 T , the hedge is perfect In practice thehedge involves, at time zero, selling short one share for x 0 A forward contract

is purchased for V x 0  0= x 0 − Ke−rT, leaving an amount of cash Ke−rT.

This grows to K at time T , which is used at that time to meet the obligations onthe forward contract and to the initial lender of the share

(d) The delivery price K is now such that V x 0  0= 0 The contract at time zerohas zero value No money passes between A and B at that time This is a standardforward contract

5 At time zero, the writer of the option sets up a portfolio consisting of a−1 call optionand  0 shares The share purchase is financed by borrowing  0 X 0 At time

T this has grown to  0 X 0 erT At time T , if X T  > K, then a further 1− 0shares are purchased at a cost of 1−  0 X T Since the customer will exercisethe option, the writer will sell the one share for K The total cost at time T of writingand hedging the option in this case is

 0 X 0 erT+ 1 −  0 X T − K

Otherwise, if X T ≤ K at time T, the writer will sell the existing  0 shares,obtaining  0 X T  The total cost of writing and hedging the option in this case is

 0 X 0 erT−  0 X T Bringing these two results together, the total cost is

 0 X 0 erT−  0 X T + X T − K +

Trang 5

The present value of this is

and this is plotted in Figure 9.4

Notice that when = r, there is no difference between the expected cost of writing

and hedging the option in this way and the Black–Scholes price

5 10 15 20 25 30

mean penalty cost

mu

Figure 9.4 Plot of EC− c against , problem 6.5

Trang 6

n i=1n− i + 1Zj

n i=1n− i + 12

9 (a) We have that

c= e−rTE

Y ∼N0I



1n

Trang 7

where Zj=j

i=1Yi/√

j∼ N 0 1 for j = 1  n This is clearly the price of

a basket option with quantities 1/n of each asset, where the correlation on the

returns between assets j and m ≥ j is

Cov

Zj Zm = Cov

j i=1Yi

j 

m i=1Yi

√m



=√1jm

creates the correlation matrix of returns between the 16 equivalent assets

> n:= 16 r: = 005 x: = Vectorn sigma: = Vectorn q: = Vectorn;

From the resulting 100 replications, using basketimppoststrat seed= 9624651,

each consisting of 400 payoffs over 20 strata, a price of 4.1722 with a standard

error of 0.0014 was obtained This compares with a value of 4.1708 and standard

error of 0.00037 using 100 replications, each consisting of 2500 replications over

100 strata, as given in Table 6.2 Bearing in mind the different sample sizes and

the sampling error, there is little to choose between the two approaches

10 (a) Suppose Y = 0 In the usual notation, an Euler approximation scheme is (in a

risk-neutral world)

X T ≈ x0e

 n j=1r− 2

j /2h+ j

√ h

of N 0 1 random variables

Trang 8

(b) (i) Antithetics can be implemented with ease at little extra cost, but the

improvement may be unimpressive in many cases

(ii) Stratification may be promising for certain parameter values The distribution

of Yn given Y0is normal, so post-stratified sampling on Yn may be of somevalue for slow mean reverting processes

(iii) However, the method likely to be most successful is to note that conditional

on W1  Wn 1  n,

Xn= X0e

 n j=1

r− 2

j /2h+ j

√ h

√

1− 2 Z j +W j



Put Z=n

j=1j

hZj/n j=1j2h1/2∼ N 0 1 Then

n j=1jWj Then

s, and where the risk-free interest rate is r Then

of consumption and is trivially a discrete state continuous time system duringperiods of abstinence

2 (b) The ith event is at Ti = 1/ ln 1+ #ie− where 

#ifollow

a simple Poisson process of rate one Stop at event numbermax

i  #i< 1/e

et0− 1

3 It is probably easiest and quite efficient to use rejection of points falling in therectangle x y  x

Trang 9

7 To obtain the theoretical result, let mi denote the mean time to absorption given the

current state is i Then mi= 1+4

j=ipijmjfor i= 1  4 The expected life of theequipment is m1

8 Since N t+ K t + D t is a constant for all t ≥ 0 the state is uniquely

represented by any two state variables, say N t  K t The ‘leaving rate’

for state n k is = nkp + n2+ k1 and so, given that N t  K t=

n k, the next event is at time t− −1ln R, where R ∼ U 0 1, and

the state immediately after that event will be either n− 1 k + 1 or

n− 1 k or n k − 1 with probabilities nkp/ n2/ k1/ respectively

Simulate realizations of the epidemic by setting N 0  K 0 = N − 1 1

say

12 (a) Given that there is an accident in t t+ $t, the conditional distribution of R, the

distance of occurrence from the hospital, is given by

(patients) forming one queue Bound state changes are customer arrivals

(emergencies) and customer departures (patients deposited at the hospital)

Conditional state changes are starts of service (ambulances despatched to

patients) For each of the five ambulances it is necessary to store (i) the time

at which it next deposits a patient at the hospital and (ii) the time at which

the patient incurred the emergency Suppose these are called TD j and TA j

A 1 = sort A k  k

q = q − 1

b = b + 1end ifEnd do

13 The bound state changes are machine breakdowns, completion of machinerepairs, and completion of machine tests Conditional state changes are repairstarts and testing starts Let the time of the next state change for machine

j be T j Let the state of machine j be S j = 1 2 3 4 5 according towhether it is working, in the repair queue, being repaired, in the testing

queue, or being tested respectively Let nw,nr, and nt denote the number of

machines working, the number of repairmen who are free, and the number

of testers who are free respectively Let qr and qt denote the number of machines in the repair queue and testing queue respectively Let clock and clockprev denote the current simulation time and time at the previous event

respectively

If working periods happen to be exponentially distributed, then regenerationpoints would exist at those events where the number of working machines changesfrom m−1 to m Otherwise, regenerative analysis cannot be used, since the onlyregenerative points (assuming steady state behaviour) are those instants at whichall machines are returned simultaneously to the working state – an impossibilitywith continuous random variables Therefore, a proper analysis should plot

nw against clock and identify a burn-in period, tb Then a point estimate of

the long-run average utilization will be 1/ m simtim simtim

tb nw t dt

A confidence interval may be obtained by replicating a large number of

realizations over identical values of simtim and tb, preferably starting in different

states

14 (a) Bound events are customer arrivals, customer departures from window A,and customer departures from window B Conditional events are the start ofservice at window A, the start of service at window B, a queue-hop from A

to B, and a queue-hop from B to A

(c) Regeneration points are when one server is idle and the other one becomesidle If the traffic intensity is not too close to 1, these will occur frequentlyenough to allow a regenerative analysis

15 This is similar to Problem 13, but here the individual waiting times need to berecorded

Trang 11

−y 2 /2e−x

e−x2 /2e−y



and it is found that xi

4 The overall acceptance rate is very low, being of the order of 2.5% This is because

the posterior is so different from the prior which provides a very poor envelope On

the other hand, inspection of the plots for the sequence

isay, (Appendix 8.2), forthe MCMC independence sampler shows that the acceptance rate, although poor, is

not quite so low (approximately 7.5 %) In the independence sampler the probability

of acceptance of a candidate point c c is min 1 L c c /L   where

  is the current point This is always greater than L c c /Lmax, the acceptance

probability using envelope rejection Offset against this is the fact that envelope

rejection gives independent variates, whereas MCMC does not

6 (c) Sometimes it is difficult to find a uniform bound c for h x /g x in standard

envelope rejection Part (b) suggests that variates from a density proportional to

h can be sampled using Metropolis–Hastings with the usual disadvantage that

variates will not be independent However, each time h y /g y > c, we can

update c to h y /g y In the limit (after many proposal variates), c becomes

a uniform bound and the variates produced by Metropolis–Hastings become

independent

7 Let y and s2denote the sample mean and variance of y1  yn

is based upon the following full conditionals:

21 2

density, that is a chi-squared variate with one degree of freedom Then put x1=

z2 where z1 ∼ N 0 1 and x2∼ N 0 1/x1 The other is to sample from the

marginal of X2 which has a Cauchy density Therefore x2= tan /2 2R2− 1

where R2∼ U 0 1, and then put x1= −2 ln R1/1+ x2 where R2∼ U 0 1

Either of the direct methods is better than Gibbs sampling, for the usual reason

that the former produces sequences of independent variates The first direct

Trang 12

method is probably preferred, due to the prevalence of efficient standard normalgenerators.

$

yi2− 2 ln R2

"

,where R1 R2 R3∼ U 0 1

Trang 13

18 (e) The posterior predictive survival probability is

PpostX > x= E

!  x

Trang 15

Let x¼ y= ffiffiffi

2

p Then the integral becomes

I¼ 1ffiffiffi2p

Z 1

1

eðy2=2Þ cos yffiffiffi

2p

Trang 16

> s:=v*describe[standarddeviation[1]]([c]);

s :=0.4421267288

26

> interval:= evalf([mu-1.96*s/sqrt(n), mu+1.96*s/sqrt(n)]);

interval :=[1.361669569, 1.416476167]

26

Trang 17

> seed:=randomize(567);

u:=evalf(sqrt(2)):n:=500;

for i from 1 to n do:

x:=stats[random,normald](1);z:=stats[random,normald](1):

A machine tool is to be scrapped 4 years from now The machine contains a

part that has just been replaced It has a life distribution with a time-to-failure

density fðxÞ ¼ x ex on supportð0; 1Þ Management must decide upon one

of two maintenance strategies The first is to replace the part whenever it fails

until the scrapping time The second is to replace failures during the first two

years and then to make a preventive replacement two years from now

Following this preventive replacement the part is replaced on failures

occur-ring duoccur-ring the second half of the 4 year span Assume that replacements are

instantaneous and cost cf on failure and cp on a preventive basis Simulate

5000 realizations of 4 years for each policy and find a condition on cp=cf for

preventitive replacement to be the preferred option

Trang 18

For the second strategy we obtain the number of failures during 10 000periods, each of 2 years duration.

Trang 19

For the first strategy the expected cost over 4 years is cf8851=5000and

for the second it is cpþ cf7577=5000 Therefore, it is estimated that

preventive replacement is better when cp=cf < 637=2500

Two points A and B are selected randomly in the unit square½0; 12 Let D

denote the distance between them Using Monte Carlo:

(a) Estimate EðDÞ and V arðDÞ

(b) Plot an empirical distribution function for D

(c) Suggest a more efficient method for estimating PðD > 1:4Þ, bearing in

mind that this probability is very small

> distance:=proc(n) local j,x1,x2,y1,y2,d;

for j from 1 to n do;

Trang 20

> mean:=evalf(describe[mean]([f]));

mean :=0.5300028634

26

> stddev:=evalf(describe[standarddeviation[1]]([f]));

stddev :=0.2439149391

26

> std_error_of_mean:=evalf(stddev/sqrt(n));

std_error_of_mean :=0.007713267629

26

6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 4

> PLOT(CURVES([e]),TITLE("Empiricalc.d.f."),AXESLABELS("distance","prob."),AXESSTYLE(BOX));

0

1

266666666666666666664

6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 4

... compares with a value of 4. 170 8 and standard

error of 0.000 37 using 100 replications, each consisting of 2500 replications over

100 strata, as given in Table 6.2 Bearing in mind the... sell the existing  0 shares,obtaining  0 X T  The total cost of writing and hedging the option in this case is

 0 X 0 erT−  0 X T Bringing these two results... state of machine j be S j = 1 2 3 4 according towhether it is working, in the repair queue, being repaired, in the testing

queue, or being tested respectively Let nw,nr, and nt denote

Ngày đăng: 09/08/2014, 16:21

TỪ KHÓA LIÊN QUAN

🧩 Sản phẩm bạn có thể quan tâm