Hello. I don't understand a particular output of portfolio.optim (tseries). I have 4 assets and the portfolio.optim returns an asset with weight equals to zero. If I do a portfolio.optim with 3 assets, without the asset with weight equals to zero, it returns a completely different result.
That's I would expected the same weights as the run with 4 assets. Below the code. Thanks in advance, Alberto Santini ------------------------------------- require(tseries) f.mi <- coredata(get.hist.quote("F.MI", start="2006-09-03", compression="w", quote="Close")) eng.mi <- coredata(get.hist.quote("ENG.MI", start="2006-09-03", compression="w", quote="Close")) tis.mi <- coredata(get.hist.quote("TIS.MI", start="2006-09-03", compression="w", quote="Close")) spmib <- coredata(get.hist.quote("^SPMIB", start="2006-09-03", compression="w", quote="Close")) f.mi.rets <- diff(log(f.mi[1:(length(f.mi)-1)])) eng.mi.rets <- diff(log(eng.mi[1:(length(eng.mi)-1)])) tis.mi.rets <- diff(log(tis.mi[1:(length(tis.mi)-1)])) spmib.rets <- diff(log(spmib[1:(length(spmib)-1)])) x <- cbind(f.mi.rets, eng.mi.rets, tis.mi.rets, spmib.rets) res <- portfolio.optim(x); res$pw x2 <- cbind(f.mi.rets, eng.mi.rets, spmib.rets) res <- portfolio.optim(x2); res$pw -- View this message in context: http://www.nabble.com/portfolio.optim-and-assets-with-weigth-equals-to-zero...-tp19289567p19289567.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.