At the moment I'm trying to do a minimization (optimization) problem in R, where I have a vector X1 that I want to approximate through a weighted average of a matrix X2 and a vector of weights w. That means I want to minimize
wg <- function(w)
{
t(X1 - X2 %*% w) %*% (X1 - X2 %*% w)
}
the constraints on the weights are w[i]>= 0 and sum(w) = 1 .
At the moment I'm using the DEoptim package to do my optimization, but I feel like it can't deal well with corner solutions.
I'm replicating a method that was used in an economics paper and in that paper almost all of the weights turned out to be zero. I expected a similar result in my case ( I want to model Arizona through a weighted average of the other states), especially due to the heterogeneity in the economic situation.
At the moment I feel like it's more of a problem with the DEoptim package than with my methodology and I don't really trust the results. Which other package can I use, preferrably ones that are stronger in looking for corner solutions?
my DEoptim is set up as follows:
controlDE <- list(reltol=.0000000001,steptol=150, itermax = 5000,trace = 250)
#control parameters
outDEoptim <- DEoptim(fn = wg, lower = rep(0, N), upper = rep(1, N),
control = controlDE)
Any help would be much appreciated!