optifix: optifix. Optimise with fixed parameters

Description Usage Details

View source: R/optifix.R

Description

its like optim, but with fixed parameters.

Usage

1
2
3
optifix(par, fixed, fn, gr = NULL, ..., method = c("Nelder-Mead", "BFGS",
  "CG", "L-BFGS-B", "SANN"), lower = -Inf, upper = Inf, control = list(),
  hessian = FALSE)

Details

specify a second argument 'fixed', a vector of numerical values. There are three options (a) To indicate that the parameter in fn() is optimised over, use 0 (b) To indicate that the parameter in fn() is fixed to its starting value, use its index. Thus, if the Nth parameter in fn() is fixed to the starting value, then fixed[N] <- N. (c) To indicate that the parameter in fn() is fixed to the value of another parameter, use the index of that parameter. Thus, if the Nth parameter in fn() should have the same value as the Mth parameter, then fixed[N] <- M.

The return thing is the return thing from optim() but with a couple of extra bits - a vector of all the parameters and a vector copy of the 'fixed' argument.

This function was adapted by Fabian Soto from code originally written by Barry Rowlingson <b.rowlingson@lancaster.ac.uk> in October 2011 and released under a CC By-SA license: http://creativecommons.org/licenses/by-sa/3.0/

Any use of this script must retain the text: "Originally written by Barry Rowlingson" in comments.


fsotoc/grtools documentation built on Nov. 15, 2020, 5:14 a.m.