Learn R Programming

emdbook (version 1.3.2.1)

metropSB: Metropolis-Szymura-Barton algorithm

Description

Stochastic global optimization using the Metropolis-Szymura-Barton algorithm. New parameters are chosen from a uniform candidate distribution with an adaptively tuned scale, and accepted or rejected according to a Metropolis rule.

Usage

metropSB(fn, start, deltap = NULL, scale = 1, rptfreq = -1, acceptscale
= 1.01, rejectscale = 0.99, nmax = 10000,
retvals = FALSE, retfreq = 100, verbose = FALSE, ...)

Arguments

fn
Objective function, taking a vector of parameters as its first argument. The function is minimized, so it should be a negative log-likelihood or a negative log-posterior density.
start
Vector of starting values
deltap
Starting jump size; half-width of uniform distribution
scale
Scaling factor for acceptance
rptfreq
Frequency for reporting interim results (
acceptscale
Amount to inflate candidate distribution if last jump was accepted
rejectscale
Amount to shrink candidate distribution if last jump was rejected
nmax
Number of iterations
retvals
Return detailed statistics?
retfreq
Sampling frequency for detailed statistics
verbose
Print status?
...
Other arguments to fn

Value

  • minimumminimum value achieved
  • estimateparameters corresponding to minimum
  • funcallsnumber of function evaluations
  • If retvals=TRUE:
  • retvalsmatrix of periodic samples including parameters, jump scale, current value, and minimum achieved value

Details

Metropolis-Szymura-Barton algorithm: given function and starting value, try to find parameters that minimize the function Algorithm: at a given step, 1. pick a new set of parameters, each of which is uniformly distributed in (p[i]-deltap[i],p[i]+deltap[i]) 2. calculate function value at new parameter values 3. if f(new)f(old), accept with probability (exp(-scale*(f(new)-f(old))) 5. if accept, increase all deltap values by acceptscale; if reject, decrease by rejectscale 6. if better than min so far, save function and parameter values 7. if reject, restore old values

References

Szymura and Barton (1986) Genetic analysis of a hybrid zone between the fire-bellied toads,Bombina bombina and B. variegata, near Cracow in southern Poland. Evolution 40(6):1141-1159.

See Also

optim, MCMCmetrop1R (MCMCpack package)