[R-SIG-Finance] fPortfolio - why getting a zero vector as weights for my portfolio

u0055 at wolke7.net u0055 at wolke7.net
Thu Jul 3 16:23:55 CEST 2014


Hello Rs,

I would like to optimize the weights of a portfolio.
I chose the fPortfolio package.
Sometimes it's working well,
sometimes I get a zero vector as weight vector for my portfolio.
Why is that ?

Here my R code and data of 5 assets:

require( timeSeries )
require( fPortfolio )
x = c(
0.0004101995964433642, -0.00018580025947176148, 0.0001921211753136999, 
-0.0009374090928287272, 0.02179035825399216, -0.0008010181637519165, 
0.02762103313486072, -0.02059593202791299, 0.009890131347811582, 
0.008874502330834042, 0.03270962505025148, 0.0004709525370067878, 
-0.026172393520773156, -0.002070884888637307, -0.021394084189246338, 
0.014663881480845464, 0.000007589055248672503, 0.03357767208442292, 
0.007489994621009966, 0.0354779091735148, -0.004488890361817627,
0.0006037637415494107, -0.0001747374366735466, 0.0002776560800516695, 
-0.0010539757116864686, 0.007217907272059155, -0.0009999339576310352, 
0.0018097094037338678, -0.0072761973581043134, 0.007274147797504215, 
0.011722205826326859, 0.0284076103749228, 0.00020854896466472906, 
-0.027139287243448704, 0.0009288913408461102, -0.013985585851090089, 
0.008355345607646895, 0.005703625000569552, 0.031154509412550213, 
0.008409491754987508, 0.050116507149955865, -0.002471235927845941,
0.0004329670989004567, -0.00014108375322680291, 0.00024873249512844, 
-0.0007654340066147783, 0.018092403293930987, -0.0015557105255950537, 
0.015910756127921546, -0.01736078352542159, 0.008348345947451275, 
0.007744974101786212, 0.029968431702077265, 0.0016856756212381618, 
-0.0252969523459683, -0.0006213069455005302, -0.01923409835975207, 
0.012209755091657625, 0.0007510294849596395, 0.03210686006944077, 
0.006634533610756534, 0.04169475959584361, -0.0025908541571262045,
0.0005954295776526556, -0.00013175957287530423, 0.0002509094271978344, 
-0.0009448108075862921, 0.007528674135685146, -0.0014060182806468655, 
0.0008597209029989182, -0.007178209888799298, 0.00689554753496824, 
0.009766184066262252, 0.02818192946497762, -0.004207950567021389, 
-0.023491857691380978, 0.0005314474698686129, -0.015464139804048354, 
0.008342940298155603, 0.005682816731364199, 0.03209078200750012, 
0.00815688540306469, 0.04912648130491875, -0.004043194319244131,
0.0004677174973875975, -0.00007283224369502313, 0.0003351392464246223, 
-0.0005029457171303313, 0.012448156249627087, -0.002707609393671422, 
-0.001962824566880327, -0.012422925284776823, 0.005995094546901327, 
0.006020957331134253, 0.025784505012758727, 0.0035397266445386837, 
-0.023960752658108264, 0.0015912067571819243, -0.015937277883155545, 
0.008463983234476183, 0.001885754351360598, 0.029861936467625895, 
0.005328829963527624, 0.05118363655624024, 0.0003061484710870088 )
m = matrix( x, ncol=5 ) # nrow=21
t = timeSeries( m )
spec = portfolioSpec()
setTargetReturn( spec ) = 0.005
efficientPortfolio( data = t, spec = spec )

Here is the vector of my 5 mean returns:
[ 0.005549026539862658, 0.00519471267813756, 0.005155380981994628, 
0.004816276542524382, 0.004554553551564478 ].
So you can see,
that my target return of 0.005 has a solution.

1) There is a solution.
How can I get it ?

2) Is there maybe an other package,
which gives an weight output for every input of returns ?

Thanks in advance,
Uwe



More information about the R-SIG-Finance mailing list