Skip to contents

Calculates partial derivatives of the model with respect to each parameter. Used by optimization algorithms for gradient-based fitting.

Usage

peak_model_gradient(model, x, params)

Arguments

model

A peak_model object.

x

Numeric vector of x values.

params

Named list of model parameters.

Value

Matrix of partial derivatives with dimensions (length(x), n_params). Column names correspond to parameter names.

Details

If no analytical gradient is available, a numerical gradient can be computed using finite differences. See peak_model_gradient_numerical().