Re: [ojAlgo-user] 答复: ojAlgo-user Digest, Vol 79, Issue 3
Mathematics, linear algebra and optimisation
Brought to you by:
apete
From: Anders P. <an...@op...> - 2017-05-11 06:27:09
|
Think of it this way. The optimisation algorithm tries to maximise expected return and minimise variance and the same time - there are 2 terms in the optimisation objective function. To balance those 2 terms they need to be weighted somehow. The risk aversion factor/parameter scales the variance term to match the return term. For a more theoretical explanation you may read Appendix 2 of this document: http://kth.diva-portal.org/smash/get/diva2:10311/FULLTEXT01 /Anders > On 11 May 2017, at 02:46, lvz...@gt... wrote: > > > Hi, > What is the definition of risk aversion factor? > > Lvzifeng > > > > oja...@li... > 2017/05/10 20:05 > 请答复 给 > oja...@li... > > 收件人 > oja...@li... > 抄送 > 主题 > ojAlgo-user Digest, Vol 79, Issue 3 > > > > > > Send ojAlgo-user mailing list submissions to > oja...@li... > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > or, via email, send a message with subject or body 'help' to > oja...@li... > > You can reach the person managing the list at > oja...@li... > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of ojAlgo-user digest..." > > > Today's Topics: > > 1. ??: Report A Bug Of ojalgo finace library (yifa wang) > 2. Re: ??: Report A Bug Of ojalgo finace library (Anders Peterson) > 3. Re: Report A Bug Of ojalgo finace library (Anders Peterson) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 9 May 2017 15:15:36 +0000 > From: yifa wang <fag...@ho...> > Subject: [ojAlgo-user] ??: Report A Bug Of ojalgo finace library > To: "oja...@li..." > <oja...@li...> > Message-ID: > <SG2...@SG...> > > Content-Type: text/plain; charset="gb2312" > > hi, > > > I try to use ojalgo to do a portfolio optimization. The target is find an efficient frontier for 15 securities or more. I generate random returns for simulation. However, when I run the program, I get the state as "UNEXPLORED". Usually, we get OPTIMAL. What does this mean? Is it possible to get the optimal weight for more than 50 securities? > > > Thanks. > > Jerry > > > > > > ________________________________ > ???: lvz...@gt... <lvz...@gt...> > ????: 2017?5?8? ?? 8:20:21 > ???: oja...@li... > ??: [ojAlgo-user] Report A Bug Of ojalgo finace library > > > Hi, > I have a problem when calculate best invest group by using markowitzModel in ojalgo with code below(for test); > > > > > for(int j = 0; j < 100; j ++) > { Builder<PrimitiveMatrix> tmpBuilder = PrimitiveMatrix.FACTORY.getBuilder(2, 2); > tmpBuilder.add(0, 0, 0.040000); > tmpBuilder.add(0, 1, 0.1000); > tmpBuilder.add(1, 0, 0.1000); > tmpBuilder.add(1, 1, 0.250000); > BasicMatrix covariances = tmpBuilder.build(); > tmpBuilder = PrimitiveMatrix.FACTORY.getBuilder(2); > tmpBuilder.add(0, 0.20000); > tmpBuilder.add(1, 0.40000); > BasicMatrix expectedExcessReturns = tmpBuilder.build(); > > MarketEquilibrium equilibrium = new MarketEquilibrium(covariances); > MarkowitzModel markowitzModel = new MarkowitzModel(equilibrium, expectedExcessReturns); > markowitzModel.setShortingAllowed(false); > // markowitzModel.optimiser().validate(true); > markowitzModel.setTargetReturn(new BigDecimal(0.2 + (0.002 * j))); > for (int i = 0; i < 2; i++) { > markowitzModel.setLowerLimit(i, new BigDecimal(0.00000)); > markowitzModel.setUpperLimit(i, new BigDecimal(1.00000)); > } > System.out.println(0.2 + (0.002 * j) + "," + markowitzModel.getReturnVariance() + " , " + markowitzModel.getMeanReturn() + "," + markowitzModel.getWeights()); > > > } > > > when TargetReturn equal to 0.206,Variance equal to 0.04 , weights equal to [1.0, 0.0] > when TargetReturn equal to 0.208, Variance equal to 0.25,weights equal to [0.0, 1.0] > Below Relationship of TargetReturn And Target Variance?Y-Axis TargetReturn,X-AXis standard deviation? > > > > ??? > > -------------- next part -------------- > An HTML attachment was scrubbed... > > ------------------------------ > > Message: 2 > Date: Tue, 9 May 2017 22:34:46 +0200 > From: Anders Peterson <an...@op...> > Subject: Re: [ojAlgo-user] ??: Report A Bug Of ojalgo finace library > To: oja...@li... > Message-ID: <9FD...@op...> > Content-Type: text/plain; charset=utf-8 > > UNEXPLORED would mean the optimisation has not been executed (since you last modified the model). How did you get that? > > /Anders > > > > > > On 9 May 2017, at 17:15, yifa wang <fag...@ho...> wrote: > > > > hi, > > > > I try to use ojalgo to do a portfolio optimization. The target is find an efficient frontier for 15 securities or more. I generate random returns for simulation. However, when I run the program, I get the state as "UNEXPLORED". Usually, we get OPTIMAL. What does this mean? Is it possible to get the optimal weight for more than 50 securities? > > > > Thanks. > > Jerry > > > > > > > > > > ???: lvz...@gt... <lvz...@gt...> > > ????: 2017?5?8? ?? 8:20:21 > > ???: oja...@li... > > ??: [ojAlgo-user] Report A Bug Of ojalgo finace library > > > > > > Hi, > > I have a problem when calculate best invest group by using markowitzModel in ojalgo with code below(for test); > > > > > > > > > > for(int j = 0; j < 100; j ++) > > { Builder<PrimitiveMatrix> tmpBuilder = PrimitiveMatrix.FACTORY.getBuilder(2, 2); > > tmpBuilder.add(0, 0, 0.040000); > > tmpBuilder.add(0, 1, 0.1000); > > tmpBuilder.add(1, 0, 0.1000); > > tmpBuilder.add(1, 1, 0.250000); > > BasicMatrix covariances = tmpBuilder.build(); > > tmpBuilder = PrimitiveMatrix.FACTORY.getBuilder(2); > > tmpBuilder.add(0, 0.20000); > > tmpBuilder.add(1, 0.40000); > > BasicMatrix expectedExcessReturns = tmpBuilder.build(); > > > > MarketEquilibrium equilibrium = new MarketEquilibrium(covariances); > > MarkowitzModel markowitzModel = new MarkowitzModel(equilibrium, expectedExcessReturns); > > markowitzModel.setShortingAllowed(false); > > // markowitzModel.optimiser().validate(true); > > markowitzModel.setTargetReturn(new BigDecimal(0.2 + (0.002 * j))); > > for (int i = 0; i < 2; i++) { > > markowitzModel.setLowerLimit(i, new BigDecimal(0.00000)); > > markowitzModel.setUpperLimit(i, new BigDecimal(1.00000)); > > } > > System.out.println(0.2 + (0.002 * j) + "," + markowitzModel.getReturnVariance() + " , " + markowitzModel.getMeanReturn() + "," + markowitzModel.getWeights()); > > > > > > } > > > > > > when TargetReturn equal to 0.206,Variance equal to 0.04 , weights equal to [1.0, 0.0] > > when TargetReturn equal to 0.208, Variance equal to 0.25,weights equal to [0.0, 1.0] > > Below Relationship of TargetReturn And Target Variance?Y-Axis TargetReturn,X-AXis standard deviation? > > > > > > > > ??? > > > > ------------------------------------------------------------------------------ > > Check out the vibrant tech community on one of the world's most > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________ > > ojAlgo-user mailing list > > ojA...@li... > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > > ------------------------------ > > Message: 3 > Date: Tue, 9 May 2017 23:32:47 +0200 > From: Anders Peterson <an...@op...> > Subject: Re: [ojAlgo-user] Report A Bug Of ojalgo finace library > To: oja...@li... > Message-ID: <A20...@op...> > Content-Type: text/plain; charset=utf-8 > > Haven?t fully understood yet why that small/simple model is so problematic. The covariance matrix is not positive definite, Strictly speaking it needs to be, but most of the time semidefinite is ok. > > Setting a target return or variance is not the best way to use ojAlgo?s MarkowitzModel class. Work directly with the risk aversion factor instead. > > If what you want to do is to calculate the efficient frontier then it?s better to use the EfficientFrontier class rather than the MarkowitzModel class. > > /Anders > > > > On 8 May 2017, at 14:20, lvz...@gt... wrote: > > > > > > Hi, > > I have a problem when calculate best invest group by using markowitzModel in ojalgo with code below(for test); > > > > > > > > > > for(int j = 0; j < 100; j ++) > > { Builder<PrimitiveMatrix> tmpBuilder = PrimitiveMatrix.FACTORY.getBuilder(2, 2); > > tmpBuilder.add(0, 0, 0.040000); > > tmpBuilder.add(0, 1, 0.1000); > > tmpBuilder.add(1, 0, 0.1000); > > tmpBuilder.add(1, 1, 0.250000); > > BasicMatrix covariances = tmpBuilder.build(); > > tmpBuilder = PrimitiveMatrix.FACTORY.getBuilder(2); > > tmpBuilder.add(0, 0.20000); > > tmpBuilder.add(1, 0.40000); > > BasicMatrix expectedExcessReturns = tmpBuilder.build(); > > > > MarketEquilibrium equilibrium = new MarketEquilibrium(covariances); > > MarkowitzModel markowitzModel = new MarkowitzModel(equilibrium, expectedExcessReturns); > > markowitzModel.setShortingAllowed(false); > > // markowitzModel.optimiser().validate(true); > > markowitzModel.setTargetReturn(new BigDecimal(0.2 + (0.002 * j))); > > for (int i = 0; i < 2; i++) { > > markowitzModel.setLowerLimit(i, new BigDecimal(0.00000)); > > markowitzModel.setUpperLimit(i, new BigDecimal(1.00000)); > > } > > System.out.println(0.2 + (0.002 * j) + "," + markowitzModel.getReturnVariance() + " , " + markowitzModel.getMeanReturn() + "," + markowitzModel.getWeights()); > > > > > > } > > > > > > when TargetReturn equal to 0.206,Variance equal to 0.04 , weights equal to [1.0, 0.0] > > when TargetReturn equal to 0.208, Variance equal to 0.25,weights equal to [0.0, 1.0] > > Below Relationship of TargetReturn And Target Variance?Y-Axis TargetReturn,X-AXis standard deviation? > > > > > > > > ??? > > > > <1.jpg>------------------------------------------------------------------------------ > > Check out the vibrant tech community on one of the world's most > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________ > > ojAlgo-user mailing list > > ojA...@li... > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > > ------------------------------ > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > ------------------------------ > > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > End of ojAlgo-user Digest, Vol 79, Issue 3 > ****************************************** > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |