correlation matrix

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

correlation matrix

Debashis Dutta
Hi,

I am generating correlation matrix between macro variables of interest
rates and forex rates. Is there any package in R that assists it? Any
assistance is highly solicited.

Best regards
Debashis

        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: correlation matrix

Patrick Burns-2
Can you be more specific about what the
problem is, and perhaps tell us what
you've tried that is unsatisfactory?

On 27/11/2011 09:06, debashis dutta wrote:

> Hi,
>
> I am generating correlation matrix between macro variables of interest
> rates and forex rates. Is there any package in R that assists it? Any
> assistance is highly solicited.
>
> Best regards
> Debashis
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
>

--
Patrick Burns
[hidden email]
http://www.burns-stat.com
http://www.portfolioprobe.com/blog
twitter: @portfolioprobe

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: correlation matrix

Debashis Dutta
Hi Patrick,

Thanks for your kind reply. The generated correlation matrix fails cholesky
decomposition.

Best regards
Debashis

On 27 November 2011 14:38, Patrick Burns <[hidden email]> wrote:

> Can you be more specific about what the
> problem is, and perhaps tell us what
> you've tried that is unsatisfactory?
>
>
> On 27/11/2011 09:06, debashis dutta wrote:
>
>> Hi,
>>
>> I am generating correlation matrix between macro variables of interest
>> rates and forex rates. Is there any package in R that assists it? Any
>> assistance is highly solicited.
>>
>> Best regards
>> Debashis
>>
>>        [[alternative HTML version deleted]]
>>
>> ______________________________**_________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/**listinfo/r-sig-finance<https://stat.ethz.ch/mailman/listinfo/r-sig-finance>
>> -- Subscriber-posting only. If you want to post, subscribe first.
>> -- Also note that this is not the r-help list where general R questions
>> should go.
>>
>>
> --
> Patrick Burns
> [hidden email]
> http://www.burns-stat.com
> http://www.portfolioprobe.com/**blog <http://www.portfolioprobe.com/blog>
> twitter: @portfolioprobe
>
> ______________________________**_________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/**listinfo/r-sig-finance<https://stat.ethz.ch/mailman/listinfo/r-sig-finance>
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions
> should go.
>

        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: correlation matrix

Arun.stat
Hi Debashis, I dont think there is any direct implementation in R for that. What you need is to have a PD matrix for the underlying VCV matrix, which is not the case for yours. Do you have lot of missing data? May be you can try with constructing VCV matrix after considering pairwise variables and then tweak the eigen value little bit to make your estimated VCV matrix PD.

One algorithm for that may be like (if your estimated matrix is NND):

Mod_VCV = Original_VCV + (Identity_Mat(n) - Original_VCV)*(Lambda/(1-Lambda) + a_very_small_positive_number)

Lambda is the smallest eigen value for you estimated VCV matrix.

HTH,

Thanks and regards,
_____________________________________________________

Arun Kumar Saha, FRM
QUANTITATIVE RISK AND HEDGE CONSULTING SPECIALIST
Visit me at: http://in.linkedin.com/in/ArunFRM
_____________________________________________________
Reply | Threaded
Open this post in threaded view
|

Re: correlation matrix

Enrico Schumann


Am 27.11.2011 10:52, schrieb Arun.stat:
> Hi Debashis, I dont think there is any direct implementation in R for that.

Just for the record: see for example function 'nearPD' in package
Matrix, or 'repairMatrix' in package NMOF.

> What you need is to have a PD matrix for the underlying VCV matrix, which is
> not the case for yours. Do you have lot of missing data? May be you can try
> with constructing VCV matrix after considering pairwise variables and then
> tweak the eigen value little bit to make your estimated VCV matrix PD.
>
> One algorithm for that may be like (if your estimated matrix is NND):
>
> Mod_VCV = Original_VCV + (Identity_Mat(n) - Original_VCV)*(Lambda/(1-Lambda)
> + a_very_small_positive_number)
>
> Lambda is the smallest eigen value for you estimated VCV matrix.
>
> HTH,
>
> Thanks and regards,
> _____________________________________________________
>
> Arun Kumar Saha, FRM
> QUANTITATIVE RISK AND HEDGE CONSULTING SPECIALIST
> Visit me at: http://in.linkedin.com/in/ArunFRM
> _____________________________________________________
>
> --
> View this message in context: http://r.789695.n4.nabble.com/correlation-matrix-tp4112075p4112158.html
> Sent from the Rmetrics mailing list archive at Nabble.com.
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
>

--
Enrico Schumann
Lucerne, Switzerland
http://nmof.net/

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: correlation matrix

Arun.stat
Thanks Enrico for your pointer. I was not aware of them!

Thanks and regards,
_____________________________________________________

Arun Kumar Saha, FRM
QUANTITATIVE RISK AND HEDGE CONSULTING SPECIALIST
Visit me at: http://in.linkedin.com/in/ArunFRM
_____________________________________________________


On Sun, Nov 27, 2011 at 4:58 PM, Enrico Schumann <[hidden email]>wrote:

>
>
> Am 27.11.2011 10:52, schrieb Arun.stat:
>
>> Hi Debashis, I dont think there is any direct implementation in R for
>> that.
>>
>
> Just for the record: see for example function 'nearPD' in package Matrix,
> or 'repairMatrix' in package NMOF.
>
>  What you need is to have a PD matrix for the underlying VCV matrix, which
>> is
>> not the case for yours. Do you have lot of missing data? May be you can
>> try
>> with constructing VCV matrix after considering pairwise variables and then
>> tweak the eigen value little bit to make your estimated VCV matrix PD.
>>
>> One algorithm for that may be like (if your estimated matrix is NND):
>>
>> Mod_VCV = Original_VCV + (Identity_Mat(n) - Original_VCV)*(Lambda/(1-**
>> Lambda)
>> + a_very_small_positive_number)
>>
>> Lambda is the smallest eigen value for you estimated VCV matrix.
>>
>> HTH,
>>
>> Thanks and regards,
>> ______________________________**_______________________
>>
>> Arun Kumar Saha, FRM
>> QUANTITATIVE RISK AND HEDGE CONSULTING SPECIALIST
>> Visit me at: http://in.linkedin.com/in/**ArunFRM<http://in.linkedin.com/in/ArunFRM>
>> ______________________________**_______________________
>>
>> --
>> View this message in context: http://r.789695.n4.nabble.com/**
>> correlation-matrix-**tp4112075p4112158.html<http://r.789695.n4.nabble.com/correlation-matrix-tp4112075p4112158.html>
>> Sent from the Rmetrics mailing list archive at Nabble.com.
>>
>> ______________________________**_________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/**listinfo/r-sig-finance<https://stat.ethz.ch/mailman/listinfo/r-sig-finance>
>> -- Subscriber-posting only. If you want to post, subscribe first.
>> -- Also note that this is not the r-help list where general R questions
>> should go.
>>
>>
> --
> Enrico Schumann
> Lucerne, Switzerland
> http://nmof.net/
>

        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: correlation matrix

Debashis Dutta
Dear Enrico & Arun,

Thanks for the help. I will try for the same.

Best regards
Debashis

On 27/11/2011, Arun Kumar Saha <[hidden email]> wrote:

> Thanks Enrico for your pointer. I was not aware of them!
>
> Thanks and regards,
> _____________________________________________________
>
> Arun Kumar Saha, FRM
> QUANTITATIVE RISK AND HEDGE CONSULTING SPECIALIST
> Visit me at: http://in.linkedin.com/in/ArunFRM
> _____________________________________________________
>
>
> On Sun, Nov 27, 2011 at 4:58 PM, Enrico Schumann
> <[hidden email]>wrote:
>
>>
>>
>> Am 27.11.2011 10:52, schrieb Arun.stat:
>>
>>> Hi Debashis, I dont think there is any direct implementation in R for
>>> that.
>>>
>>
>> Just for the record: see for example function 'nearPD' in package Matrix,
>> or 'repairMatrix' in package NMOF.
>>
>>  What you need is to have a PD matrix for the underlying VCV matrix, which
>>> is
>>> not the case for yours. Do you have lot of missing data? May be you can
>>> try
>>> with constructing VCV matrix after considering pairwise variables and
>>> then
>>> tweak the eigen value little bit to make your estimated VCV matrix PD.
>>>
>>> One algorithm for that may be like (if your estimated matrix is NND):
>>>
>>> Mod_VCV = Original_VCV + (Identity_Mat(n) - Original_VCV)*(Lambda/(1-**
>>> Lambda)
>>> + a_very_small_positive_number)
>>>
>>> Lambda is the smallest eigen value for you estimated VCV matrix.
>>>
>>> HTH,
>>>
>>> Thanks and regards,
>>> ______________________________**_______________________
>>>
>>> Arun Kumar Saha, FRM
>>> QUANTITATIVE RISK AND HEDGE CONSULTING SPECIALIST
>>> Visit me at:
>>> http://in.linkedin.com/in/**ArunFRM<http://in.linkedin.com/in/ArunFRM>
>>> ______________________________**_______________________
>>>
>>> --
>>> View this message in context: http://r.789695.n4.nabble.com/**
>>> correlation-matrix-**tp4112075p4112158.html<http://r.789695.n4.nabble.com/correlation-matrix-tp4112075p4112158.html>
>>> Sent from the Rmetrics mailing list archive at Nabble.com.
>>>
>>> ______________________________**_________________
>>> [hidden email] mailing list
>>> https://stat.ethz.ch/mailman/**listinfo/r-sig-finance<https://stat.ethz.ch/mailman/listinfo/r-sig-finance>
>>> -- Subscriber-posting only. If you want to post, subscribe first.
>>> -- Also note that this is not the r-help list where general R questions
>>> should go.
>>>
>>>
>> --
>> Enrico Schumann
>> Lucerne, Switzerland
>> http://nmof.net/
>>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions
> should go.
>


--
Dr. Debashis Dutta
Risk Managment Professional

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.