Presentation is loading. Please wait.

Presentation is loading. Please wait.

Líkön og mælingar – Fjármálaafleiður 1.1 Aðalbjörn Þórólfsson

Similar presentations


Presentation on theme: "Líkön og mælingar – Fjármálaafleiður 1.1 Aðalbjörn Þórólfsson"— Presentation transcript:

1 Líkön og mælingar – Fjármálaafleiður 1.1 Aðalbjörn Þórólfsson ath@alit.is

2 Líkön og mælingar – Fjármálaafleiður 1.2 Financial derivatives Stock price models and parameters (hlutabréfalíkön og kennistærðir) –Approx. 2 weeks –Simple models –Stochastic behavior (slembiferli) Financial derivatives (fjármálaafleiður) –Approx. 2 weeks –Introduction –The Black-Scholes model Bank visit and other material –Approx. 1 week

3 Líkön og mælingar – Fjármálaafleiður 1.3 Simple stock price models

4 Líkön og mælingar – Fjármálaafleiður 1.4 Price model 1 The value of a stock at a given time t  [t 0,T] is supposed to be a continuous real function: S : [t 0,T]  R The value of S(t 0 ) is known. The change in value with time is constant: dS =  dt or S(t) = S(t 0 ) +  (t- t 0 ) Limitation: Doesn’t allow fluctuations with time.

5 Líkön og mælingar – Fjármálaafleiður 1.5 Stochastic processes A variable whose value changes over time in an uncertain way is said to follow a stochastic process (slembiferli). In a Markov process, future movements of a variable depend only on where we are, not the history of how we got there. Stock prices are usually assumed to follow Markov processes.

6 Líkön og mælingar – Fjármálaafleiður 1.6 Basic Wiener process A variable Z follows a basic Wiener process if it has the following two properties: The change  Z during a small time period  t is  Z =   t where  is a random drawing from a standardized normal distribution  (0,1). The values of  Z for any two different short intervals of time  t are independent.

7 Líkön og mælingar – Fjármálaafleiður 1.7 The normal distribution Standardized form: Mean: = 0. Variance  = 1. Why the normal distribution? If X is the mean of N independent measurements of the same phenomena, then the distribution of X becomes normal as N  (central limit theorem). Examples: –Independent measurements of your height. –Stock price with no drift in the mean with time.

8 Líkön og mælingar – Fjármálaafleiður 1.8 Basic Wiener processes Advantage: Allows fluctuations with time. Limitation: Doesn’t show an average drift with time.

9 Líkön og mælingar – Fjármálaafleiður 1.9 Generalized Wiener process A generalized Wiener process for a variable S is defined by: dS = a dt + b dZ where dZ (=   dt) is defined as before. The discrete form is:  S = a  t + b   t where  is a random drawing from a standardized normal distribution  (0,1). A special case is b = 0, and we find model 1 for stock price:  S = a  t

10 Líkön og mælingar – Fjármálaafleiður 1.10 Price model 2 The change in value with time is based on the general Wiener process: dS =  dt +  dZ or, in a discrete form:  S =   t +    t where  is defined as before. Solution (T=t-t 0, N=T/  t): The change in S after a period T is normally distributed, has a mean =  T and a variance  =  2 T.

11 Líkön og mælingar – Fjármálaafleiður 1.11 Model comparisons Model 1 - Linear: S(t) = 1.0 * t Basic Wiener (no average drift with time): S(t) =   t Model 2 - General Wiener: S(t) = 1.0 * t + 1.0 *   t

12 Líkön og mælingar – Fjármálaafleiður 1.12 The factor  The factor  describes the amplitude of the stochastic behavior of stocks (volatility (flökt)), and thus how high the associated investment risk is: dS =  dt +  dZ The factor  actually depends on time, but can be taken as a constant when considering relatively short periods. The volatility can be estimated by: –The naked eye –Calculating the standard deviation of past data (see later) s dev =   =   T

13 Líkön og mælingar – Fjármálaafleiður 1.13 More realistic considerations In model 2, the drift and variability terms are independent of S(t). However, investors require a certain percentage return: dS ~ S  ’ dtor S(t)=S(t 0 )e  ’T with  ’=  /S(t 0 ). Also, the volatility term is, to a good appoximation, a percentage of the price: dS ~ S    dt

14 Líkön og mælingar – Fjármálaafleiður 1.14 Price model 3 (1) The change in value is proportional the value: dS = S  ’ dt + S  dZ Result of Ito’s lemma: The change in ln(S) after a period T is normally distributed, has a mean =(  ’-  2 /2)T and a variance  =  2 T.

15 Líkön og mælingar – Fjármálaafleiður 1.15 Price model 3 (2) S is log-normally distributed, with a mean and a variance How to calculate S: Note:  ’=  /S(t 0 ) gives a higher change than wished for. A better result is gotten with  ’=ln(  /S(t 0 ))

16 Líkön og mælingar – Fjármálaafleiður 1.16 Historic volatility Let u i =ln(S i /S i-1 ), i=0,1,...,N. This is the daily return in interval i, since S i =S i-1 e u i. An estimate of the variance of the u i ‘s (one interval) is: The variance (one interval) is  =  2  t, so an estimate of the volatility for a period T=N  t is:

17 Líkön og mælingar – Fjármálaafleiður 1.17 Assignment 1 Write programs that calculate and display the values of S(t) according to stock price models 1, 2 and 3. Get real one-year data from the web and determine S(t 0 ) and  (linear fit). Try to determine  by the naked eye and then by using the variance formula. Note that calculated  is only comparable to real data in model 3. Compare the values  /S(t 0 ),  and the return/risk ratio: (S(t)-S(t 0 ))/(S(t 0 )  )for two different companies. Are the  /S(t 0 ) and the returns comparable? Write and return a short report, including graphics and code.

18 Líkön og mælingar – Fjármálaafleiður 1.18 Tips (1) Data on bi.is or financialweb.com Use for example Excel, Perl and Gnuplot One year = 1. Linear fit: y = ax + b

19 Líkön og mælingar – Fjármálaafleiður 1.19 Tips (2) Standardized normal distribution: –If x 1 and x 2 are random variables between 0 and 1, then y 1 and y 2 are standardized and normally distributed if In model 3, the rise/fall tends to be overestimated if we use the obtained from linear fitting.

20 Líkön og mælingar – Fjármálaafleiður 1.20 Perl #!/usr/bin/perl#Launches the PERL compilator $file_in=$ARGV[0];#The first argument passed to the program $file_out = "data.dat";#Assign a filename open (INFILE,$file_in);#Relate INFILE with filename @ALL = ;#Read all the data into a vector close (INFILE);#Close the infile open (OUTFILE,">". $file_out);#Open for output for($k=1;$k<=$#ALL;$k++)#Loop over vector content { ($date,$day,$price,@rest) = split(/\s/,$ALL[$k]); #Split the fields on spaces $price =~ s/,/./;#Substitute. for, $day_norm = $day/365;#Normalize the time print (OUTFILE "$day_norm\t$price\n");#Output data } close (OUTFILE);#Close the outfile --- To debug code, type: perl –wc program.pl To run code, type:./program.pl infile.dat

21 Líkön og mælingar – Fjármálaafleiður 1.21 Gnuplot set terminal postscript landscape "Times-Roman" 22 set output “plot.ps“ set title “Title“ set ylabel "Value (kr/share)“ set xlabel "Time (years)" 0,-1 #set data style linespoints set data style lines #set nokey #set yrange [100:102.3] #set xrange [100:102.3] plot "data.dat“ using 1:2, 4.15 + 0.17*x --- To make a fit, start gnuplot, then type: f(x)=a*x+b fit f(x) ‘data.dat’ via a,b


Download ppt "Líkön og mælingar – Fjármálaafleiður 1.1 Aðalbjörn Þórólfsson"

Similar presentations


Ads by Google