Upload
phamdung
View
217
Download
0
Embed Size (px)
Citation preview
Using R in Academic Finance
Sanjiv R. Das Professor, Santa Clara University
Department of Finance h?p://algo.scu.edu/~sanjivdas/
Outline • High-‐performance compuGng for Finance • Modeling the opGmal modificaGon of home loans using R
• IdenGfying systemically risky financial insGtuGons using R network models.
• Goal-‐based porOolio opGmizaGon with R
• Using R to deliver funcGons/models on the web, and for pedagogical purposes.
R works well with Python and C.
MODIFYING HOME LOANS WITH R MODELS
Topic 1
THE PRINCIPAL PRINCIPLE: OpGmal ModificaGon of Distressed Home Loans (Why Lenders should Forgive, not Foresake Mortgages)
STRATEGIC LOAN MODIFICATION: An OpGons based response to strategic default (joint work with Ray Meadows)
Game theoreGc problem:
Lender determines the loan modificaGon that maximizes value of loan given that the borrower will act strategically in his best interest.
Modeling the Mortgage
h?p://algo.scu.edu/~sanjivdas/ 17
Loan balance
Default put
Lender’s value on default
Borrower’s liability
Deadweight cost of foreclosure
Refinancing opGon
“Iso-‐Service” Surface
11/21/11 h?p://algo.scu.edu/~sanjivdas/ 18
Loan balance = $300,000 Home value = $250,000
Remaining maturity = 25 years A = $1,933 per month
Amax = $20,000 per year ($1,667 per month)
choose
Cure risk and Re-‐default Risk
h?p://algo.scu.edu/~sanjivdas/ 22
The risk of unnecessary relief, i.e., the borrower would not have ulGmately defaulted.
Providing fuGle relief, leading to ulGmate default anyway.
Value of loan accounGng for willingness to pay
A: borrower income available for housing service, with mean μ and std. dev σ.
h?p://algo.scu.edu/~sanjivdas/ 25
Reduced-‐Form Analysis of SAMs
Home values
Normalize iniGal home value to 1. The opGon to default is ITM when (H > L).
There is a home value D at which the borrower will default. D is a “default level” or default exercise barrier.
D is a funcGon of the lender share θ, we write it as D(L, θ).
D increases in L and in θ.
Foreclosure recovery as a fracGon of H is ϕ.
h?p://algo.scu.edu/~sanjivdas/ 27
Barrier Model IntuiGon
D=L exp[-‐γ(1-‐θ)]
Region of no default and gains to SAM
Region of default
H0 = 1
Default"Payoff=фD"
No default Payoff=L
h?p://algo.scu.edu/~sanjivdas/ 28
A Barrier OpGon DecomposiGon Non-‐default component
Default component
Shared AppreciaGon component
PDE
MANAGING SYSTEMIC RISK BY ANALYZING NETWORKS USING R
THE MIDAS PROJECT @IBM
Topic 2
Paper: “Unleashing the Power of Public Data for Financial Risk Measurement, RegulaGon, and Governance” (with Mauricio A. Hernandez, Howard Ho, Georgia Koutrika, Rajasekar Krishnamurthy, Lucian Popa, Ioana R. Stanoi, Shivakumar Vaithyanathan) IBM Almaden)
Midas Financial Insights
32
Annual Report
Proxy Statement Insider Transaction
Loan Agreement
Extract Integrate
Related Companies
Loan Exposure
Exposure by subsidiary
…
…
Raw Unstructured Data
Data for Analysis
Raw Unstructured Data
Example of Midas Financial Insights
33
Company
Person
Extract Integrate
Over 2200 financial companies
Over 32000 key officials in financial companies
SEC Filings
Over 1 Million documents
2005 2010
Filing Gmeline
Filings of Financial Companies
(Forms 10-‐K,8-‐k, 10-‐Q, DEF 14A, 3/4/5, 13F, SC 13D SC
13 G FDIC Call Reports)
Call Data Records
34
employment, director, officer
insider, 5% owner, 10% owner
holdings,
transactions
Event
Company Person
Security Loan
subsidiaries, insider, 5%, 10% owner, banking
subsidiaries
borrower, lender
Forms 8-K
Forms 10-K, DEF 14A, 8-K, 3/4/5
Forms 10-K, DEF 14A, 8-K, 3/4/5, 13F, SC 13D, SC 13G, FDIC Call Report
Reference SEC table Forms 13F, Forms 3/4/5
Forms 3/4/5, SC 13D, SC 13G, 10-K, FDIC Call Report
Forms 3/4/5, SC 13D, SC 13G
Forms 10-K, 10-Q, 8-K
5% beneficial ownership • owner • issuer • % owned • date
Shareholders • related insGtuGonal managers • Holdings in different securiGes
Subsidiaries • list subsidiaries of a company
Current Events • merger and acquisiGon • bankruptcy • change of officers and directors • material definiGve agreements
Loan Agreements • loan summary details • counterparGes (borrower, lender, other agents)
• commitments
Insider filings • transacGons • holdings • Insider relaGonship
Officers & Directors • menGon • bio range, age, current posiGon, past posiGon
• signed by • commi?ee membership
Midas provides Analy8cal Insights into company rela8onships by exposing informa8on concepts and rela8onships within extracted concepts
35
Systemic Analysis Systemic Analysis
• DefiniGon: the measurement and analysis of relaGonships across enGGes with a view to understanding the impact of these relaGonships on the system as a whole.
• Challenge: requires most or all of the data in the system; therefore, high-‐quality informaGon extracGon and integraGon is criGcal.
Systemic Risk
• Current approaches: use stock return correlaGons (indirect). [Acharya, et al 2010; Adrian and Brunnermeier 2009; Billio, Getmansky, Lo 2010; Kritzman, Li, Page, Rigobon 2010]
• Midas: uses semi-‐structured archival data from SEC and FDIC to construct a co-‐lending network; network analysis is then used to determine which banks pose the greatest risk to the system.
36
Co-‐lending Network
• DefiniGon: a network based on links between banks that lend together.
• Loans used are not overnight loans. We look at longer-‐term lending relaGonships.
• Lending adjacency matrix:
• Undirected graph, i.e., symmetric
• Total lending impact for each bank:
37
Centrality
• Influence relaGons are circular:
• Pre-‐mulGply by scalar to get an eigensystem:
• Principal eigenvector of this system gives the “centrality” score for a bank.
• This score is a measure of the systemic risk of a bank.
38
Data
• Five years: 2005—2009.
• Loans between FIs only. • Filings made with the SEC.
• No overnight loans. • Example: 364-‐day bridge loans, longer-‐term credit arrangement, Libor
notes, etc.
• Remove all edge weights < 2 to remove banks that are minimally acGve. Remove all nodes with no edges. (This is a choice for the regulator.)
43
Network Fragility
• DefiniGon: how quickly will the failure of any one bank trigger failures across the network?
• Metric: expected degree of neighboring nodes averaged across all nodes.
• Neighborhoods are expected to “expand” when • Metric: diameter of the network.
PORTFOLIO OPTIMIZATION USING R
Topic 3
The research papers for this work are on my web page – just google it. h?p://algo.scu.edu/~sanjivdas/research.htm/
1. Das, Markowitz, Scheid, and Statman (JFQA 2010), “PorOolio OpGmizaGon with Mental Accounts”
2. Das & Statman (2008), “Beyond Mean-‐Variance: PorOolio with Structured Products and non-‐Gaussian returns.”
Standard OpGmizaGon Problem
Sanjiv Das 46
Mean Covariance matrix Risk aversion
Portfolio weights
SOLUTION:
See D, Markowitz, Scheid, Statman (JFQA 2010)
Example: ConstrucGon of PorOolios: Available securiGes
Expected returns Standard deviations
Bond 5% 5%
Low-risk stock 10% 20%
High-risk stock 25% 50%
Sanjiv Das 49
The correlation between the two stocks is 0.2. Other correlations are zero.
Sub-‐porOolios and overall porOolio
The expected return of the overall porOolio is the weighted average of the expected returns of the sub-‐porOolios.
The risk of the overall porOolio is not the weighted average of the risk of the sub-‐porOolios.
Sanjiv Das 51
Risk as probability of losses
Sanjiv Das 57
Mean-variance problem: Minimize Risk (variance) subject to minimum level of Expected Return.
Behavioral portfolio theory: Maximize Return subject to a maximum probability of falling below a threshold.
Short-‐Selling Constraints
60
Linear program with non-‐linear constraints. This is not a standard quadraGc programming problem (QP) like the Markowitz model.
MVT uses a standard QP: quadra8c objecGve funcGon with linear constraints.
Modified Problem
San Diego, 12-‐Nov-‐2007 61
Standard QP
Amenable to industrial opGmizers; we use the R system with the quadprog package and minpack.lm library.
Standard QP problem with linear constraints
Non-‐Linear Products
Sanjiv Das 68
U is a set of states over n assets
r(u) is a n-vector of random returns
Compute p[r(u)]
Restatement of the problem
Sanjiv Das 69
This is a quadratic optimization with linear constraints.
Not a quadratic optimization with non-linear constraints.
Introducing Structured Products
Sanjiv Das 70
Can we improve the risk-adjusted returns in a portfolio by using puts and calls?
Derivatives are very risky.
And so ….
Puts are needed when the threshold return is high
Sanjiv Das 72
For high thresholds the investor cannot get an acceptable portfolio without puts.
Should investors use calls?
Sanjiv Das 73
Calls are risky too.
But have attractive and high mean returns!
Conclusion • Investors find it easier to think in terms of mental accounts or sub-‐porOolios
when trying to reach their separate financial goals.
• Behavioral porOolio theory deals with maximizing return subject to managing the risk of loss. This problem has a mathemaGcal mapping into mean-‐variance opGmizaGon, yet is much more general.
• Even with short-‐selling prohibited, the loss from sub-‐porOolio opGmizaGon is smaller than the loss from misesGmaGng investor preferences.
• ReporGng performance by sub-‐porOolio enables investors to track their goals be?er.
• Goal-‐based opGmizaGon enables choosing porOolios even when normality is not assumed.
• Goal-‐based opGmizaGon provides a framework for including structured products in investor porOolios.
Sanjiv Das 79
The research papers for this work are on my web page – just google it. h?p://algo.scu.edu/~sanjivdas/research.htm/
1. Das, Markowitz, Scheid, and Statman (JFQA 2010), “PorOolio OpGmizaGon with Mental Accounts”
2. Das & Statman (2008), “Beyond Mean-‐Variance: PorOolio with Structured Products and non-‐Gaussian returns.”
Use the Rcgi package from David Firth: h?p://www.omegahat.org/CGIwithR/
You need two program files to get everything working. (a) The html file that is the web form for input data. (b) The R file, with special tags for use with the CGIwithR package.