I have the following Function:
Double.Historical.Sim.Var <- function(d1, wa=0.75, wb=0.25, pv=1000, cl=0.95)
{
x <- pv
w <- c(wa,wb)
Pw <- -pv*w
loss <- rowSums(t(Pw * t(d1)))
result <- quantile(loss,0.95)
return(result)
}
I need a way for the function to take Wa from 0.01 to 1 with wb being (1-wa)
#and to tell me with which combination of wa and wb the value of this #function is the lowest.
Thanks in advance for any help !!