goldopt: Integer Golden Search Minimisation

Description Usage Arguments Value Examples

Description

This function conducts an integer golden search minimisation of a univariate function.

Usage

1
goldopt(fn, interval, tol = 1)

Arguments

fn

function to be minimised. fn should return a list, with fval as the function value.

interval

a vector of length two containing the minimum and maximum interger values within which to search for the minimiser.

tol

the tolerance level. Defaults at 1

Value

k minimiser of fn()

crit the minimum

iter total number of iterations

iterfn total number of function evaluations of fn()

fobj an object of the function minimisation

key a logical for warning if fobj may not correspond to k

Examples

1
2
3
4
5
6
set.seed(14) #Generate data
N = 1000; (bets = rep(-2:2,4)); p = length(bets); X = matrix(rnorm(N*p),N,p)
Y = cbind(1,X)%*%matrix(c(0.5,bets),ncol = 1)
fn=function(k){du=CCRls.coord(Y,X,k=k,nC=1)
return(list(fval=BIC(du$mobj),obj=du))}
goldopt(fn=fn,interval=c(2,7),tol=1)

cluscov documentation built on June 4, 2019, 5:04 p.m.