Tom,
Sorry for all the trouble. I tried to integrate the procedure in the previous code you sent me, but with little success. I did some minuscule additions to the original and currently the main looks like:
********************************
compute nreps=100
compute todraw=2
do rep=1,nreps
compute scombo=%rancombo(247,todraw)
set average = 0.0
do i=1,todraw
set average = average+security(scombo(i))/todraw
end do i
linreg(noprint) average
# constant market
stats(fractiles, noprint) average
Table(noprint) / average
disp ###.#### %mean sqrt(%variance) %skewness %kurtosis sqrt(%rsquared) %beta(2) %minimum %maximum %maximum-%minimum
end do rep
***************************************
Again with the risk of pushing my luck I thought that may be if I try to explain better what I mean by drawdown it might make it easier for you to help me.
I was thinking of using the “Average” series as input and create new series which are:
1. the max of (LN running sum of “average” – ie. Cumulative return month by month) and running sum of average at T-1 …. This would be my peak calculation.
2. LN running sum of “average” ……. This would be my actual return
Then I would look for the min of 2 minus 1 and seek to include the exponent of it minus 1 in the last line of the code
In excel the above calculations would look like this (with formulas for line3):
A B C D
1 data =+LN(1+A3) =MAX(SUM(B$2:$B3),C2) =+SUM(B$2:$B3)-C3
2 2.3% 2.3% 2.3% 0.0%
3 2.4% 2.3% 4.6% 0.0%
4 -3.1% -3.1% 4.6% -3.1%
5 0.1% 0.1% 4.6% -3.0%
6 3.8% 3.7% 5.3% 0.0%
I was hoping to ba able to incorporate those calculations in the initial code you sent me. I easily created the new LN “Average” series but got stuck there
As an alternative way of trying to explain what I mean by drawdown I attach an xl function I use for calculation of drawdown
Hope it helps and sorry for all the trouble
Cheers
Bobby
****************************************
Function DRAWDOWN(aReturnVector)
' Calculates drawdown vector from a vector of log returns
'
' Input: a vector of fund log returns
' Output: a drawdown vector
' Comment: it doesn't matter whether the log returns are arranged in cols or rows
'
' Andreas Steiner, February 2007
'
http://www.andreassteiner.net/performanceanalysisn = WorksheetFunction.Max(aReturnVector.Columns.Count, aReturnVector.Rows.Count)
ReDim aDrawdownVector(1 To n)
ReDim aSortedDrawdownVector(1 To n)
ReDim aCumReturn(1 To n)
aCumReturn(1) = aReturnVector(1)
aMax = aCumReturn(1)
aDrawdownVector(1) = aMax - aCumReturn(1)
For i = 2 To n
aCumReturn(i) = aCumReturn(i - 1) + aReturnVector(i)
aMax = WorksheetFunction.Max(aCumReturn(i), aMax)
aDrawdownVector(i) = aMax - aCumReturn(i)
Next i
For i = 1 To n
aSortedDrawdownVector(i) = -WorksheetFunction.Large(aDrawdownVector, i)
Next i
DRAWDOWN = WorksheetFunction.Transpose(aSortedDrawdownVector)
End Function