Skip to content
All library documents

Evaluating an Out-of-Sample Mean–Variance Efficient Frontier

Article Quant Q&A · Author: Jonkie

Summary

The document describes a two-period portfolio comparison using historical returns. It estimates an in-sample efficient frontier from the first period’s empirical covariance matrix, generating portfolios across target returns. It then keeps those portfolio weights fixed and evaluates their expected return and volatility using the second period’s sample mean and covariance matrix. The resulting plotted curves are intended to show how portfolios selected in sample behave out of sample.

The post reports that the out-of-sample curve looks strange, but it gives no plotted values or explanation, and the underlying data file is not included in the text. The method is a basic hold-weights evaluation, not a re-optimization using second-period inputs. Differences between the two curves can arise because realized means and covariances differ from the estimates used to select weights; estimation error and portfolio constraints may also matter. The short historical windows and single example limit any general conclusion about frontier stability or investment performance.

Key ideas

  • The in-sample frontier is constructed using the first period’s return estimates and covariance matrix.
  • Out-of-sample portfolio statistics are calculated with second-period estimates while keeping the original weights fixed.
  • A changed frontier can reflect differences between estimated and later return distributions.
  • The post asks about unusual plotted behavior but supplies no diagnosis or quantitative results.
  • A single historical comparison does not establish that a portfolio construction method will generalize.

Tags

Full text
# Behaviour of out of sample efficient frontier


# Behaviour of out of sample efficient frontier












I am comparing the efficient frontier of a set of portfolios that are in and out of sample. The first period is from 1991-01-03 until 1992-10-03 and the second one from 1992-10-03 until 1994-03-03. I used historical data from yahoo finance.

I used the empirical covariance matrix from the first period and constructed my in sample efficient frontier. And used the same weights but the parameters from the second period to get the out of sample efficient frontier.

You may find my R code here:

```
require(zoo)
require(quantmod)
require(tseries)

load("~/Desktop/SE q/2periods.RData")

cov.mat1 <- cov(logret1)
mu2 <- colMeans(logret2)
cov.mat2 <- cov(logret2)

## efficient frontier of portfolios in sample
pf1s <- list()
t <-  seq(0,.25,length.out = 20)
for ( i in 1:20){
        pf1s<- c(pf1s,list(portfolio.optim(x=logret1,pm=t[i],covmat = cov.mat1)))
}

## get frontiers
pf1<-NULL
for( i in 1:20){
        temp <- pf1s[[i]]
        pf1 <-rbind(pf1,c(temp$pw,temp$pm,temp$ps))
}

pf1.weights <- pf1[,1:ncol(logret1)]
pf1.ret <- pf1[,ncol(logret1)+1]
pf1.risk<- pf1[,ncol(logret1)+2]

## efficient frontier of portfolios out of sample

pf2 <- NULL
for( i in 1:20){
        pf2 <- rbind(pf2,c( pf1.weights[i,]%*%mu2,sqrt(t(pf1.weights[i,])%*%cov.mat2%*%(pf1.weights[i,]))))
}
pf2.ret <- pf2[,1]
pf2.risk<- pf2[,2]

# plot efficient frontiers
plot(pf1.risk,pf1.ret,type="l",col="red")
lines(pf2.risk,pf2.ret,type="l",col="blue")
```

Red is in sample and blue out of sample.

Here is a R.data file with my data set https://www.dropbox.com/s/d1pdwvwh4c5r893/2periods.RData?dl=0

My question is if there is an explanation on the strange behaviour of the out of sample portfolio?

Best, J.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.