## Estimate Efficient Frontiers for PortfolioCVaR Object

Whereas Estimate Efficient Portfolios for Entire Frontier for PortfolioCVaR Object focused on estimation of efficient portfolios, this section focuses on the estimation of efficient frontiers. For information on the workflow when using `PortfolioCVaR` objects, see PortfolioCVaR Object Workflow.

### Obtaining CVaR Portfolio Risks and Returns

Given any portfolio and, in particular, efficient portfolios, the functions `estimatePortReturn` and `estimatePortRisk` provide estimates for the return (or return proxy), risk (or the risk proxy). Each function has the same input syntax but with different combinations of outputs. Suppose that you have this following portfolio optimization problem that gave you a collection of portfolios along the efficient frontier in `pwgt`:

```m = [ 0.05; 0.1; 0.12; 0.18 ]; C = [ 0.0064 0.00408 0.00192 0; 0.00408 0.0289 0.0204 0.0119; 0.00192 0.0204 0.0576 0.0336; 0 0.0119 0.0336 0.1225 ]; m = m/12; C = C/12; AssetScenarios = mvnrnd(m, C, 20000); p = PortfolioCVaR; p = setScenarios(p, AssetScenarios); p = setDefaultConstraints(p); p = setProbabilityLevel(p, 0.95); pwgt0 = [ 0.3; 0.3; 0.2; 0.1 ]; p = setInitPort(p, pwgt0); pwgt = estimateFrontier(p); ```

Note

Remember that the risk proxy for CVaR portfolio optimization is CVaR.

Given `pwgt0` and `pwgt`, use the portfolio risk and return estimation functions to obtain risks and returns for your initial portfolio and the portfolios on the efficient frontier:

```prsk0 = estimatePortRisk(p, pwgt0); pret0 = estimatePortReturn(p, pwgt0); prsk = estimatePortRisk(p, pwgt); pret = estimatePortReturn(p, pwgt); ```
You obtain these risks and returns:
```display(prsk0) display(pret0) display(prsk) display(pret)```
```prsk0 = 0.0591 pret0 = 0.0067 prsk = 0.0414 0.0453 0.0553 0.0689 0.0843 0.1006 0.1193 0.1426 0.1689 0.1969 pret = 0.0050 0.0060 0.0070 0.0080 0.0089 0.0099 0.0109 0.0119 0.0129 0.0139```

### Obtaining Portfolio Standard Deviation and VaR

The `PortfolioCVaR` object has functions to compute standard deviations of portfolio returns and the value-at-risk of portfolios with the functions `estimatePortStd` and `estimatePortVaR`. These functions work with any portfolios, not necessarily efficient portfolios. For example, the following example obtains five portfolios (`pwgt`) on the efficient frontier and also has an initial portfolio in `pwgt0`. Various portfolio statistics are computed that include the return, risk, standard deviation, and value-at-risk. The listed estimates are for the initial portfolio in the first row followed by estimates for each of the five efficient portfolios in subsequent rows.

```m = [ 0.0042; 0.0083; 0.01; 0.15 ]; C = [ 0.005333 0.00034 0.00016 0; 0.00034 0.002408 0.0017 0.000992; 0.00016 0.0017 0.0048 0.0028; 0 0.000992 0.0028 0.010208 ]; pwgt0 = [ 0.3; 0.3; 0.2; 0.1 ]; p = PortfolioCVaR('initport', pwgt0); p = simulateNormalScenariosByMoments(p, m, C, 20000); p = setDefaultConstraints(p); p = setProbabilityLevel(p, 0.9); pwgt = estimateFrontier(p, 5); pret = estimatePortReturn(p, [pwgt0, pwgt]); prsk = estimatePortRisk(p, [pwgt0, pwgt]); pstd = estimatePortStd(p, [pwgt0, pwgt]); pvar = estimatePortVaR(p, [pwgt0, pwgt]); [pret, prsk, pstd, pvar]```
```ans = 0.0207 0.0464 0.0381 0.0283 0.1009 0.0214 0.0699 -0.0109 0.1133 0.0217 0.0772 -0.0137 0.1256 0.0226 0.0849 -0.0164 0.1380 0.0240 0.0928 -0.0182 0.1503 0.0262 0.1011 -0.0197```