Portfolio back test: robust versus classical statistics

Một phần của tài liệu Financial risk modelling and portfolio optimization with r second edition (Trang 197 - 201)

In this subsection a back-test of a minimum-variance portfolio optimization with long-only and full investment for major stock market indexes is conducted. The classi- cal and the robust estimators are utilized for moment estimation. The six stock indexes covered are the S&P 500, Nikkei 225, FTSE 100, CAC 40, DAX, and Hang Seng.

The sample of month’s-end index levels starts on 31 July 1991 and ends on 30 June 2011, thus comprising 240 observations.

In Listing 10.5 the necessary packages are first loaded into memory. The data set is contained in the packageFRAPOaccompanying this book. In principle, the portfolio back-test could be conducted with the facilities offered infPortfolio, but for ease of comprehension a customized back-test will be described in which the functions and methods of the packages loaded in lines 3–6 will be employed.

With the packages in memory, the data set is loaded and converted to azooobject.

Percentage discrete returns are calculated, and by way of preliminary data analysis descriptive statistics are calculated and box-plots drawn for each index.

Rcode 10.5Portfolio back-test: descriptive statistics of returns.

# # L o a d i n g o f p a c k a g e s 1

l i b r a r y ( FRAPO ) 2

l i b r a r y ( P e r f o r m a n c e A n a l y t i c s ) 3

l i b r a r y ( q u a d p r o g ) 4

l i b r a r y ( r r c o v ) 5

l i b r a r y ( zoo ) 6

# # L o a d i n g d a t a , c a l c u l a t e r e t u r n s 7

d a t a ( S t o c k I n d e x ) 8

pzoo <− zoo ( S t o c k I n d e x , o r d e r . by = rownames ( S t o c k I n d e x ) ) 9

r z o o <− ( pzoo / l a g ( pzoo , k = −1) − 1 ) 100 10

# # b o x p l o t and d e s c r i p t i v e s t a t i s t i c s 11

b o x p l o t ( c o r e d a t a ( r z o o ) ) 12

r s t a t s <− r b i n d ( a p p l y ( r z o o , 2 , summary ) , 13

s k e w n e s s ( r z o o ) , 14

k u r t o s i s ( r z o o ) 15

) 16

k k SP500 N225 FTSE100 GDAX HSI

−30−20−100102030

Figure 10.1 Box-plots of stock index returns.

The box-plot is shown in Figure 10.1, from which the stylized facts of financial market returns are clearly evident. The returns are skewed to the left and the span of the returns indicates excess kurtosis. The most volatile returns series is the Hang Seng index. All returns series have outliers in the left tail, but only the German DAX and the Hang Seng have them in the right tail. The key descriptive statistics are summarized in Table 10.2.

The code for conducting the back-test is shown in Listing 10.6. First, a character vector,EST, with the names of the estimators to be used, is created. Next, a function, PfBack(), is defined for determining the weights of the minimum-variance portfolio for a given estimator. The previously defined functions Moments() Table 10.2 Portfolio back-test: descriptive statistics of returns

Statistics SP500 N225 FTSE100 CAC40 GDAX HSI

Minimum −16.940 −23.830 −13.020 −17.490 −25.420 −29.410 First quartile −1.854 −4.319 −1.762 −3.351 −2.533 −3.122

Median 1.067 −0.082 0.690 1.266 1.320 0.959

Mean 0.604 −0.190 0.436 0.499 0.829 1.009

Third quartile 3.323 3.886 3.115 4.017 4.431 4.679

Maximum 10.640 16.150 10.400 13.410 21.380 30.160

Skewness −0.558 −0.249 −0.481 −0.296 −0.457 0.242

Excess kurtosis 0.985 0.484 0.420 0.215 1.763 2.310

k k Rcode 10.6Portfolio back test: rolling window optimization.

# # C o n d u c t b a c k t e s t 1

EST <− c ( " C o v C l a s s i c " , " CovMcd " , " CovMest " , " CovMMest " , 2

" CovMve " , " CovOgk " , " CovSde " , " C o v S e s t " ) 3

# # F u n c t i o n f o r b a c k t e s t 4

P f B a c k <− f u n c t i o n ( x , method = c ( " C o v C l a s s i c " , " CovMcd " , 5

" CovMest " , " CovMMest " , " CovMve " , " CovOgk " , 6

" CovSde " , " C o v S e s t " ) , . . . ) { 7

cov <− Moments ( x , method = method ) 8

r e t u r n ( P o r t M i n V a r ( cov ) ) 9

} 10

# # C o n d u c t i n g b a c k t e s t 11

P f W e i g h t s <− l a p p l y ( EST , f u n c t i o n ( x ) 12

r o l l a p p l y ( r z o o , w i d t h = 1 2 0 , FUN = PfBack , 13

method = x , by . column = FALSE , 14

a l i g n = " r i g h t " ) ) 15

16

p e r i o d s <− a s . D a t e ( i n d e x ( P f W e i g h t s [ [ 1 ] ] ) ) 17

# # C a l c u l a t e p o r t f o l i o r e t u r n s / r e l a t i v e p e r f o r m a n c e 18

P f R e t u r n s <− l a p p l y ( P f W e i g h t s , f u n c t i o n ( x ) 19

rowSums ( l a g ( x , k = −1) r z o o ) ) 20

P f R e t u r n s <− zoo ( m a t r i x ( u n l i s t ( P f R e t u r n s ) , 21

n c o l = l e n g t h ( P f R e t u r n s ) ) , p e r i o d s ) 22

c o l n a m e s ( P f R e t u r n s ) <− EST 23

P o r t O u t <− ( P f R e t u r n s [ , −1] − P f R e t u r n s [ , 1 ] ) 24

# # p l o t r e l a t i v e p e f o r m a n c e 25

p l o t ( P o r t O u t , t y p e = " h " , 26

x l a b = " " , 27

y l a b = EST [−1 ] , 28

main = " R e l a t i v e P e r f o r m a n c e " , 29

y l i m = r a n g e ( P o r t O u t ) ) 30

# # s t a t i s t i c s on r e l a t i v e p e r f o r m a n c e 31

P o r t R e l S t a t s <− r b i n d ( a p p l y ( P o r t O u t , 2 , summary ) , 32

s k e w n e s s ( P o r t O u t ) 33

) 34

and PortMinVar() are used. The function PfBack() is then used by rollapply() to calculate the portfolio weights by using a rolling window of 120 observations. The resulting zooobject is named PfWeights. The function rollapply()is called within anlapply()enclosure and the character vector ESThas been used as alistobject. Hence, the objectPfWeightsis itself a list ofzooobjects with the weights for each of the estimation methods as inEST. Next, its index is stored as the object periods. For each of the underlying estimators, the portfolio returns can be computed swiftly by employing the lag() function such that the weights—lagged by one period—are multiplied by the respective returns and the row sums of these products are the portfolio returns. This calculation

k k

−20123

CovMcd −20123

CovMest −20123

CovMMest

Jan Mar May

−20123

CovMve −20123

CovOgk −20123

CovSde

Jan Mar May

−20123

CovSest

Figure 10.2 Relative performance of robust portfolios.

again involves the lapply()function. In the next two lines this listobject is transformed to azooobject and the excess returns of the portfolios based on robust estimators compared to the classical covariance estimator are computed. In the last two blocks of code the excess returns are displayed and summary statistics computed.

The excess returns of the back-test based upon the robust statistics compared to the classical estimators are displayed in Figure 10.2 and the relevant summary statistics in Table 10.3. For the given measures, the outcome of the robust optimizations is more favorable than that of the classical estimator. The average excess return is positive Table 10.3 Portfolio back-test: descriptive statistics of excess returns

Estimator Min 1st quartile Median Mean 3rd quartile Max Skew MCD −1.592 −0.350 −0.003 0.034 0.427 3.768 1.054 M −1.312 −0.314 −0.003 0.039 0.438 3.682 1.279 MM −0.685 −0.166 0.004 0.024 0.195 1.696 1.115 MVE −1.545 −0.372 −0.020 0.021 0.454 2.132 0.143 OGK −1.468 −0.337 0.017 0.037 0.484 2.670 0.363 SDE −1.898 −0.376 0.061 0.035 0.515 2.319 −0.018 S −1.360 −0.294 0.000 0.044 0.423 2.749 0.810

k k for all robust portfolios, and they are skewed to the right. Certainly the skewness is

affected by the large positive excess return in 2009, but even if one disregards this data point a positive skew results. This can be concluded by the difference between the third quartile and the absolute value of the first quartile, which is greater than zero for all robust estimators. Compared to the other robust estimators, the performance of the MM estimator is the least favorable, giving the lowest mean and maximum excess return. Among the robust estimators with a positive median excess return, the MCD and MM estimators produced portfolio allocations that yielded excess returns of highest skewness, followed by the OGK and Stahel–Donoho estimators.

Một phần của tài liệu Financial risk modelling and portfolio optimization with r second edition (Trang 197 - 201)

Tải bản đầy đủ (PDF)

(436 trang)