Hi Statalists,
I would like to plot a mean-variance frontier for 10 decile portfolios but there are little resources in the Stata forum, so I wonder if there any Stata expert who is able to show me with an example of how to achieve that?
Many thanks for your help and hope to hear from you!
I would like to plot a mean-variance frontier for 10 decile portfolios but there are little resources in the Stata forum, so I wonder if there any Stata expert who is able to show me with an example of how to achieve that?
Many thanks for your help and hope to hear from you!

Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(exret_m ret_m rf mktrf smb hmlff P ym) .0790334 .0833334 .0043 .0047 .0411 -.0094 1 439 .09864122 .10294122 .0043 -.0057 -.006 -.0677 1 440 -.0830474 -.0789474 .0041 .0151 .0198 -.0421 1 441 .00987267 .01407267 .0042 .0333 -.02 .0105 1 442 -.004199999 9.141046e-10 .0042 -.0074 .0078 -.0376 1 443 -.03405073 -.02985073 .0042 .0295 -.0145 .0381 1 444 .04172757 .04592757 .0042 .0089 -.0109 .0122 1 445 -.10867764 -.10447764 .0042 .007 -.0033 .0498 1 446 .03987546 .04427546 .0044 .0311 -.0377 -.0702 1 456 .06217543 .066375434 .0042 .0385 .0139 -.0453 1 457 -.017256297 -.012956298 .0043 .083 -.0341 .0035 1 458 .08358102 .08778102 .0042 .0556 -.006 .0373 1 459 -.004798092 -.000698092 .0041 .0789 .0598 .0066 1 460 .11505612 .11915612 .0041 .0629 -.0133 -.0582 1 461 -.06378372 -.05968372 .0041 .0072 -.0091 -.0023 1 462 -.05533814 -.05123814 .0041 -.1037 -.0041 -.0082 1 463 -.02092442 -.016924419 .004 -.0368 .0036 -.0277 1 464 .031931054 .035531055 .0036 .0587 .0324 -.0247 1 465 .018542182 .02204218 .0035 .0215 -.0116 .0073 1 466 -.01693419 -.01323419 .0037 .1041 .0032 .0112 1 467 .073281005 .076881 .0036 -.0324 .0336 -.0232 1 468 .07013717 .073737174 .0036 -.0318 .0171 .0428 1 469 .09813163 .10193162 .0038 -.0667 -.0466 .1209 1 470 .03100628 .034606278 .0036 -.0238 -.0481 .0674 1 471 .04827027 .05197027 .0037 -.0435 .0391 -.0431 1 472 .3726185 .3764185 .0038 -.0024 -.0008 .0505 1 473 -.034545086 -.030645085 .0039 -.0164 .0429 -.038 1 474 -.016049791 -.01214979 .0039 .0212 .0329 -.0614 1 475 -.012545366 -.008545365 .004 -.0303 -.051 .1127 1 476 -.03955902 -.03555902 .004 -.023 -.0067 .0655 1 477 .0008853595 .00498536 .0041 -.0278 -.0416 -.0054 1 478 .008722241 .01302224 .0043 .0485 -.0017 .015 1 479 -.022476185 -.018176185 .0043 -.1416 .0388 .1158 1 480 -.03488795 -.03028795 .0046 .0122 -.0977 .0812 1 481 -.04075969 -.03605969 .0047 .0097 -.018 .0561 1 482 .0015130527 .006313053 .0048 -.0417 .0013 .0686 1 483 .05984865 .06454865 .0047 .0395 -.0407 .0458 1 484 .067946695 .0725467 .0046 .0618 -.0054 .0106 1 485 -.001907963 .0028920374 .0048 -.0065 -.0313 .0392 1 486 .048897 .05389699 .005 -.0231 .0515 -.0211 1 487 .013779294 .018879294 .0051 -.0544 -.0362 .1062 1 488 -.10253892 -.09753892 .005 -.0557 -.036 .0545 1 489 -.10015976 -.09495976 .0052 -.0366 .0154 .0313 1 490 .017525453 .022525454 .005 .0553 -.012 -.0249 1 491 -.01516511 -.01036511 .0048 -.0245 .0274 -.019 1 492 .013253886 .017353887 .0041 -.0077 -.0392 .0658 1 493 -.013382913 -.009482913 .0039 -.1078 -.0227 .0916 1 494 -.02504611 -.02154611 .0035 .0037 .0031 .0143 1 495 -.017492075 -.014292074 .0032 -.0372 .0213 .0185 1 496 -.03017746 -.02717746 .003 .024 -.0422 -.0017 1 497 .032947484 .035947483 .003 .0263 -.0072 .0061 1 498 -.017113637 -.014213637 .0029 .0261 -.0215 -.0173 1 499 -.02252171 -.01972171 .0028 -.1087 .0257 -.0842 1 500 .024497734 .026497735 .002 -.021 -.0106 -.0335 1 501 .004027782 .005727782 .0017 .0265 -.0113 .0064 1 502 .002497825 .003997825 .0015 .0346 -.0181 .0633 1 503 -.001412082 -.000012082035 .0014 -.0298 .0185 .004 1 504 .05671494 .05811494 .0014 -.0064 -.0128 .007 1 505 -.0759548 -.0744548 .0015 .0232 -.0045 .0246 1 506 -.0620366 -.0605366 .0015 .0484 .003 -.0089 1 507 .0043570576 .005857057 .0015 .0296 .0088 .021 1 508 -.04408973 -.04268973 .0014 -.008 .0104 .0413 1 509 .0040811338 .005481134 .0014 -.1093 .0175 -.0599 1 510 -.03258663 -.03118663 .0014 -.0089 .0349 -.0418 1 511 -.02101051 -.019610513 .0014 -.144 .063 -.1045 1 512 .0223661 .0236661 .0013 .05 .1159 -.0514 1 513 -.0024049655 -.0012049653 .0012 .0482 -.0233 .0807 1 514 -.01556255 -.01456255 .001 .0292 -.019 -.0197 1 515 .006281037 .007281038 .001 -.0488 .042 .0062 1 516 .015713431 .016713431 .001 -.0749 -.0387 .0187 1 517 .0019898457 .0029898456 .001 -.0004 -.0403 .0281 1 518 -.05482463 -.05392463 .0009 .1581 .0037 .0302 1 519 -.070089 -.069189 .0009 .1174 -.1349 .069 1 520 .0331762 .0340762 .0009 -.0028 .0431 .0243 1 521 .05519151 .05589151 .0007 .0181 -.0257 .0165 1 522 .06797187 .06877187 .0008 -.0059 -.0422 .0024 1 523 .13305922 .13385922 .0008 .0658 -.0152 .0044 1 524 .01930585 .02010585 .0008 .037 -.0139 -.0034 1 525 .014553398 .015353397 .0008 .0297 -.0329 -.0099 1 526 .008421674 .009221674 .0008 .0857 .0025 .0472 1 527 .023251373 .024051374 .0008 .0628 .0683 .0831 1 528 -.008027779 -.00722778 .0008 .0409 -.0281 -.0087 1 529 -.02164696 -.02084696 .0008 -.0429 .0523 -.0261 1 530 -.04133649 -.04053649 .0008 -.0039 -.0385 -.0182 1 531 -.05962736 -.05882736 .0008 .0242 .0144 -.0416 1 532 -.05353415 -.05263415 .0009 .0259 -.0162 .0697 1 533 -.08172734 -.08062734 .0011 -.0135 .0089 .0024 1 534 .1557237 .1569237 .0012 .0418 -.0728 .0286 1 535 -.003111907 -.001811907 .0013 .0701 -.0118 .023 1 536 -.0547427 -.0533427 .0014 .0632 .0279 .0146 1 537 .14846925 .15006925 .0016 .076 .0086 .087 1 538 .09054164 .09234164 .0018 .0573 .0118 -.0305 1 539 -.0383866 -.036586598 .0018 -.0162 .0063 .0131 1 540 .11345788 .11555788 .0021 .0546 .0304 .0194 1 541 .29228136 .29458135 .0023 -.0158 .0025 -.0132 1 542 .0011352196 .0034352196 .0023 -.0307 .002 -.0117 1 543 -.08277602 -.08037601 .0024 -.0125 .022 -.0158 1 544 .018194526 .020594526 .0024 .0002 .0365 .0166 1 545 .010804472 .013404472 .0026 .0436 -.0032 -.0132 1 546 .02835132 .03115132 .0028 .017 .0001 -.0277 1 547 end format %tm ym
Comment