[R] first derivative of a time series

gj joueg at tcd.ie
Fri Jan 13 12:14:54 CET 2006


Hi,

I need to derive a time series that represents the first derivative of an
original time series. The function coefDeriv in the cyclones package seemed to
be the ticket, but I'm not sure if I am interpreting the output of the function
correctly...or even using the function correctly.

This is a snipbit of what I've been trying:
--------
library(cyclones)

## read in my 1-column of values, each line is a different time step
ts.table <- read.table("timeseries.1d")
ts.values <- ts.table[,1]

## first calculate coefficients to pass to coefDeriv
ts.coef <- coefFit(ts.values)

d.ts <- coefDeriv(ts.coef)
-------

However, when I try to look at d.ts$y.deriv, assumning that this will plot the
derivative I want, all the numbers are huge (on the order of e+02 to e+08) when
my original time series ranged from 0 to 970. Am I going about this the wrong
way? Or are there other tools that would lead me to estimating the derivative
of a time series?

Thanks in advance for any help!
g




More information about the R-help mailing list