Skip to contents

Takes a non-primitive R function and refactors it to be compatible with optimization via stats::optim.

Usage

make_optim_function(fn, ...)

Arguments

fn

function A non-primitive function

...

Arguments to fn to fix for before building the function to be optimized. Useful for reducing the number of free parameters in an optimization if there are insufficient degrees of freedom.