Hello,

We are students in the Masters of Finance program in Belgium and are working on a project of Time Diversification. In order to check whether this concept exists, we need to perform a block bootstrap simulation together with the portfolio optimization analysis. We need to perfrom the above mentioned techniques in Gretl and have some questions for you.

1. How to write a code in order to divide a sample of three different series (Stocks, bonds and tbills) into a subsample. We have a sample that consists of 274 observations, we should divide it into subsamples: from 1st observation to 12th one (1 year holding period), from 1st to 60th etc
2. How to build variance-covariance matrix
3.  How to find optimal weights for each holding period (our holding periods are of 1 year, 5 yrs, 10, 15 and 20)

We very much appreciate your help and thank you in advance for taking the time in addressing these questions.

Arina and Valeriya.

This is what we basically need to do in Gretl:

Method
In this section, we describe the optimization method used to find the asset weights of the efficient portfo- lios and how we applied the bootstrap approach to construct empirical distributions for asset weights.
Efficient Portfolios. Investorswere assumed to use the mean-variance criterion when forming their optimal portfolios, and the investment hori- zons we considered were 1 year, 5 years, and 10 years.5 The investors look for the portfolio weights x that minimize the following trade-off between
Min x'lx - Xg'x
subject to I'x = 1 X?>0,
variance and expected investment horizon:

The Bootstrap Approach. The bootstrap method, introduced by Efron (1979), is a computer- intensive method for estimating the distribution of an estimator or a statistic by resampling the data at hand. In this study, we used a nonparametric mov- ing block bootstrap introduced by Carlstein (1986) and Kiinch (1989), in which serial dependence, as well as cross-sectional correlation, is preserved within the blocks. We used a nonparametric boot- strap because a parametric form gives inconsistent estimates if the structure of the serial correlation is misspecified or not tractable. The assets were drawn cross-sectionally, so they belonged to the same time period in the original series. Thus, we never con- structed a five-year relationship between stocks and bills that did not exist in the original series. The sample of real continuous returns on stocks and bills, R, was grouped into k overlapping blocks of 60 months. We chose a block length of 60 months because it is probably long enough to pick up most forms of possible time dependencies. The blocks were then resampled with replacement b times until a series R*with the same length as R was obtained, which was equivalent to constructing a realization or trajectory for stocks and bills for each drawing or R*.From each resampled R*,we calcu- lated a variance-covariance matrix, Y*, and an expected return vector, p&*,for each investment horizon from nonoverlapping holding-period returns. We then used 1* and ,u as inputs to the mean-variance optimization and obtained the opti- mal portfolio weights, x*. We repeated this proce- dure 1,000 times. In the end, we had a set of bootstrapped observations for each optimal portfo- lio in the mean-variance optimization and every investment horizon.
The empirical distribution of the weights, based on the bootstrap samples, allowed us to draw infer- ences about the weights. We constructed 90 percent confidence intervals based on the percentiles of the distribution of the assets weights. We ordered the observations in ascending order. That is, the 5 per- cent percentile, x*(a)i,s the 50th ordered value of the replications and x*(l-a)is the 95 percent percentile and the 950th ordered value of the replications. We obtained an indication of the magnitude of the esti- mation risk from the intervals because the confi- dence region displayed the degree of uncertainty associated with the efficient frontier. Our bootstrap approach to measuring estimation risk is an alterna- tive to the confidence regions