Skip to content
Back to formatted view

Raw Message

Message-ID: <68b1e2611001200247l20847c21u1fe5645ca3ed97b8@mail.gmail.com>
Date: 2010-01-20T10:47:26Z
From: Liviu Andronic
Subject: Please Please Please Help me!!
In-Reply-To: <176632.86849.qm@web110112.mail.gq1.yahoo.com>

Hello

On Wed, Jan 20, 2010 at 7:00 AM, Madhavi Bhave <madhavi_bhave at yahoo.com> wrote:
> Sir, I am not asking for the modification of existing code as it is running fine with a single set of data (and I have checked that the output tallies with other methods). I just want to use this code for multiple data so that I get an output something like
>
> ???????? maculay_duration??????????????????? modified_duration
>
> ????????? 1423.797?????????????????????????????????? 1423.795
>
> ???????????? 44.339?????????????????????????????????????? 44.307
>
I am not sure that this would be the most efficient, but see if
something similar does the job for you:
x <- matrix(NA, 5,2); x
for (i in 1:5){
    x1 <- cbind(mean(rnorm(100)), mean(runif(100)))  ## use duration()
instead of cbind() and r*() funs
    x[i, ] <- x1
}
x

Liviu