View source: R/parscale_famos_function.R
parscale.famos | R Documentation |
This function is designed to use the built-in option parscale
in optim
with absolute scaling values.
parscale.famos(par, scale, fix = 1, correction = NULL)
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 |
A vector that can be used to scale parscale
in optim
accordingly.
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.