Re: Correlation Matrix

Posted by simone pilozzi on
URL: http://quantlib.414.s1.nabble.com/Correlation-Matrix-tp36p40.html

Hi,
try this two methods (they are part of a larger class called financial time series), they should work
Cheers
Simone
inline shared_ptr<SequenceStatistics> createsequence(TimeSeries<vector<Real>>jointds)
{
boost::shared_ptr<SequenceStatistics> gss(new SequenceStatistics);
for (it = jointds.begin();it !=jointds.end();++it)
{
p = it->second;
gss->add(p.begin(),p.end());
}

return gss;

}
inline Disposable<Matrix> getCorrelation(boost::shared_ptr<SequenceStatistics> g)
{
return g->correlation();
}

On 1 July 2010 20:50, Andrew Hill <[hidden email]> wrote:
Hello.  I am trying to compute the correlation matrix, from a set of time series (say 3 seperate series for simplicity).  I am a new user to quantlib, and I cannot seem to figure out how to do this exactly using the library.  It seems like I should be using the GenericSequenceStatistics class, bit I am unsure how.  Can anyone provide me with a few pointers?  A simple, yet complete example would be extremely appreciated.
 
Please let me know if you need additional information.
Thanks
-a

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users



------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users