ff_deriv: Function for derivatives

View source: R/04_predict.R

ff_derivR Documentation

Function for derivatives

Description

Function for derivatives

Usage

ff_deriv(params, x_new, curve, fixed_params = NA, which = "fd")

Arguments

params

A vector of parameter values.

x_new

A vector of x values to evaluate the derivative.

curve

A string. The name of the function used for curve fitting.

fixed_params

A vector of fixed parameter values. NA by default.

which

Can be "fd" for first-derivative or "sd" for second-derivative.

Value

First or second derivative.

Examples

library(flexFitR)
data(dt_potato)
mod_1 <- dt_potato |>
  modeler(
    x = DAP,
    y = Canopy,
    grp = Plot,
    fn = "fn_lin_plat",
    parameters = c(t1 = 45, t2 = 80, k = 0.9),
    subset = c(15, 2, 45)
  )
print(mod_1)
# First Derivative
predict(mod_1, x = 45, type = "fd", id = 2)

flexFitR documentation built on April 16, 2025, 5:09 p.m.