This set of files is the methodology for running PACTA on EQ and CB portfolios.

To use this repository of code please follow the following instructions:

System Requirements

| | RECOMMENDED | MINIMUM | | ------------- | ------------- |------------- | | RAM | 16GB or more | 8 GB | | if you use Windows | 64-bit Version |32-bit Version | | R version | 3.6.1 |no earlier than 3.4.3 |

You can download R here:

Software Requirements / R Environment

Github software

For example GitHub Desktop

Integrated Development Environment (IDE):f

RStudio preferably version 1.1.456

R Environment:

Ensure you have the required libraries installed on your computer.

Further, the evaluation will require a bunch of package. It is recommanded install the package during the first run of the code. (assess approx. 30 minutes for the installation process during the first usage of the code).

Necessary packages are: tidyr, dplyr, scales, reshape2, tidyverse, readxl, tidyselect (and dependencies)

For report generation:

MiKTeX - a distribution of the LaTeX typesetting system ; includes TeXworks preferably version 2.9

Further R packages needed: grid, ggplot2, ggthemes, dplyr, reshape2, gridExtra, scales, stringr, extrafont, tidyr, knitr, RColorBrewer, matrixStats, rworldmap, ggmap, cowplot, ggrepel, readxl, tidyverse, ggforce, sitools , countrycode

How to "download" the code

In order to keep track on the latest updates of the codes, we suggest not to download the code just once, but to synchronize a local folder with the PACTA_analysis git repository ( - Create an user account on github - Fork this repo by clicking the Fork button at the top right - Clone the repo to your local machine using a git-software (such as github desktop) - Do frequent updates of the code by your github desktop

Data Requirements

The evaluation requires input data that is provided by Asset Resoluation ( If you are working in a collaboration with the 2DII, the 2DII possibly will allocate the necessary data files as a zip file. Unzip the data and save it a folder, that will later be refered to as data_location


There are four files that must be run in sequence to create results.

1_portfolio_check_initialisation.R 2_project_input_analysis.R 3_run_analysis.R 4_report_maker.R

If you stop the process at a certain point (let's say after 2_project_input_analysis), you can go on later at any time with the subsequent steP (with 3_...) but, you after a break/restart of R, you will need to run 1_portfolio_check_initialisation again.


1. Set Variables

Within 1_portfolio_check_initialisation.R there are some lines that should be edited to make reference to local directories on your computer.

project_name <- "TEST"

twodii_internal <- FALSE

project_location_ext <- "/Desktop/ExternalTest"

data_location_ext <- "/Desktop/ExternalTest/Inputs"

2. Run 1_portfolio_check_intialisation.R

3. Check results

After running 1_portfolio_check_intialisation, go to the project_location_ext folder. Now, you should see that a new folder was generated. The name of the folder equals the project name you defined before running the code. The folder contains several subfolders.

Input Analysis

1. Setting the portfolio input data

Go to the project folder and open the subfolder 20_Raw_Inputs. There is a csv-file that is named according to the project name and has the annex "-Input". Open the csv-file. If you use Excel for editting the csv file, make sure that "," and not ";" is set to be the column seperater. If Excel uses wrong settings, the different columnes are not detected, but as a string of words, seperated by commas is shown. If so, select the first row in Excel (A): - Go to Data > Text to Columns. - Choose Delimited. Click Next. - Choose Comma. Click Next. - Choose General or Text, whichever you prefer. - Leave Destination as is, or choose another column. Click Finish.

As soon as the headings are displayed in seperate coumns, add your own portfolio data to this file and save. It is important that the column headings are not changed. The data needs to have the following format:

| Investor.Name | Portfolio.Name | ISIN | NumberofShares | MarketValue | Currency | | ------------- | ------------- | ------------- | ------------- | ------------- | ------------- | | Berlin_Pension_Fund| Green_Assets | DE2939203293 | ------------- | 8493050 | USD | | Berlin_Pension_Fund | Green_Assets | FR3439285941 |------------- | 324234 | CHF | | Berlin_Pension_Fund | EU_Fund | FR3439285941 |------------- | 2384929 | EUR | | Paris_Fund | EmergingMarkets | FR3439285941 | 172 | 1239322 | GBP |

2. Setting the parameter files

Go to the project folder and open the subfolder 10_Parameter_File. There are two yml-files that can be opened in usual text editors. At this stage only open the AnalysisParameter file. Assert that the mentioned Timestamps match the holdings date of your portfolio input. The Years.Startyear should equal the year after the data time stamp. If you see any inconsistencies please reach out to

By CreateMetaPortfolio: TRUE it is determined that a Meta Portfolio is created. That means, that one portfolio with aggregated results of all investors / portfolios is generated and evaluated. By re-writing it to CreateMetaPortfolio: FALSE and saving the file, the generation of the MetaPortfolio is deactivated.

3. Run 2_project_input_analysis.R

4. Check outputs

Go to the project folder and open the subfolder 30_Processed_Inputs. You should find 11 files, that are generated from your input: One image and five pairs of data files, each one as csv and rda file.

Run Analysis

There are no settings at this point.

1. Run 3_run_analysis.R

2. Check results

Go to the project folder and open the subfolder 40_Results. You should find 4 files and several folders. For each investor you one folder is created. Further, if CreatMetaPortofolio was set True, a folder for MetaInvestor was created.

Report Maker


Sample data files will be made available shortly. Complete data files are available under specific circumstances. Be in contact at if you would like to find out more about this.

2DegreesInvesting/PACTA_analysis documentation built on April 15, 2021, 11:07 p.m.