[R] numeric derivation
Gabor Grothendieck
ggrothendieck at gmail.com
Sun Oct 12 15:33:59 CEST 2008
If you simply want successive differences use diff:
x <- seq(4)^2
diff(x)
tx <- ts(x)
diff(tx)
On Sun, Oct 12, 2008 at 9:19 AM, Oliver Bandel
<oliver at first.in-berlin.de> wrote:
> Zitat von Gabor Grothendieck <ggrothendieck at gmail.com>:
>
>> On Sun, Oct 12, 2008 at 7:24 AM, Oliver Bandel
>> <oliver at first.in-berlin.de> wrote:
> [...]
>>
>> The input to numericDeriv is not values but an expression.
>> See the Examples section at the end of ?numericDeriv
>> The expression given as the first arg
>> ultimately needs to be evaluated at a value so it needs to
>> know where to find that value. Note that it defaults
>> to the caller's environment so we can leave that argument
>> out if the variable is known to be there:
>>
>> X <- 3
>> numericDeriv(quote(X^2), "X")
> [...]
>
> Well, that's quite close to symbolic derivation.
>
> I have a dataset, that I want to derive numerically
> "quote(X^2)" is providing a function. I have a dataset.
>
> So I may write my own derivative function?
> Or is there something as part of the ts-class available?
>
> Ciao,
> Oliver
>
More information about the R-help
mailing list