Displaying 3 results from an estimated 3 matches for "freq_coupon_new".
2010 Jan 19
0
Macaulay Duration for Group
...S$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_coupon > 2 & freq_coupon <= 3)
{
freq_coupon_n...
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_coupon > 2 & freq_coupon <= 3)
{
freq_coupon_new...
2010 Jan 20
2
Please Please Please Help me!!
...ction (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_coupon_new = 4
}
if(frequency_copoun > 2 & frequency...