Skip to content
All library documents

Simulating Returns from a Copula Fit to Empirical Ranks

Article Quant Q&A · Author: Romain

Summary

The document describes fitting a Student t copula to the empirical ranks of two stocks’ daily log returns and asks how to turn simulated copula observations back into return samples. It outlines the workflow of computing adjusted-price returns, transforming them to pseudo-observations, fitting the dependence model, checking goodness of fit, and generating uniform samples from the fitted copula.

The author then attempts an inverse transformation using rolling historical return samples and empirical quantiles. That step raises an important issue: a copula models dependence, while marginal distributions must be specified or estimated separately to recover returns. The example does not establish that the proposed quantile procedure is correct, and the plotted comparison alone does not validate the simulated series. The text is a practical modeling question rather than a complete simulation recipe.

Key ideas

  • A copula fitted to pseudo-observations represents dependence among variables on a uniform scale.
  • Simulated copula coordinates need marginal distributions to be transformed into asset returns.
  • Empirical quantiles are one possible way to estimate marginal inverse distributions.
  • The example does not validate its proposed rolling-quantile reconstruction.

Tags

Full text
# Estimation of ranks of log-returns via copula


# Estimation of ranks of log-returns via copula












I have successfully chosen and estimate a copula for the ranks of the log-returns of my actions. My question is, since I have worked with the ranks instead of directly the log-returns (in order to be in $[0,1]$) how can I simulate new data for the log-returns from my copula?

To be more clear, here is the code commented:

```
library(copula)
library(quantmod)
#stocks chosen: Microsoft, General Electric
stocks<-c("MSFT","GE")
start="1996-01-01"
end="2000-12-31"
ALL<-NULL
dailyLogReturns<-NULL
cours<-NULL
for(i in stocks){
  #get quotes from Yahoo
  temp<-getSymbols(i,from=start,to=end,auto.assign=FALSE)
  #store adjusted quotes
  #adjusted quotes are used due to split actions in the past
  cours<-cbind(cours,Ad(temp))
  #calculate daily log return for adjusted quotes
  dailyLogReturns<-cbind(dailyLogReturns,coredata(dailyReturn(Ad(temp),type='log')))
}
colnames(cours)<-stocks
colnames(dailyLogReturns)<-stocks
#ALL is the ranks of the log-returns, in [0,1]
ALL<-pobs(dailyLogReturns)

#Here is the graph of the daily log-returns
plot(dailyLogReturns)
```

```
#Here is the graph of the ranks of the daily log-returns
plot(ALL)
```

```
#Estimate the copula
#here i only show the Student, others have been tried without success.
#degres of freedom have been chosen independently
tc<-tCopula(param=c(0),dim=2,dispstr="un",df=7, df.fixed=TRUE)
ftc <- fitCopula(tc,ALL,method="mpl")

#Goodness of fit for the copula, p-value is about 40%
time.start=Sys.time()
GOF<-gofCopula(tc, ALL, estim.method="mpl", simulation="mult")
Sys.time()-time.start
(GOF$p.value>0.05)

#New data sample from the copula
Copula.data<-rCopula(1000,tCopula(0.417,df=7))
plot.new()
par(oma=c(1,1,1,1),mar=c(1,1,1,1))
plot(Copula.data,main="",xlab="",ylab="",col="red",pch="*");points(ALL,col="blue",pch="*")

#Here is the plot: new data from copula (red) vs initial data (blue)
```

### So, what have I tried?

I used the quantile function based on 1000 observations of daily log-returns to calibrate and 263 observations for back-testing

```
nb.calibration<-1000
nb.backtesting<-nrow(dailyLogReturns)-nb.calibration
a<-matrix(0,nb.backtesting,nb.calibration)
b<-matrix(0,nb.backtesting,nb.calibration)
for(i in 1:nb.backtesting){
  j=1+i;k=nb.calibration+i
  a[i,]=dailyLogReturns[j:k,1]
  b[i,]=dailyLogReturns[j:k,2]
  rmtc<-quantile(a[i,],Copula.data[,1])+quantile(b[i,],Copula.data[,2])
}

plot(rmtc,type='l')
lines(dailyLogReturns[,1],col='red')
lines(dailyLogReturns[,2],col='blue')
#Here is the plot obtained: new data from the copula (black), Microsoft (blue), GE (red)
```

### Finally: Am I doing the right thing, is that correct ?

Sources: - Estimation of Portfolio Value-at-Risk using Copula - Some nonparametric tests for copulas with emphasis on goodness-of-fit tests

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.