D: D

DR Documentation

D

Description

Get derivative of phenofit object. D1 first order derivative, D2 second order derivative, n curvature curvature.

Usage

D1(fit, t = NULL, analytical = FALSE, smoothed.spline = FALSE, ...)

D2(fit, t = NULL, analytical = FALSE, smoothed.spline = FALSE, ...)

## S3 method for class 'fFIT'
D1(fit, t = NULL, analytical = FALSE, smoothed.spline = FALSE, ...)

## S3 method for class 'fFIT'
D2(fit, t = NULL, analytical = FALSE, smoothed.spline = FALSE, ...)

curvature(fit, t = NULL, analytical = FALSE, smoothed.spline = FALSE, ...)

## S3 method for class 'fFIT'
curvature(fit, t = NULL, analytical = FALSE, smoothed.spline = FALSE, ...)

Arguments

fit

A curve fitting object returned by curvefit, with the object of:

  • par: parameters of curve fitting function

  • fun: curve fitting function name, e.g., "doubleLog_AG"

  • zs: predicted values, vector or data.frame

analytical

If true, numDeriv package grad and hess will be used; if false, D1 and D2 will be used.

smoothed.spline

Whether apply smooth.spline first?

...

Other parameters will be ignored.

Details

If fit$fun has no gradient function or smoothed.spline = TRUE, time-series smoothed by spline first, and get derivatives at last. If fit$fun exists and analytical = TRUE, smoothed.spline will be ignored.

Value

  • der1 First order derivative

  • der2 Second order derivative

  • k Curvature

Examples

# doubleLog.Beck
t    <- seq(1, 365, 8)
tout <- seq(1, 365, 1)
par  = c(mn  = 0.1, mx  = 0.7, sos = 50, rsp = 0.1, eos = 250, rau = 0.1)
y <- doubleLog.Beck(par, t)

methods <- c("AG", "Beck", "Elmore", "Gu", "Zhang") # "Klos" too slow
fit <- curvefit(y, t, tout, methods)
x  <- fit$model$AG
d1 <- D1(x)
d2 <- D2(x)
d_k <- curvature(x)

phenofit documentation built on May 29, 2024, 2:39 a.m.