Displaying 3 results from an estimated 3 matches for "macaulay_dur".
2010 Jan 19
0
Macualay Duration code in a Functional Form - Please Help
# I have written this code in Notepad++ and copied here.
## ONS - PPA
Duration = function(par_value, coupon_rate, freq_coupon, tenure, ytm)
{
macaulay_duration = NULL
modified_duration = NULL
freq_coupon_new = NULL
if(freq_coupon <= 0)
{
freq_coupon_new = 365
}
if(freq_coupon > 0 & freq_coupon <= 1)
{
freq_coupon_new = 12
}
if(freq_coupon > 1 & freq_coupon <= 2)
{
freq_coupon_new = 4
}
if(freq_c...
2010 Jan 20
2
Please Please Please Help me!!
...o wish to use it for multiple data.)
I have defined a function (as given below) which helps me calculate Macaulay Duration and Modified Duration and its working fine with given set of data.
My Code -
## ONS - PPA
duration = function(par_value, coupon_rate, frequency_copoun, tenure, ytm)
{
macaulay_duration = NULL
modified_duration = NULL
freq_coupon_new = NULL
if(frequency_copoun <= 0)
{
freq_coupon_new = 365
}
if(frequency_copoun > 0 & frequency_copoun <= 1)
{
freq_coupon_new = 12
}
if(frequency_copoun > 1 & frequency_copoun <= 2)
{
freq_...
2010 Jan 19
0
Macaulay Duration for Group
...39;)
par_value = ONS$par_value
coupon = ONS$coupon_rate*par_value/100
freq_coupon = ONS$frequency_copoun
tenure = ONS$tenure
ytm = ONS$ytm
# _________________________________________________________________________________________________
## COMPUTATIONS
macaulay_duration = NULL
modified_duration = NULL
freq_coupon_new = NULL
if(freq_coupon <= 0)
{
freq_coupon_new = 365
}
if(freq_coupon > 0 & freq_coupon <= 1)
{
freq_coupon_new = 12
}
if(freq_coupon > 1 & freq_coupon <= 2)
{
freq_coupon_new = 4
}
if(freq_...