<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, May 29, 2014 at 9:16 AM, Brian G. Peterson <span dir="ltr"><<a href="mailto:brian@braverock.com" target="_blank">brian@braverock.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">We should figure out a plan to put compiled higher moment functions into PerformanceAnalytics.<br></blockquote><div><br>
</div><div>I'd be glad to do the legwork on this. As I mentioned in the previous email, I have some prototype functions using RcppArmadillo based on the fast R code with the more efficient algorithm that Josh sent me. I chose RcppArmadillo because it is easy to use the matrix and vector classes from Armadillo as well as the matrix operations. I suppose it would be feasible to do this in fortran or C. </div>
<div><br></div><div>What are other's thoughts? </div><div><br></div><div>Are there any other functions in PerformanceAnalytics that you would like to move to compiled code that might impact the decision?</div><div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I'll leave it to you and Josh to figure out whether Rcpp or R's native .Call API make more sense.<br></blockquote><div>Ok, I'll get the discussion going with Josh.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
- Brian<div class=""><br>
<br>
<br>
On 05/29/2014 11:13 AM, Ross Bennett wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">
All,<br>
<br>
Some parts of this were briefly discussed in a previous email thread,<br>
but I want to get the discussion started again.<br>
<br>
The code to compute the cokurtosis error matrix for multi factor and<br>
single factor models is written in C++ and uses the Rcpp package. The<br>
functions were sent to me by Kris Boudt and written by Joshua Ulrich.<br>
Joshua did state that the speed gains were very large and we do not want<br>
to write these in R.<br>
<br>
Do we want to re-write using R's C API or should we include "as is" and<br>
use Rcpp?<br>
<br>
This raised another discussion about computing the higher moments. Right<br></div>
now we use <a href="http://M3.MM" target="_blank">M3.MM</a> <<a href="http://M3.MM" target="_blank">http://M3.MM</a>> and <a href="http://M4.MM" target="_blank">M4.MM</a> <<a href="http://M4.MM" target="_blank">http://M4.MM</a>> from<div class="">
<br>
PerformanceAnalytics in set.portfolio.moments to compute the sample<br>
estimates. I re-wrote these using RcppArmadillo which was fairly<br>
straightforward because Armadillo has a function to compute the<br>
kronecker product. Joshua has profiled and optimized coskewness and<br>
cokurtosis functions written in R that are very fast. They use a<br>
different algorithm to avoid the kronecker product which results in a<br>
huge performance gain.<br>
<br></div>
What is the plan for <a href="http://M3.MM" target="_blank">M3.MM</a> <<a href="http://M3.MM" target="_blank">http://M3.MM</a>> and <a href="http://M4.MM" target="_blank">M4.MM</a> <<a href="http://M4.MM" target="_blank">http://M4.MM</a>> in<div class="">
<br>
PerformanceAnalytics?<br>
<br>
This potentially has a big impact on PortfolioAnalytics since the<br>
moments are computed at each rebalance period iteration.<br>
<br>
See attached for a benchmark (Processor: 2.9 GHz Intel Core i7; Memory:<br>
8 GB).<br>
<br>
Let me know your thoughts and if you have any questions or comments.<br>
<br>
Thanks,<br>
Ross<br>
<br>
<br></div>
______________________________<u></u>_________________<br>
GSoC-PortA mailing list<br>
<a href="mailto:GSoC-PortA@lists.r-forge.r-project.org" target="_blank">GSoC-PortA@lists.r-forge.r-<u></u>project.org</a><br>
<a href="http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta" target="_blank">http://lists.r-forge.r-<u></u>project.org/cgi-bin/mailman/<u></u>listinfo/gsoc-porta</a><br>
<br><span class="HOEnZb"><font color="#888888">
</font></span></blockquote><span class="HOEnZb"><font color="#888888">
<br>
-- <br>
Brian G. Peterson<br>
<a href="http://braverock.com/brian/" target="_blank">http://braverock.com/brian/</a><br>
Ph: <a href="tel:773-459-4973" value="+17734594973" target="_blank">773-459-4973</a><br>
IM: bgpbraverock<br>
______________________________<u></u>_________________<br>
GSoC-PortA mailing list<br>
<a href="mailto:GSoC-PortA@lists.r-forge.r-project.org" target="_blank">GSoC-PortA@lists.r-forge.r-<u></u>project.org</a><br>
<a href="http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta" target="_blank">http://lists.r-forge.r-<u></u>project.org/cgi-bin/mailman/<u></u>listinfo/gsoc-porta</a><br>
</font></span></blockquote></div><br></div></div>