Create monty_model
from a function computing density
Source: R/model-function.R
monty_model_function.Rd
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.
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 withpacker
(you should use thefixed
argument tomonty_packer
instead).
Value
A monty_model object that computes log density with the
provided density
function, given a numeric vector argument
representing all parameters.