Learn R Programming

This PCRA R package is a companion to the book Robust Portfolio Construction and Risk Analysis by R. Douglas Martin, Thomas K. Philips, Stoyan Stoyanov, Bernd Scherer and Kirk Li, scheduled for publication by Springer in 2024.

The paper "Robust Statistics for Portfolio Construction and Analysis" by R. Douglas Martin, Stoyan V. Stoyanov, Kirk Li and Mahmoud Shammaa, will be published by The Journal of Portfolio Management in September 2023. The Abstract for the paper is available at Paper Abstract.

The R script file RobustStatisticsForPortfoliosJPM2023.R for reproducing most of the Figures and Tables in the above paper is available in the PCRA package folder PCRA/demo. Download that R script by going to PCRA/demo and double clicking on the file, which then allows you to either click on the "Download raw file" link or the "Copy raw file" link. If you have RStudio installed, the first choice may open the file in RStudio. Otherwise you can paste the file into an empty R script.

If you have any problems with the code, please send emails to both Doug Martin at martinrd3d@gmail.com and Kirk Li at cocokecoli@gmail.com. We will post responses in this README file.

Copy Link

Version

Install

install.packages('PCRA')

Monthly Downloads

533

Version

1.2.1

License

GPL-2

Maintainer

Doug Martin

Last Published

March 13th, 2026

Functions in PCRA (1.2.1)

mathEfrontRisky

Efficient Frontier of Risky Stocks
invensysEPS

Earnings per Share of Invensys
gfunds5

gfunds5
mathEfrontCashRisky

Math Efficient Frontier: Cash and Risky Assets
datFF3W

Fama-French Weekly 3-Factor Model
datFF4W

Fama-French-Carhart Weekly 4-Factor Model
levgLongShort

Long Short Portfolio Leverage
mathEfront

Efficient Frontiers from Returns
retFNB

Stock with Ticker FNB
bootEfronts

Bootstrapped Efficient Frontiers
chart.Efront

Create Efficient Frontier
mathEfrontRiskyMuCov

Efficient Frontier
mathGmv

Global Minimum Variance Portfolio (GMV)
getPCRAData

Download CRSP and SPGMI Data
qqnormDatWindat

qqnormDatWindat
plotLSandRobustSFM

Robust and Least Square Single Factor Model (SFM) Fits
factorsSPGMI

factorsSPGMI
retKBH

Stock with Ticker KBH
retDD

Stock with Ticker DD
retEDS

Stock with Ticker EDS
mathWtsEfrontRisky

Efficient Frontier Portfolio Weights Vectors
mathGmvMuCov

Global Minimum Variance Portfolios From Mu and Cov
mathWtsEfrontRiskyMuCov

Efficient Frontier Portfolio Weights Vectors
mathTport

Tangency Portfolio Weights
stocksCRSPxts

Select CRSP Stocks Returns
retPSC

Stock with Ticker PSC
retMER

Stock with Ticker MER
meanReturns4Types

Four Types of Mean Returns
opt.outputMvoPCRA

Optimal Portfolio Weights and Performance
retOFG

Stock with Ticker OFG
retWTS

Stock with Ticker WTS
turnOver

Portfolio Turnover
selectCRSPandSPGMI

Select and merge data from the stocksCRSP and factorsSPGMI data sets
tsPlotMP

Lattice Multi-Panel Time Series Plots
strategies

Hedge Fund Strategies Returns
stocksCRSP

stocksCRSP
retVHI

Stock with Ticker VHI
winsorMean

Winsorized Mean
returnsCRSPxts

Select CRSP Stocks Returns
winsorize

Winsorize Data
FRBinterestRates

Federal Reserve Board Interest Rates
KRest

Kurtosis Estimator
barplotWts

A Barplot of a Set of Portfolio Weights
SP400Industrials

SP400Industrials
SP425Industrials

SP425Industrials
SPIndustrials

SPIndustrials
SP500from1967to2007

SP500from1967to2007
SP500

SP500
SKest

Skewness estimator
cleanOutliers

Clean Returns Outliers
divHHI

HHI Based Diversification Index
PCRA-package

PCRA: Companion to Portfolio Construction and Risk Analysis
crsp.returns8

crsp.returns8
ellipsesPlotPCRA.covfm

Overlaid Correlations Ellipses Plots