Skip to contents

Compute the gradient of log density (which is returned by monty_model_density) with respect to parameters. Not all models support this, and an error will be thrown if it is not possible.

Usage

monty_model_gradient(model, parameters, named = FALSE)

Arguments

model

A monty_model object

parameters

A vector or matrix of parameters

named

Logical, indicating if the output should be named using the parameter names.

Value

A vector or matrix of gradients

See also

monty_model_density for log density, and monty_model_direct_sample to sample from a model