Please keep the conversation on the list, Esra... I don't do personal
tutoring online, and others may answer your questions sooner and better
than I can.
Some comments below:
On Sat, 20 Dec 2014, Esra Ulasan wrote:
Hello,
Thank you very much for your concern. I have these codes for portfolio
"if weight element is negative set it to zero, else recalculate the weights
again"... this seems like the only way out of this loop is to calculate
negative weights... and since you set them to zero at that point they will all
be zero when you are done. Somehow I doubt that is what you intended
What about
ifelse(w < 0, 0, w)
See ?ifelse for more information.
Best,
Jorge.-
On Sat, Dec 20, 2014 at 3:26 PM, Esra Ulasan wrote:
> Hello,
>
> I have tried the solve the non-negativity constraint "if else function" in
> R. But I have done something wrong because it still gives the same
> so
Hello,
I have tried the solve the non-negativity constraint "if else function" in R.
But I have done something wrong because it still gives the same solution. I
want that, if weight element is negative set it to zero, else recalculate the
weights again. These are the codes:
for(i in 1:M){ w[,
4 matches
Mail list logo