[R-SIG-Finance] R-SIG-Finance Digest, Vol 75, Issue 21
Eugenio De Maio
e.demaio2 at virgilio.it
Fri Aug 27 10:21:30 CEST 2010
How to estimate a BEKK(Baba, Engle, Kroner....) model for a matrix of
assets?
In Eviews is possible. How to do this in R? There is a package for VAR model
and CCC models, but I did'n find one for this type of model.....thanks a
lot.
----- Original Message -----
From: <r-sig-finance-request at stat.math.ethz.ch>
To: <r-sig-finance at stat.math.ethz.ch>
Sent: Thursday, August 26, 2010 12:00 PM
Subject: R-SIG-Finance Digest, Vol 75, Issue 21
> Send R-SIG-Finance mailing list submissions to
> r-sig-finance at stat.math.ethz.ch
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> or, via email, send a message with subject or body 'help' to
> r-sig-finance-request at stat.math.ethz.ch
>
> You can reach the person managing the list at
> r-sig-finance-owner at stat.math.ethz.ch
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of R-SIG-Finance digest..."
>
>
> Today's Topics:
>
> 1. Secant Method Convergence (Method to replicate Excel
> XIRR/IRR) (Adrian Ng)
> 2. Question regarding floor and round (Gandhi, Puneet - RSCH AMRS)
> 3. Re: Question regarding floor and round (Pierre Lapointe)
> 4. Re: Question regarding floor and round (Martin Becker)
> 5. blogging, etc. (Patrick Burns)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 25 Aug 2010 09:24:02 -0400
> From: Adrian Ng <ang at hamiltonlane.com>
> To: "r-sig-finance at stat.math.ethz.ch"
> <r-sig-finance at stat.math.ethz.ch>
> Subject: [R-SIG-Finance] Secant Method Convergence (Method to
> replicate Excel XIRR/IRR)
> Message-ID:
> <201CE38FBF85F54AB7BC2362E674331E1D62638C9C at HLA-EXCCR.hamiltonlane.com>
>
> Content-Type: text/plain
>
> Hi,
>
> I am new to R, and as a first exercise, I decided to try to implement an
> XIRR function using the secant method. I did a quick search and saw
> another posting that used the Bisection method but wanted to see if it was
> possible using the secant method.
>
> I would input a Cash Flow and Date vector as well as an initial guess. I
> hardcoded today's initial date so I could do checks in Excel. This code
> seems to only converge when my initial guess is very close to the correct
> IRR.
>
> Maybe I have some basic errors in my coding/logic? Any help would be
> greatly appreciated.
>
> The Wikipedia article to secant method and IRR:
> http://en.wikipedia.org/wiki/Internal_rate_of_return#Numerical_solution
>
> Thanks!
>
>
>
> ANXIRR <- function (cashFlow, cfDate, guess){
> cfDate<-as.Date(cfDate,format="%m/%d/%Y")
> irrprev <- c(0); irr<- guess
>
>
> pvPrev<- sum(cashFlow)
> pv<-
> sum(cashFlow/((1+irr)^(as.numeric(difftime(cfDate,"2010-08-24",units="days"))/360)))
> print(pv)
> print("Hi")
>
>
> while (abs(pv) >= 0.001) {
> t<-irrprev; irrprev<- irr;
> irr<-irr-((irr-t)*pv/(pv-pvPrev));
> pvPrev<-pv;
>
> pv<-sum(cashFlow/((1+irr)^(as.numeric(difftime(cfDate,"2010-08-24",units="days"))/365)))
> print(irr);print(pv)
> }
> }
>
>
>
>
>
> Please consider the environment before printing this e-mail.
>
> [[alternative HTML version deleted]]
>
>
>
> ------------------------------
>
> Message: 2
> Date: Wed, 25 Aug 2010 16:38:39 -0400
> From: "Gandhi, Puneet - RSCH AMRS" <p.gandhi at baml.com>
> To: r-sig-finance at stat.math.ethz.ch
> Subject: [R-SIG-Finance] Question regarding floor and round
> Message-ID:
> <FEE323851BB2C840819D7A025609CF49EEE813 at ex2k.bankofamerica.com>
> Content-Type: text/plain; CHARSET=US-ASCII
>
> Hi All,
>
> Is there any function in R which does what Floor or Ceiling in Excel.
>
> Excel can take 2 arguments to FLOOR function while R doesn't.
>
> I need the following which is done in excel
>
> Base = 0.5
> Floor(126.6,Base) = 126.5
> Ceiling(126.6, Base) = 127
>
>
> Base = 1
> Floor(126.6, Base) = 126
> Ceiling(126.6, Base) = 127
>
> I tried round, floor, ceiling, trunc in R but none does this job.
>
> Pls Help/Thanks
> Puneet
>
> ----------------------------------------------------------------------
> This message w/attachments (message) is intended solely ...{{dropped:7}}
>
>
>
> ------------------------------
>
> Message: 3
> Date: Wed, 25 Aug 2010 18:00:03 -0400
> From: Pierre Lapointe <pierrelap at gmail.com>
> To: "Gandhi, Puneet - RSCH AMRS" <p.gandhi at baml.com>
> Cc: r-sig-finance at stat.math.ethz.ch
> Subject: Re: [R-SIG-Finance] Question regarding floor and round
> Message-ID:
> <AANLkTimEUiowrd=Nb8AyckHkw9Ujwwq0znLHSaFEWx__ at mail.gmail.com>
> Content-Type: text/plain
>
> Here are modified floor and ceiling functions that solve your problem:
>
> my.floor <-function(x,my.base){
> floor(x/my.base)*my.base
> }
>
> my.ceiling <-function(x,my.base){
> ceiling(x/my.base)*my.base
> }
>
> Base = 0.5
> my.floor(126.6,Base) #[1] 126.5
> my.ceiling(126.6,Base) #[1] 127
>
> Base = 1
> my.floor(126.6,Base) #[1] 126
> my.ceiling(126.6,Base) #[1] 127
>
> HTH
>
> Pierre
>
>
> On Wed, Aug 25, 2010 at 4:38 PM, Gandhi, Puneet - RSCH AMRS <
> p.gandhi at baml.com> wrote:
>
>> Hi All,
>>
>> Is there any function in R which does what Floor or Ceiling in Excel.
>>
>> Excel can take 2 arguments to FLOOR function while R doesn't.
>>
>> I need the following which is done in excel
>>
>> Base = 0.5
>> Floor(126.6,Base) = 126.5
>> Ceiling(126.6, Base) = 127
>>
>>
>> Base = 1
>> Floor(126.6, Base) = 126
>> Ceiling(126.6, Base) = 127
>>
>> I tried round, floor, ceiling, trunc in R but none does this job.
>>
>> Pls Help/Thanks
>> Puneet
>>
>> ----------------------------------------------------------------------
>> This message w/attachments (message) is intended solely ...{{dropped:7}}
>>
>> _______________________________________________
>> R-SIG-Finance at stat.math.ethz.ch 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.
>>
>
> [[alternative HTML version deleted]]
>
>
>
> ------------------------------
>
> Message: 4
> Date: Thu, 26 Aug 2010 09:38:14 +0200
> From: Martin Becker <martin.becker at mx.uni-saarland.de>
> To: Pierre Lapointe <pierrelap at gmail.com>
> Cc: r-sig-finance at stat.math.ethz.ch
> Subject: Re: [R-SIG-Finance] Question regarding floor and round
> Message-ID: <4C7619E6.8040207 at mx.uni-saarland.de>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> AFAIR, Excel does not comply with IEEE rounding (but R does), which
> may lead to undesirable results if Base is not exactly representable; at
> least on my system I get
>
> > my.floor(2.8,0.2)
> [1] 2.6
>
> for example.
> So (if my memory about Excel's behaviour is correct) one has to modify
> the functions my.floor and my.ceiling slightly to mimic Excel's
> behaviour more precisely. Something like
>
> Floor <- function(x,Base) {
> Base*floor(x*(1+.Machine$double.eps)/Base)
> }
>
> Ceiling <- function(x,Base) {
> Base*ceiling(x*(1-.Machine$double.eps)/Base)
> }
>
> may be closer to Excel. At least, in the previous example I get
>
> > Floor(2.8,0.2)
> [1] 2.8
>
> on my system.
>
> HTH
>
> Martin
>
>
>
>
> On 26.08.2010 00:00, Pierre Lapointe wrote:
>> Here are modified floor and ceiling functions that solve your problem:
>>
>> my.floor<-function(x,my.base){
>> floor(x/my.base)*my.base
>> }
>>
>> my.ceiling<-function(x,my.base){
>> ceiling(x/my.base)*my.base
>> }
>>
>> Base = 0.5
>> my.floor(126.6,Base) #[1] 126.5
>> my.ceiling(126.6,Base) #[1] 127
>>
>> Base = 1
>> my.floor(126.6,Base) #[1] 126
>> my.ceiling(126.6,Base) #[1] 127
>>
>> HTH
>>
>> Pierre
>>
>>
>> On Wed, Aug 25, 2010 at 4:38 PM, Gandhi, Puneet - RSCH AMRS<
>> p.gandhi at baml.com> wrote:
>>
>>> Hi All,
>>>
>>> Is there any function in R which does what Floor or Ceiling in Excel.
>>>
>>> Excel can take 2 arguments to FLOOR function while R doesn't.
>>>
>>> I need the following which is done in excel
>>>
>>> Base = 0.5
>>> Floor(126.6,Base) = 126.5
>>> Ceiling(126.6, Base) = 127
>>>
>>>
>>> Base = 1
>>> Floor(126.6, Base) = 126
>>> Ceiling(126.6, Base) = 127
>>>
>>> I tried round, floor, ceiling, trunc in R but none does this job.
>>>
>>> Pls Help/Thanks
>>> Puneet
>>>
>>> ----------------------------------------------------------------------
>>> This message w/attachments (message) is intended solely ...{{dropped:7}}
>>>
>>> _______________________________________________
>>> R-SIG-Finance at stat.math.ethz.ch 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.
>>>
>> [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-SIG-Finance at stat.math.ethz.ch 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. Martin Becker
> Statistics and Econometrics
> Saarland University
> Campus C3 1, Room 217
> 66123 Saarbruecken
> Germany
>
>
>
> ------------------------------
>
> Message: 5
> Date: Thu, 26 Aug 2010 09:24:13 +0100
> From: Patrick Burns <patrick at burns-stat.com>
> To: R Finance <r-sig-finance at stat.math.ethz.ch>
> Subject: [R-SIG-Finance] blogging, etc.
> Message-ID: <4C7624AD.2020602 at burns-stat.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Two things.
>
> 1) I've started a blog that some of
> you may be interested in. It is focused
> on fund management with R in the background.
>
> The idea is to let novices get used to
> the idea of R without being scared off.
> The most recent post (about variances) is
> the sort of thing that I have in mind.
> I'd love to hear other opinions about how
> to handle the issue (off-list, I would
> think).
>
> 2) Portfolio Probe is now available free
> for academic use -- see the Portfolio Probe
> website.
>
>
> --
> Patrick Burns
> patrick at burns-stat.com
> http://www.burns-stat.com
> http://www.portfolioprobe.com/blog
>
>
>
> ------------------------------
>
> _______________________________________________
> R-SIG-Finance mailing list
> R-SIG-Finance at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>
>
> End of R-SIG-Finance Digest, Vol 75, Issue 21
> *********************************************
More information about the R-SIG-Finance
mailing list