[R-SIG-Finance] timeSeries

Achim Zeileis Achim.Zeileis at wu-wien.ac.at
Mon Feb 11 17:19:11 CET 2008


On Mon, 11 Feb 2008, Vorlow Constantinos wrote:

> I am experimenting with Rmetrics and the fImport library...

The usual pointer: these are *packages* not *libraries*.

> Can you run stats, regressions etc. on a "timeSeries" object?

Another pointer as usual: What exactly do you mean by this? Provide a
better example. See also
  http://www.R-project.org/posting-guide.html

> If you choose to download the data as a "ts" object
> everythings works fine though I can't gate the dates to display on a ts
> plot...

...because they are not contained in the "ts" object. (The point about
time series formats such as "timeSeries" or "zoo" is that they can store
such information whereas "ts" cannot.)

> Any clues?

If you want to run a linear regression model (not sure what you mean by
"stats, regression etc."), the package "fRegression" (which has some
functionality for "timeSeries" objects) or the packages "dyn" or "dynlm"
(working with "zoo" objects) might be of help.

An example for an AR(1) OLS regression with dynlm/zoo:

## close prices
library("tseries")
dj <- get.hist.quote("^DJI", start = "2007-01-01", quote = "Close")

## returns
djr <- diff(log(dj))
plot(djr)

## AR(1) regression
library("dynlm")
fm <- dynlm(djr ~ L(djr))
summary(fm)

> I found out that trying to plot some timeSeries objects and calling a
> barplot funcion, causes R (eventually) to crash...

How should we be able to reproduce this?? Again, I can only guess and
  barplot(DJret)
just produces a correct error message.
Z



More information about the R-SIG-Finance mailing list