parscale.parameters: Control Function for Parscale in Optim

Description Usage Arguments Value Examples

View source: R/scale_parameters_function.R

Description

This function is designed to use the built-in option parscale in optim with absolute scaling values.

Usage

1

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 optim.

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 (parscale in optim needs one value like this). Default to 1.

Value

A vector that can be used to scale parscale in optim accordingly.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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.parameters(par = pars, scale = scaling)

optim(par = pars, fn = test.func, control = list(maxit = 10, parscale = p.scale, trace = TRUE))

GabelHub/ProfileIroning documentation built on May 17, 2019, 12:49 p.m.