[R] loop for backtesting

wintwin111 andreas-winterhalder at web.de
Thu Nov 7 15:17:10 CET 2013

First of all sorry for my bad english but its not my native language.

I am working on a paper on Portfolio Optimization with Markowitz and Lower
Partial Moments. 

I want to compare the returns of the minimum variance portfolios from booth
methods. First of all i have an in-sample multivariate timeseries from 4
stocks reaching from 1.october.2011 to 1.october 2012 (log-returns, daily
data, 257 observations for each stock).

I start to optimize my portfolio using the package tseries as follow:


with this i get the weights, the mean return of the whole period, the
standard deviation and the returns on each day for my in-sample optimal
portfolio Markowitz portfolio. 

The out of sample data reaches from 2.october.2012 to 1.october.2013
(log-returns,daily data, 253 observations for each stock, again a
multivariate time series). Now i want to optimize the Portfolio 253 times.
Each time the log-returns for one day should be added to the original
in-sample timeseries (first optimization 257 in-sample data plus the first
from the out of sample data and so on). Now i should get new weights for
every of the 253 periods and therefor new returns for the portfolio every

My advisor at the university told me i cant use backtest packages cause they
cant handle the Lower Partial Moments part of my analysis. The problem is
just for the markowitz portfolio optimization. 

I hope you can help me with my problem

greetings wintwin111

View this message in context: http://r.789695.n4.nabble.com/loop-for-backtesting-tp4679962.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list