parscale.famos {FAMoS} | R Documentation |
Control Function for Optim
Description
This function is designed to use the built-in option parscale
in optim
with absolute scaling values.
Usage
parscale.famos(par, scale, fix = 1, correction = NULL)
Arguments
par |
A vector containing the values of the original parameters. |
scale |
A vector containing the corresponding absolute scaling values that will be used during the first steps in |
fix |
Integer containing the index of the parameter that will be scaled by 10% of its original value, meaning the corresponding entry in scale will be overwritten ( |
correction |
Used for scaling newly added parameter values by their original scale as specified in |
Value
A vector that can be used to scale parscale
in optim
accordingly.
Examples
test.func<-function(x){
print(x)
3*x[1]+4*x[2]
}
pars <- c(1, 1000, 10)
scaling <- c(0.1, 3000, 10)
p.scale <- parscale.famos(par = pars, scale = scaling)
optim(par = pars, fn = test.func, control = list(maxit = 10, parscale = p.scale, trace = TRUE))
[Package FAMoS version 0.3.0 Index]