goldopt {cluscov} | R Documentation |
Integer Golden Search Minimisation
Description
This function conducts an integer golden search minimisation of a univariate function.
Usage
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
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)
[Package cluscov version 1.1.0 Index]