R-Based ESG Portfolio Analysis

Job ID: 40216120

Budget: $30 – $250 USD

I have a complete CSV dataset that already contains daily returns, firm characteristics, and simulated ESG scores from six different rating agencies. I need a reproducible R workflow that:

• Imports the CSV, fixes any inconsistent data types, and normalises numeric fields where appropriate (the file is already largely free of missing values, so no imputation step is necessary).
• Calculates excess returns, firm betas, and then standardises each agency’s ESG rating using Z-scores.
• Combines the six standardised ratings into an overall ESG score and derives an ESG-uncertainty measure (e.g. cross-sectional dispersion).
• Forms monthly value-weighted portfolios sorted independently by beta, by the combined ESG score, and by the ESG-uncertainty metric.
• Estimates three sets of asset-pricing models for every portfolio: CAPM, an ESG-augmented single-factor model, and a three-factor model of my specification.
• Uses the model outputs to run long–short strategies, conduct factor regressions, and implement a constrained mean-variance portfolio optimisation.

Please package the solution as:

1. A well-commented R script that runs end-to-end without manual intervention.
2. A brief write-up commentary summarising methodology, key tables, and interpretation of results.

Code must rely solely on publicly available R libraries (tidyverse, data.table, PerformanceAnalytics, etc.) so that I can reproduce everything on my side. Accuracy of calculations, clarity of code structure, and neat presentation of final tables/figures will form the main acceptance criteria.