Download FIN285a: Problem Set 3

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
FIN285a: Problem Set 3
Fall 2004
Due Monday, October 11th
1. You have been observing a stock whose return you assume to be normal with mean 0.05 (5
percent), and standard deviation of 0.15. You currently have received two samples of 50 returns
each. Your second set of returns has both a higher mean, and a higher median. They have both
increased by 3 percent. What is the probability of observing both the mean and the median increase
by 3 percent across these two samples? Estimate this with a monte-carlo experiment, drawing
normal random numbers from the above distribution (null hypothesis) from the appropriate sample
length. Perform this monte-carlo experiment for 100,000 iterations to estimate the probability of an
increase in the mean of 3 percent or greater, an increase in the median of 3 percent or greater, and
an increase in both of 3 percent or greater. Was it worth your while to use both numbers in your
experiment?
Program:
% Create matrices s1, s2, mean_s and median_s to make program running faster.
s1=zeros(1,50);
s2=zeros(1,50);
mean_s = zeros(100000,2);
meadian_s = zeros(100000,2);
%Run 100000 iterations and in each iteration draw 2 samples with 50
% elements in each. Calculate mean and median for each sample.
for i=1:100000
s1 = normal(50,0.05,0.15^2);
s2 = normal(50,0.05,0.15^2);
mean_s(i,:) = [mean(s1) mean(s2)];
median_s(i,:) = [median(s1) median(s2)];
end
test1 = proportion(mean_s(:,2)-mean_s(:,1)>=0.03)
test2 = proportion(median_s(:,2)-median_s(:,1)>=0.03)
test3 = proportion(mean_s(:,2)-mean_s(:,1)>=0.03 & median_s(:,2)-median_s(:,1)>=0.03)
Results:
test1 = 0.1574
test2 = 0.2086
test3 = 0.1149
2. You are monitoring the positions of FX traders at a large commercial bank. You know that the daily
percentage changes in the value of each trader's portfolio is a normal random variable with mean
zero, and standard deviation of 0.05. Your traders all start with a portfolio value of 100, and you
will monitor them over the next 40 days (2 months).
1. Run a monte-carlo experiment of 100,000 interations, and report the mean, median, and
percentiles 0.1, and 0.9 of the portfolio value at the end of 40 days. Plot a histogram too
using 100 bins. (Note: You will probably find the matlab function prod() useful for this
problem. prod gives you the product of a vector. If r is a return, then prod(1+r) is a useful
object.)
Program:
endpos = zeros(100000,1);
r = zeros(40,1);
for i = 1:100000
r = normal(40, 0, 0.05^2);
end_pos(i) = 100*prod(1+r);
end
m = mean(end_pos)
med = median(end_pos)
p_10 = percentile(end_pos, .1)
p_90 = percentile(end_pos, .9)
histogram(end_pos,100)
Results:
m =100.0329
med = 95.3683
p_10 = 63.3937
p_90 = 142.2701
2
2. Now you are continuously monitoring traders. You will stop all traders when their portfolios
go below 80. Report the same stastics and histogram for this case. If a portfolio doesn't go
below 80, you use the final value. If it drops below 80, you can assume that the trader was
stopped at exactly 80. (Note: Here you will find the matlab function cumprod() useful. This
gives a running product. We'll talk about this in class.)
Program:
endpos = zeros(100000,1);
r = zeros(40,1);
pos = zeros(40,1);
for i = 1:100000
r = normal(40, 0, 0.05^2);
pos = 100*cumprod(1+r);
if any(pos<=80)
end_pos(i) = 80;
else
end_pos(i) = pos(end);
end
end
m = mean(end_pos)
3
med = median(end_pos)
p_10 = percentile(end_pos, .1)
p_90 = percentile(end_pos, .9)
histogram(end_pos,100)
Results:
m = 101.2995
med = 85.7331
p_10 = 80
p_90 = 142.3144
4
Related documents