R/dantzig.selector.R

dantzig.selector <- function(lambdalist, BETA0, lambda){

	# if BETA0 dimensions do not match, throw error
	if (length(lambdalist) != dim(BETA0)[2]) {
		stop("BETA0 and lambdalist dimensions are incompatible \n")
	}

	if (lambdalist[length(lambdalist)] > lambda) {
		beta0<-BETA0[,length(lambdalist)]
	} 
	else {
		beta0<-BETA0[,which.max(lambdalist <= lambda)]
	}
	return(beta0)	
}

Try the fastclime package in your browser

Any scripts or data that you put into this service are public.

fastclime documentation built on May 2, 2019, 1:06 p.m.