Learn R Programming

Bhat (version 0.9-12)

dfp: Function minimization with box-constraints

Description

This Davidon-Fletcher-Powell optimization algorithm has been `hand-tuned' for minimal setup configuration and for efficency. It uses an internal logit-type transformation based on the pre-specified box-constraints. Therefore, it usually does not require rescaling (see help for the R optim function). dfp automatically computes step sizes for each parameter to operate with sufficient sensitivity in the functional output. Performance is comparable to the BFGS algorithm in the R function optim. dfp interfaces with newton to ascertain convergence, compute the eigenvalues of the Hessian, and provide 95% confidence intervals when the function to be minimized is a negative log-likelihood.

Usage

dfp(x, f, tol = 1e-05, nfcn = 0, ...)

Arguments

x

a list with components 'label' (of mode character), 'est' (the parameter vector with the initial guess), 'low' (vector with lower bounds), and 'upp' (vector with upper bounds)

f

the function that is to be minimized over the parameter vector defined by the list x

tol

a tolerance used to determine when convergence should be indicated

nfcn

number of function calls

...

other parameters to be passed to `f`

Value

list with the following components:

fmin

the function value f at the minimum

label

the labels taken from list x

est

a vector of the estimates at the minimum. dfp does not overwrite x

status

0 indicates convergence, 1 indicates non-convergence

nfcn

no. of function calls

Details

The dfp function minimizes a function f over the parameters specified in the input list x. The algorithm is based on Fletcher's "Switching Method" (Comp.J. 13,317 (1970))

the code has been 'transcribed' from Fortran source code into R

References

Fletcher's Switching Method (Comp.J. 13,317, 1970)

See Also

optim, newton, ftrf, btrf, logit.hessian

Examples

Run this code
# NOT RUN {
        # generate some Poisson counts on the fly
          dose <- c(rep(0,50),rep(1,50),rep(5,50),rep(10,50))
          data <- cbind(dose,rpois(200,20*(1+dose*.5*(1-dose*0.05))))

        # neg. log-likelihood of Poisson model with 'linear-quadratic' mean: 
          lkh <- function (x) { 
          ds <- data[, 1]
          y  <- data[, 2]
          g <- x[1] * (1 + ds * x[2] * (1 - x[3] * ds)) 
          return(sum(g - y * log(g)))
          }

	# for example define
          x <- list(label=c("a","b","c"),est=c(10.,10.,.01),low=c(0,0,0),upp=c(100,20,.1))

	# call:
	  results <- dfp(x,f=lkh)

# }

Run the code above in your browser using DataLab