Optimization error when calculating stacking (logarithmic rule) weights as:

“Error in optim(theta.old, fun, gradient, control = control, method = method, :

initial value in ‘vmmin’ is not finite”

I am aware a K-fold validation is needed. I want to first understand why stacking weights doesn’t work.

```
[loo points.rdata|attachment](upload://j5NEYDCZQX1Fhsb1ckPev961Sls.rdata) (703 Bytes)
PBMA_wts <- pseudobma_weights(loo_points_mtx,BB=F)
PBMA_wts_BB <- pseudobma_weights(loo_points_mtx,BB=T)
LogStacking_wts <- stacking_weights(loo_points_mtx)
```

By the way I also calculated information criteria for comparison including AIC and WAIC (which are not ideal)

```
[IC list.rdata|attachment](upload://5CSlpsEidekKu4KwnIzfqAuGE85.rdata) (129 Bytes)
# AIC weights
if(abs(min(AIC_list)) >= abs(max(AIC_list))){
AIC_Z <- min(AIC_list)
} else {
AIC_Z <- max(AIC_list)
}
AIC_wts <- exp(AIC_list - AIC_Z) / sum(exp(AIC_list - AIC_Z))
# WAIC weights
if(abs(min(unlist(WAICValue_list))) >= abs(max(unlist(WAICValue_list)))){
WAIC_Z <- min(unlist(WAICValue_list))
} else {
WAIC_Z <- max(unlist(WAICValue_list))
}
WAIC_wts <- exp(unlist(WAICValue_list)-WAIC_Z)/sum(exp(unlist(WAICValue_list)-WAIC_Z))
```