Brian,

first of all: thanks again for an excellent package. I believe you've 
done a great job for the community!

I have noticed that table.Drawdowns  produces spurious/erroneous results 
when number of drawdowns is less than 1.

In my view it would be desirable in the case of no drawdowns to have an 
output similar to the cases with one/two drawdowns in the series. ie 
somthing like this


*Desired output when number of drawdowns is less than 1.*

     [1] From      Trough    To        Depth     Length    To Trough 
Recovery
<0 rows> (or 0-length row.names)

     Warning message:
     In table.Drawdowns(z.two.drawdowns) : Only 0 available in the data.


I include some code (in blue, output in brown)

     require(PerformanceAnalytics)
     set.seed(seed = 166, kind = NULL, normal.kind = NULL)


     time <- as.Date('01/12/2010', "%d/%m/%Y") + +seq(10)*31

     z.two.drawdowns <- 
zoo(c(-0.1,0.2,-0.05,(rnorm(10)/10+1)/10),order.by = time)
     z.one.drawdown <- zoo(c(-0.1,(rnorm(10)/10+1)/10),order.by = time)
     z.no.drawdown <- zoo((rnorm(10)/10+1)/10,order.by = time)



     table.Drawdowns(z.two.drawdowns)
         From     Trough         To Depth Length To Trough Recovery
1 2011-01-01 2011-01-01 2011-02-01 -0.10      2         1        1
2 2011-03-04 2011-03-04 2011-04-04 -0.05      2         1        1
Warning message:
In table.Drawdowns(z.two.drawdowns) : Only 2 available in the data.
         From     Trough         To Depth Length To Trough Recovery

     table.Drawdowns(z.one.drawdown)

1 2011-01-01 2011-01-01 2011-03-04  -0.1      3         1        2
Warning message:
In table.Drawdowns(z.one.drawdown) : Only 1 available in the data.

     table.Drawdowns(z.no.drawdown)

Error in if (runs$return[j] > runs$return[j + 1]) { :
   missing value where TRUE/FALSE needed
Calls: table.Drawdowns -> sortDrawdowns


As one can see from the above, the output in the case of no drawdowns is 
markedly different. However, I would prefer it to be similar. Happy to 
provide patches.

Cheers, Felix



	[[alternative HTML version deleted]]

