[R-sig-finance] How and when to USE ts and its objects?

Ajay Shah ajayshah at mayin.org
Mon Oct 4 18:13:31 CEST 2004


> 1. How portable is the object to other R packages? 
> Which packages will accept the object as is? 
> Will the object work in LM or other linear model packages?

As an example, "ITS objects" are basically matrices, so it isn't that
foreign. One can say x <- core(itsobject) and get back a raw numerical
matrices.

If d.prices is an ITS object containing daily stock prices, I say:
  d.returns <- data.frame(core(100*diff(log(d.prices))))

to get a "data frame" containing daily returns. After that, I'm home
free i.t.o. doing things like feeding d.returns to lm() and so on.

> Does RMetrics use ITS objects or does it have its own time series objects 
> (timeDate / timeSeries Classes)?

I'm curious about this too.

> The City I work for has a variety portfolios ranging from long term 
> defined benefit pension plans 
> to short term cash funds each with its own investment policy and benchmark 
> portfolios.
> 
> Do our investment policies achieve their intended purposes? Do they 
> overconstrain the portfolio?
> Do they provide a false sense of confidence in meeting risk management 
> objectives?
> 
> These are not just theoretical concerns, as a Budget Analyst, I am 
> painfully aware of the fact
> that when our defined benefit pension funds fall short of their 
> actuarially defined investment targets 
> -- the City's General Fund has to make up the difference.  It could be 
> worse,  absent vigilance, 
> we could have an LA-style (Orange County, CA) derivative meltdown.

> So my real concern is, in a tight budget environment, can the City of 
> Orlando use open source software 
> to assist its development and monitoring of investment policies? or would 
> the City get bogged down in 
> issues of times series object compatibility?

All I can say is that a lot of people are successfully using R to
analyse such questions. I have used R to help in policy thinking in a
context slightly bigger than Orlando :-)

In the last few days, I have been porting some of my personal code
which prices pension guarantees from C to R. I don't feel hesitant in
putting R into mission critical applications. It is solid, elegant,
well thought out code. Sometimes I think that R is to statistics
programs what Unix is to operating systems: elegant and brilliant.

I wouldn't worry so much about TS object compatibility. E.g. speaking
for me, I have "standardised" on ITS. Everything that I'm doing is
ITS. This has worked well. ITS has not choked on functionality for me
thus far. Yes, it bothers me that ITS is an orphan but so far I've not
been stuck for want of functionality. And, it isn't that hard to get
data in and out of ITS objects, so it isn't asif you're making a big
investment and incurring much by way of sunk costs. If you should
choose to switch to something else in the future, it won't be hard.

-- 
Ajay Shah                                                   Consultant
ajayshah at mayin.org                      Department of Economic Affairs
http://www.mayin.org/ajayshah           Ministry of Finance, New Delhi



More information about the R-sig-finance mailing list