Copulas: Summer Course Project


The main objective is to learn how to apply copulas to estimate the joint distributions. You will also learn related subjects of generating univariate random numbers and correlated random variables and to create scenarios and use them in Monte Carlo simulations of the portfolio value.

Code Example

The example Python code is provided for your convenience: “project-copula-template.html” file.
The example covers main steps of the copula work flow, but the key pieces of code are omitted, see “???” in the code snippets. You will have to figure them out yourself based on the instructions given during the lecture. The code is compiled in the Python Jupyter style notebook.

What to submit

You will have to produce up to one page long write up. The figures and tables should go to Appendix, and are not included into a page count. Accompany your report with a code or any other supporting
materials. You can use either Python or Excel to produce the analysis required. You can use Jupyter or plain Python code. Ensure that all required packages are in import statements.


You have a portfolio of four assets:
• SPY, 120 shares
• VXX, 70 shares
• USO, 60 shares
• GLD, 20 shares
These are ETFs that are often used by retail investors to gain exposure to major market factors/segments: equity prices and volatilities, oil and gold commodities.
You are provided with one year long time series of these tickers’ prices. The sampling is daily, you should use adjusted closing prices. You must fit a Gaussian copula with Student t marginals to the price series, and forecast the distribution of portfolio P&L for the next day after March 11 2020. You must assess the quality of your forecast using the tools that we shall learn during this course.

Step-by-step instructions and grading rubric

Load data and construct the data set, 1 point
Data is provided in four CSV files. It was downloaded from Yahoo Finance. Load the files, join the series by date and use adjusted closing price column. You are modeling log returns: 𝑟𝑡 = ln 𝑝𝑡/𝑝𝑡−1, where 𝑡 is an observation day and 𝑝𝑡 – adjusted closing price. Chart the series to make sure the data was loaded properly, e.g. as follows:
Produce descriptive statistics such as min, max, median and four moments (mean, standard deviation, skewness and kurtosis). When using kurtosis clearly indicate whether it’s excess kurtosis or not.

Python code example is provided

Estimate Student t marginals, 1 point
Fit Student t distribution to each factor. Use location scale variant of it. The distribution has three parameters: degrees of freedom, location and scale. Save the parameters for use in further steps.

Python code example is provided.

Assess goodness-of-fit of marginals, 2 points
You may assess the fit visually by producing a histogram such as follows:
Pay attention to the degrees of freedom. Comment on its value: is it too low? What are implications?

You can also use statistical goodness-of-fit metrics such as 𝜒2 test.
Partial Python code example is provided.
Calibrate Gaussian Copula, 10 points

Follow the work flow as discussed during the class for canonical maximum likelihood approach. Here’s the outline. Gaussian copula calibration boils down to deducing its correlation matrix parameter from the rank correlation matrix of the factors:
• Obtain Spearman correlation matrix of input data
• Deduce the Copula correlation matrix parameter 𝑅̂ by applying transformation 2 sin (𝜋6𝜌) to offdiagonal elements 𝜌 of Spearman correlation matrix

Partial Python code example is provided.

Simulate factor scenarios, 3 points
Follow the work flow as discussed during the class for simulation step. Here’s the outline. Simulation with Gaussian copula boils down to generating correlated Gaussian random variables, then converting
them into marginal distributions by inverse CDF method application:
• Generate correlated standard normal random variables (Xcs in the code example) using
Cholesky decomposition 𝐿 of correlation matrix 𝑅̂
• Convert the standard normal into uniform distribution variables (Usim in the code example) by
applying CDF of standard normal distribution 𝐹(𝑋)
• Convert uniform numbers into marginal Student t distribution variables (Xsim in the code
example) by applying inverse of fitted marginals 𝐹𝑡 −1 (𝑈)
The simulated variables that you produced comprise the scenarios of factors.

Partial Python code example is provided.

Assess goodness-of-fit of Copula, 4 points
The assessment can be visual, e.g. produce the historical scatter plots of VXX vs SPY as well as their uniform versions obtained by applying CDF of marginals and compare them with the simulated scenarios as shown on figure below.
The assessment can be more objective and quantitative by comparing descriptive statistics of historical and simulated scenarios.
Finally, assessment can be statistical using goodness-of-fit tests.

Partial Python code example is provided.

Forecast P&L distribution of a portfolio for next day, 2
Using generated scenarios, produce a forecast of asset prices for the next day and evaluate the portfolio value for each scenario. For instance, if the asset return in the scenario is 𝑟𝑖 then it’s price forecast is
𝑝1 = 𝑝0 × 𝑒 𝑟𝑖.

Knowing the holdings of each asset and initial prices it’s trivial to evaluate the market value of the portfolio in the scenario 𝑉𝑖 and the P&L Δ𝑉𝑖 = 𝑉𝑖 − 𝑉0. Once you ran multiple scenarios you have a set of P&Ls Δ𝑉𝑖 to which you can fit the P&L distribution.

For this project it is sufficient to simply produce 99 percentile loss figure, i.e. the loss amount 𝑉𝑎𝑅𝛼 such that it is 𝛼 = 0.01 or 1% probability to lose more than 𝑉𝑎𝑅𝛼 over one day. However, you may attempt to fit parametric distribution to P&Ls and estimate 𝑉𝑎𝑅𝛼 from it.
Partial Python code example is provided.
Assess convergence of P&L distribution forecast, 2
Assess the quality of your P&L distribution forecast in particular of the 𝑉𝑎𝑅𝛼 value that obtained.
At the very least, you may comment on the convergence of 𝑉𝑎𝑅𝛼 with increased number of simulations.
However, a more sophisticated analysis would also include consideration of the marginal distribution and copula fits.

Research Paper 101
Calculate your paper price
Pages (550 words)
Approximate price: -

Reasons to trust Research Paper 101

On Time Delivery

We pride ourselves in meeting the deadlines of our customers. We take your order, assign a writer but allow some more time for ourselves to edit the paper before delivering to you. You are guaranteed a flawless paper on a timely manner...

24x7 Customer Live Support

Our team at Research Paper 101 is committed to handling your paper according to the specfications and are available 24*7 for communication. Whenever you need a quick help, you can talk to our writers via the system messaging or contact support via live chat and we will deliver your message instantly.

Experienced Subject Experts

Online Experts from Research Paper 101 are qualified both academically and in their experiences. Many are Masters and Phd holders and therefore, are qualified to handle complex assignments that require critical thinking and analyses...

Customer Satisfaction

We offer dissertation papers as per students’ wishes. We also help craft out the best topics and design concept papers. By ordering with us, you are guaranteed of defending and making through those hard faced professors in the defense panel!

100% Plagiarism Free

We at Research Paper 101 take plagiarism as a serious offence. From the start, we train our writers to write all their papers from scratch. We also check if the papers have been cited appropriately. Our website also has a tool designed to check for plagiarism that has been made erroniusly. In essense, the paper you get will be 100% legit...

Affordable Prices

We understand that being a student is very challenging, some students balance between work and studies in order to survive. We therefore offer pocket friendly rates that are very competitive in the market.

Try it now!

Calculate the price of your order

Total price:

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.


Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.


Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.


Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.


Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.