[R-SIG-Finance] PerformanceAnalytics package: modern econometrics for performance and risk (implemented)
Brian G. Peterson
brian at braverock.com
Tue Mar 6 15:32:07 CET 2007
On Tuesday 06 March 2007 08:04, David Kane wrote:
> Brian G. Peterson writes:
> > We are soliciting feedback on the PerformanceAnalytics package on
> > R-SIG-Finance in preparation for releasing this package to CRAN and
> > submission to one of the implementation journals.
>
> This looks like great stuff. The more open source finance tools that
> are available in R, the better. Comments (I have cc'd the entire list
> to encourage more discussion):
>
> 1) It would be nice to see better integration between the different R
> packages focussed on empirical finance. Do we really need another
> calculation of the Sharpe ratio? To that end, we would welcome
> collaboration on our portfolio/portfolioSim packages. If not with us,
> then why not add these functions to Rmetrics?
David,
I think that the multitude of packages in R is one of its strengths. We
attempted with the CheckDataMatrix and CheckDataVector functions to make
coercion of arguments transparent with as many types of input data as
possible. While I've appreciated your 'portfolio' and 'portfolioSim'
packages (and reference them in our summary), it wasn't clear that the
econometric functions in our code fit particularly well in your package.
No, we don't really need another calculation of Sharpe Ratio. One
implementation that I'm aware of assumes prices, not returns. One
implementation only takes timeSeries. We needed to do an annualized
Sharpe ratio, and were going to provide many of the modifications to
Sharpe Ratio as well, so we reluctantly re-implemented it to provide a
complete collection of the Sharpe-related metrics with common parameters
and usage. (I think this is the most complete collection in R of Sharpe
and related or derived metrics.)
> 2) At first glance, the code is not robust enough for production
> work. I would like to see a namespace. S4, rather than S3, classes
> would be better. Are there really no test cases? I do not trust code
> without test cases.
Almost all of the functions have executable examples in the .Rd files.
These are tested for execution in the package build process. I'm not yet
familiar enough with the unit test structures for packages in R to
convert the examples into formal test cases with expected results, but we
do intend to do so. Any assistance would of course be appreciated.
There is, in my opinion, no need for a class for simple, mostly
standalone, functions such as this. I've been building enterprise scale
object oriented software packages for a very long time, and classes are
overused where they add only complexity and not clarity to an
application, in my opinion. I use classes when they add clarity, not for
the sake of being object oriented. For something like 'zoo' or
'portfolio', a class makes sense. For Sortino Ratio or Cornish-Fisher
VaR, a class adds unneeded complexity and weight.
I have used classes in R where they seemed appropriate. A backtesting
infrastructure, related data management interfaces, etc. For this
collection, I didn't see any clear class delineations.
What do you think the package would gain from a namespace?
> 3) Much of the coding does not seem consistent with standard R
> usage. For example, the initial argument for many functions is "R". It
> is hard to imagine a worse convention. "x" or "data" would be more
> consistent with standard practice.
'x' as a parameter name means nothing. 'R' for 'returns', 'Rb' for
'returns of benchmark', 'rf' for 'risk free rate' all conform to what you
will see in the statistical equations in the finance literature and in
common computer science practice of meaningful variable names.
> Again, I don't want this to seem too critical.
Not taken as too critical. Hopefully my commentary make things more
clear. I would very much appreciate any pointers or examples on
converting our .Rd examples into test cases with expected results based
on your comments.
> We need more contributions, not fewer!
> I look forward to other comments from the community.
I hope that the list chimes in with more commentary on the functionality
as well.
Regards,
- Brian
--
773-459-4973 mobile
http://braverock.com/brian/resume-quant.pdf
More information about the R-SIG-Finance
mailing list