Question: % ParametersS 0 = 1 2 ; % Initial stock pricev 0 = 0 . 0 1 ; % Initial volatilityr = 0 . 0

% ParametersS0=12; % Initial stock pricev0=0.01; % Initial volatilityr =0.025; % Risk-free interest rateT =1; % Time to expirationK =10; % Strike pricekappa =1.2;theta =0.04;sigma =0.3;rho =-0.3;% Number of time steps and pathsN =1000; % Number of time stepsM =10000; % Number of paths% Time vectordt = T / N;t =0:dt:T;% Generate correlated Wiener processesdW1= randn(M, N)* sqrt(dt);dW2= rho * dW1+ sqrt(1- rho^2)* randn(M, N)* sqrt(dt);% Initialize matrices to store stock prices and volatilitiesS = zeros(M, N+1);v = zeros(M, N+1);% Set initial conditionsS(:,1)= S0;v(:,1)= v0;% Simulate paths using Euler-Maruyama methodfor i =1:N S(:,i+1)= S(:,i).* exp((r -0.5* v(:,i))* dt + sqrt(v(:,i)).* dW1(:,i)); v(:,i+1)= v(:,i)+ kappa *(theta - v(:,i))* dt + sigma * sqrt(v(:,i)).* dW2(:,i); v(:,i+1)= max(v(:,i+1),0); % Ensure volatility is non-negativeend% Plot a sample path of stock price and volatilityfigure;subplot(2,1,1);plot(t, S(1,:),'b');xlabel('Time');ylabel('Stock Price');title('Sample Path of Stock Price');subplot(2,1,2);plot(t, v(1,:),'r');xlabel('Time');ylabel('Volatility');title('Sample Path of Volatility');% Calculate discounted payoff for each pathpayoff = max(S(:,end)- K,0).* exp(-r * T);% Compute option priceoption_price_european = mean(payoff);% Display option pricedisp(['European Call Option Price (Standard Monte Carlo): ', num2str(option_price_european)]);% Define the digital call option payoff functiondigital_payoff = @(S, K) double(S > K);% Calculate discounted payoff for each pathdigital_payoff_values = digital_payoff(S(:,end), K).* exp(-r * T);% Compute option priceoption_price_digital = mean(digital_payoff_values);% Display option pricedisp(['Digital Call Option Price: ', num2str(option_price_digital)]);% Calculate discounted payoff for each path for European call optionPayoff_European = max(S(:,end)- K,0).* exp(-r * T);% Control variate: European call option price at expirationControl_Variate_European = exp((r -0.5* theta)* T)* S(:,end)- K * exp(-r * T);% Compute control variate coefficient for European call optioncovXY = cov(Payoff_European, Control_Variate_European);beta_European =-covXY(1,2)/ var(Control_Variate_European);% Adjusted Payoffs using Control Variates for European call optionPayoff_European_Adjusted = Payoff_European + beta_European *(Control_Variate_European - mean(Control_Variate_European));% Compute option price with Control Variates for European call optionPrice_European_CV = mean(Payoff_European_Adjusted);% Calculate discounted payoff for each path for digital call optionPayoff_Digital =(S(:,end)> K).* exp(-r * T);% Control variate: Digital call option price at expirationControl_Variate_Digital =(S(:,end)> K).* exp(-r * T); % Same as the payoff for digital call% Compute control variate coefficient for digital call optioncovXY = cov(Payoff_Digital, Control_Variate_Digital);beta_Digital =-covXY(1,2)/ var(Control_Variate_Digital);% Adjusted Payoffs using Control Variates for digital call optionPayoff_Digital_Adjusted = Payoff_Digital + beta_Digital *(Control_Variate_Digital - mean(Control_Variate_Digital));% Compute option price with Control Variates for digital call optionPrice_Digital_CV = mean(Payoff_Digital_Adjusted);% Display resultsdisp(['European Call Option Price with Control Variates: ', num2str(Price_European_CV)]);disp(['Digital Call Option Price with Control Variates: ', num2str(Price_Digital_CV)]);% Compute MLMC estimatorsMC_estimator_European = mean(Payoff_European_Adjusted)- mean(Payoff_European);MC_estimator_Digital = mean(Payoff_Digital_Adjusted)- mean(Payoff_Digital);% Display resultsdisp(['European Call Option Price (MLMC): ', num2str(MC_estimator_European)]);disp(['Digital Call Option Price (MLMC): ', num2str(MC_estimator_Digital)]);% Compute MLMC estimators without antithetic treatmentMC_estimator_European_without_antithetic = mean(Payoff_European_Adjusted)- mean(Payoff_European);MC_estimator_Digital_without_antithetic = mean(Payoff_Digital_Adjusted)- mean(Payoff_Digital);% Display resultsdisp(['European Call Option Price (MLMC without Antithetic Treatment): ', num2str(MC_estimator_European_without_antithetic)]);disp(['Digital Call Option Price (MLMC without Antithetic Treatment): ', num2str(MC_estimator_Digital_without_antithetic)]);% Apply antithetic treatmentS_fine_antithetic = S0* ones(N +1, M);v_fine_antithetic = v0* ones(N +1, M);dW1_fine_antithetic =-dW1; % negate dW1 for antithetic variatesdW2_fine_antithetic =-dW2; % negate dW2 for antithetic variatesfor i =1:length(sample_sizes) M = sample_sizes(i); % Re-simulate paths with new sample size dW1= randn(M, N)* sqrt(dt); dW2= rho * dW1+ sqrt(1- rho^2)* randn(M, N)* sqrt(dt); S = zeros(M, N+1); v = zeros(M, N+1); S(:,1)= S0; v(:,1)= v0; for j =1:N S(:,j+1)= S(:,j).* exp((r -0.5* v(:,j))* dt + sqrt(v(:,j)).* dW1(:,j)); v(:,j+1)= v(:,j)+ kappa *(theta - v(:,j))* dt + sigma * sqrt(v(:,j)).* dW2(:,j); v(:,j+1)= max(v(:,j+1),0); end % European option payoff_european = max(S(:,end)- K,0).* exp(-r * T); option_prices_european(i)= mean(payoff_european); % Digital option digital_payoff_values = digital_payoff(S(:,end), K).* exp(-r * T); option_prices_digital(i)= mean(digital_payoff_values);end% Plot convergence graphsfigure;subplot(2,1,1);plot(sample_sizes, option_prices_european, 'bo-');xlabel('Sample Size');ylabel('Option Price');title('Convergence of European Call Option Price');subplot(2,1,2);plot(sample_sizes, option_prices_digital, 'ro-');xlabel('Sample Size'

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!