Skip to content

great conference and a question

4 messages · Hodgess, Erin, Brian G. Peterson, R P Herrold +1 more

#
Hodgess, Erin wrote:
You can use quantmod to download a price series for the index, and then 
use Return.calculate or other methods to generate a return series.  
Perhaps this goes without saying, but to do returns analysis, it is 
generally best to have the price series first, as what you most likely 
want is to calculate simple per-period returns before doing your 
analysis; log returns are only useful for things like a cumulative 
return chart or wealth index.

Regards,

     - Brian
#
If you want the returns for the underlying index constituents, you can
also use some functions in tawny that do this for you (leverages
quantmod under the hood):

h <- getPortfolioReturns(getIndexComposition('^DJI'), obs=100,
reload=TRUE)

The getIndexComposition method retrieves index data from Yahoo! (if it
exists). It works for most major indices, although their service is at
times unreliable.

Brian


-----Original Message-----
From: r-sig-finance-bounces at stat.math.ethz.ch
[mailto:r-sig-finance-bounces at stat.math.ethz.ch] On Behalf Of Brian G.
Peterson
Sent: Monday, April 27, 2009 2:25 PM
To: Hodgess, Erin
Cc: r-sig-finance at stat.math.ethz.ch
Subject: Re: [R-SIG-Finance] great conference and a question
Hodgess, Erin wrote:
program committee!
typically see in examples - where can I find them online please?
You can use quantmod to download a price series for the index, and then 
use Return.calculate or other methods to generate a return series.  
Perhaps this goes without saying, but to do returns analysis, it is 
generally best to have the price series first, as what you most likely 
want is to calculate simple per-period returns before doing your 
analysis; log returns are only useful for things like a cumulative 
return chart or wealth index.

Regards,

     - Brian