Professional Documents
Culture Documents
Financial Econometrics
Financial Econometrics
Financial Econometrics
Semester 2, 2023/24
Returns
Recap
−1
kY −1
kX
k-Period Return Rt (k) = (1 + Rt−i ) − 1 rt (k) = rt−i
i=0 i=0
Annualised Return Annu. Rt (12) = (1 + Rt )12 − 1 Annu. rt (12) = rt × 12
N
X XN
Portfolio Return RPt = wi Rit rPt = log wi erit
i=1 i=1
Load data
+-------------------------+
| datevec msoft wmart |
|-------------------------|
1. | 1990m4 .8 5.26 |
2. | 1990m5 1 5.98 |
3. | 1990m6 1.04 6.68 |
4. | 1990m7 .91 6.71 |
5. | 1990m8 .84 6.13 |
+-------------------------+
// Microsoft
twoway (tsline msoft), name(msoft, replace) title("Microsoft") xtitle("") ///
ytitle("Microsoft Prices") tlabel(#10,format(%tmCCYY)) ///
ylabel(, format(%9.0gc)) ylabel(,angle(0)) nodraw
// Walmart
twoway (tsline wmart), name(wmart, replace) title("Walmart") xtitle("") ///
ytitle("Walmart Prices") tlabel(#10,format(%tmCCYY)) ///
ylabel(, format(%9.0gc)) ylabel(,angle(0)) nodraw
// Combine graphs
graph combine msoft wmart, col(1) imargin(tiny)
graph export "demo_stockindices.png", replace
. foreach v in ‘capmlst’ {
2. gen sret_‘v’ = ‘v’ / L1.‘v’ - 1.0 // Simple returns
3. gen lret_‘v’ = log(‘v’) - log(L1.‘v’) // Log returns
4. }
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
// Microsoft
twoway (tsline sret_msoft), name(sret_msoft, replace) ///
title("Simple Returns Microsoft") xtitle("") ytitle("") ///
tlabel(#10,format(%tmCCYY)) ylabel(,angle(0)) nodraw
// Walmart
twoway (tsline sret_wmart), name(sret_wmart, replace) ///
title("Simple Returns Walmart") xtitle("") ytitle("") ///
tlabel(#10,format(%tmCCYY)) ylabel(,angle(0)) nodraw
// Combine graphs
graph combine sret_msoft lret_msoft sret_wmart lret_wmart, ///
cols(2) xcommon ycommon
graph export "demo_gr_ret.png", replace
+---------------------------------------------+
| datevec srets_m~t srets_w~t prt_sim~e |
|---------------------------------------------|
1. | 2004m1 .0051301 .007593 .0127231 |
2. | 2004m2 -.0203119 .0530105 .0326985 |
3. | 2004m3 -.0300567 .0021978 -.0278589 |
4. | 2004m4 .023934 -.0225551 .0013789 |
5. | 2004m5 .0019194 -.0099595 -.0080401 |
+---------------------------------------------+
+--------------------+
| datevec tmp |
|--------------------|
7. | 2004m7 1.029301 |
+--------------------+
Describing data
Load data
. list t bp in 1/5
+------------+
| t bp |
|------------|
1. | 1 1.4515 |
2. | 2 1.452 |
3. | 3 1.4537 |
4. | 4 1.454 |
5. | 5 1.456 |
+------------+
twoway tsline bp, name(gbp, replace) ytitle(" ") title("£/$ exchange rate") ///
tlabel(#10,) xtitle("") ylabel(,angle(0))
Compute autocorrelations I
Plot autocorrelations I
Plot autocorrelations II