Skip to contents

Create a monty_model from a function that computes density. This allows use of any R function as a simple monty model. If you need advanced model features, then this interface may not suit you and you may prefer to use monty_model directly.

Usage

monty_model_function(density, packer = NULL, fixed = NULL)

Arguments

density

A function to compute log density. It can take any number of parameters

packer

Optionally, a monty_packer object to control how your function parameters are packed into a numeric vector. You can typically omit this if all the arguments to your functions are present in your numeric vector and if they are all scalars.

fixed

Optionally, a named list of fixed values to substitute into the call to density. This cannot be used in conjunction with packer (you should use the fixed argument to monty_packer instead).

Value

A monty_model object that computes log density with the provided density function, given a numeric vector argument representing all parameters.

Details

This interface will expand in future versions of monty to support gradients, stochastic models, parameter groups and simultaneous calculation of density.