Professional Documents
Culture Documents
Modeling in Finance
Nityanand Misra
Outline
1 Random Numbers
2 Regression Models
4 (G)ARCH Models
5 Modeling Process
6 Questions
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Outline
1 Random Numbers
2 Regression Models
4 (G)ARCH Models
5 Modeling Process
6 Questions
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Expectations
Motivation
Many problems in finance can be reduced to computation of
E[g(X )], where g is a function of the random variable X .
Examples
Pricing a derivative security
Given the distribution f (x) and current price S of a stock,
what is the price of a buy option on the stock at strike K
maturing at time T ?
Hedging and Risk Management
Given a portfolio, what is the 10-day Value-at-Risk (VaR) of
the portfolio?
Given a contract, what is its Maximum Potential Exposure
(MPE)?
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Expectations
Definition
If the probability density function of x is f (x), then
Z
E[g(X )] = g(x)f (x)dx
1
approximates E[g(X )], the error being of the order of O(n− 2 ).
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Inversion of CDF
Given a random deviate u from U(0, 1), one can get a random
deviate x from the CDF F by setting x = F −1 (u), where u is a
random deviate from U(0, 1).
Example
A random deviate from the exponential distribution, whose CDF
is given by F (x) = 1 − e−λx , can be generated from u by taking
log (1 − u)
x =−
λ
Since 1 − u ∼ U(0, 1), one can simply take x = − log u/λ
Problem
Analytical expression for F −1 (u) not always obtainable.
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Transformation Method
The properties of a distribution can be utilized to transform a
random deviate from one distribution to another.
Example
If u, v are random deviates from U(0, 1) then
p
x = −2 log u cos (2πv )
p
y = −2 log u sin (2πv )
Problem
Not clear how to use this.
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Acceptance-Rejection Method
1 Given the PDF f (x), find a PDF g(x) such that f (x) <
Mg(x), ∀x where M > 1
2 Generate x from g(x) and u from U(0, 1)
3 If u < f (x)/Mg(x), accept x as a sample from f (x), else
reject
4 Repeat (2) and (3) if more samples are required
Exercise
Prove that the Unconditional Acceptance Probability (per-
centage of samples accepted from those generated) for the
Acceptance-Rejection Method is 1/M.
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Example (One-dimensional)
Acceptance-Rejection Method
Image from http://www.mathworks.com
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Example (Two-dimensional)
Example (Contd...)
Let’s randomly sample from the uniform distibution over the unit
circle. f (x1 , x2 ) = 1/π if x12 + x22 < 1 and f (x1 , x2 ) = 0 otherwise.
Taking M = 4/π,
1 Generate (x1 , x2 ) from g (random point in the square)
2 If x12 + x22 < 1, u < f (x)/Mg(x) = 1 so accept. Otherwise
u ≮ f (x)/Mg(x) = 0 so reject.
MCMC Algorithms
Construct an aperiodic and irreducible Markov Chain {Xn }
whose stationary distribution is f (x).
Metropolis-Hastings Sampler
Random Walk and Independent Chain sampling
Requires a proposal distribution
Slice Sampler
When an efficient proposal distribution is difficult to find
Gibbs Sampler
Multivariate sampling using conditional distributions
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Quasi-Random Numbers
Pseudorandom Numbers
An uncorrelated sequence from U(0, 1) can have all first n sam-
ples in the interval (0, 0.5), and yet the next sample will have a
probability of 0.5 to lie in (0, 0.5)
Quasi-Random Numbers
Sample the unit hypercube in a highly uniform manner.
Produce a low-discrepancy sequence, with points gener-
ated in a highly correlated manner
Try to produce a sequence with equal number of points in
each sub-cube of uniform partitions of the unit hypercube
Improve convergence propeties of expectations
Examples: Halton, Sobol and Latin Hypercube sequences
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Quasi-Random Numbers
Quasi-Random Numbers
Quasi-Random Numbers
Outline
1 Random Numbers
2 Regression Models
4 (G)ARCH Models
5 Modeling Process
6 Questions
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Regression
Problem
Given a set of one or more independent variables (explanatory
or predictor variables), can we model or predict a dependent
variable (response variable) with some degree of confidence?
Regression Equation
Let X be an n × p matrix of n observations of p independent
variables, Y be an n × 1 vector of observations of dependent
variables, and β be a p × 1 vector of parameters.
Y = g(X, β) +
Linear Regression
Linear Regression
The function g(X, β) is linear in parameters (but not necessarily
linear in X).
where
Linear Regression
Yi ∼ N(Xi β, σ 2 )
Linear Regression
Linear Regression
Piecewise Regression
Independent variables have different effects (values of βi ) over
different ranges.
Curve-fitting problems (p = 1), e.g. fitting the term-structure
of interest rates
Spline Regression
Given many points, {(xj , yj )}, and fewer knot abscissas, {xi },
estimate parameters (usually {yi }) such that the resulting spline
interpolation is the model-fit
Different from Spline Interpolation: Given fixed knot points,
{(xi , yi )}, interpolate y at a given x between knots
Cubic Spline Regression Model uses Natural Cubic Splines
Monotone Spline Regression uses monotonic splines
(Monotonic Cubic Hermite splines, M-splines or I-splines)
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Linear Regression
Non-linear Regression
Problems
Modeling non-normal dependent variables
Modeling binary data or probabilities
Modeling censored data
Examples
1 Arrival of buy/sell orders in the market
2 Counterparty default/mortgage prepayment probability
3 Actuarial science (insurance pricing, loss reserving, acci-
dent frequencies)
4 Execution times of limit orders with cancellations
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Non-linear Regression
Problems
Modeling non-normal dependent variables
Modeling binary data or probabilities
Modeling censored data
(Possible) Solutions
Generalized Linear Models (GLM)
Logistic/Probit Regression
Survival Regression
Generalized Linear Mixed Models (GLMM), Generalized
Additive Models (GAM)
Common Estimation methods: ML, Weighted Least Squares
(WLS), Iteratively Reweighted Least Squares (IRLS)
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Non-linear Regression
Non-linear Regression
f (y , µ) = µy (1 − µ)1−y
= exp {y log µ + (1 − y) log (1 − µ)}
µ
= exp y log + log (1 − µ)
1−µ
eθ
µ
And so θ = log ⇔µ= , and
1−µ 1 + eθ
a(ψ) = 1
b(θ) = − log (1 − µ) = − log (1 + eθ )
c(y, ψ) = 0
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Non-linear Regression
G(z) = ez /(1 + ez )
G(z) = Φ(z)
Survival Regression
Survival Regression
Survival Regression
Dependent data has two fields, value and censoring type
Uncensored, Right Censored (suspended), Interval Cen-
sored (inspected) or Left Censored,
Weibull, Lognormal, Log-logistic distibutions common
Two model types: Accelerated Failure Time and Propor-
tional Hazards
Estimation method: ML, which uses the Survival Function
Outline
1 Random Numbers
2 Regression Models
4 (G)ARCH Models
5 Modeling Process
6 Questions
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Basic Concepts
Lag: Forward or backward shift of a time-series.
Lag-operator: Operates on a time-series, LXt = Xt−1 .
Autocorrelation: Correlation of a time-series with itself at a
specific lag.
Autocorrelation Function (ACF): Autocorrelation of a time-series
as a function of lag.
Partial Autocorrelation at lag k: Correlation between Xt and
Xt−k not accounted for by lags 1, 2, . . . , k.
Partial Autocorrelation Function (PACF): Partial Autocorrelation
of a time-series as a function of lag.
Cross-correlation: Correlation between two time-series at a
specific lag.
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Basic Concepts
Cross-correlation Function (CCF): Cross-correlation of two time-
series as a function of lag.
Stationary Time-Series: A time-series having the same distribu-
tion at different times.
No trend, and no explosion.
Weak-stationarity: First and second moments of a time-series
are same at different times.
Integration: If the d-th difference of a time-series is stationary
the series is said to be integrated of order d, denoted by I(d).
Cointegration: The phenomenon when two time series are non-
stationary but a linear combination of them is stationary.
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Example (Cross-correlation)
Example (Cointegration)
Example of cointegration
Image from http://www.federalreserve.gov/
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Non-stationarity
In Lag-notation
p
!
X
1− ϕi Li xt = ϕ0 + t
i=1
Properties
1 All-pole Infinite Impulse Response (IIR) filter
2 ACF decays, PACF is cut-off at lag p
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
xt = 0.6xt−1 − 0.08xt−2 + t
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
In Lag-notation
q
!
X
xt = µ + 1+ θi Li t
i=1
Properties
1 Finite Impulse Response (FIR) filter
2 PACF decays, ACF is cut-off at lag q
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
xt = t − 0.6t−1 − 0.3t−2
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
ARMA Model
Contains both AR and MA terms. ARMA(p,q) is defined as
p
X q
X
xt = ϕ0 + ϕi xt−i + θi t−i + t
i=1 i=1
In Lag-notation
p q
! !
X X
i i
1− ϕi L x t = ϕ0 + 1+ θi L t
i=1 i=1
Properties
1 ACF and PACF both decay.
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
ARIMA Model
ARIMA(p,d,q) process is a process whose d-th difference is
ARMA(p,q)
p q
! !
X d
X
i i
1− ϕi L (1 − L) xt = ϕ0 + 1 + θi L t
i=1 i=1
ARMAX/ARIMAX Model
ARMAX(p,q,b) process is an ARMA(p,q) process with b exoge-
nous terms
p
X q
X b
X
x t = ϕ0 + ϕi xt−i + θi t−i + ηi dt−i + t
i=1 i=1 i=1
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Example
Vehicle Navigation
State: Vehicle position and velocity
Observed output: Measured position
Control: Acceleration or deceleration
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Kalman Filter
A linear state space system which provides best linear
prediction in terms of MSE
Kalman Filter
Outline
1 Random Numbers
2 Regression Models
4 (G)ARCH Models
5 Modeling Process
6 Questions
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Modeling Volatility
Definition (Volatility)
Volatility is defined as the standard deviation of (periodic) returns
of a security over a specific time period.
More on Volatility
Often used as a proxy for risk associated with the security
Implied Volatility is the volatility implied by market price of an
option, using a theoretical model (e.g. Black-Scholes option
pricing model)
Volatility Clustering is the phenomenon of high and low
volatilities periods occuring in clusters
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Modeling Volatility
Volatility plots
Modeling Volatility
Volatility plots
Modeling Volatility
Modeling Volatility
Two common approaches to model the beahviour of volatility
1 Stochastic Approach
Volatility treated as a stochastic process or a diffusion
Calibration is the estimation of the diffusion parameters
Examples: Heston Model, 3/2 Model and Chen Model
2 Econometric Approach
Autoregressive type models used
Volatility and return processes modeled together
Examples: Various types of (G)ARCH Models
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
ARCH/GARCH Models
ARCH/GARCH Models
ARCH Model
ARCH stands for Autoregressive Conditional Heteroskedasticity.
An ARCH(q) process models the return (rt ) as
√
rt = µt + t = µt + ht ηt
Xq
ht = α0 + αi 2t−i
i=1
ARCH/GARCH Models
GARCH Model
GARCH stands for Generalized Autoregressive Conditional Het-
eroskedasticity. A GARCH(p,q) process looks like
√
rt = µt + t = µt + ht ηt
X q p
X
2
ht = α0 + αi t−i + βi ht−i
i=1 i=1
ARCH/GARCH Models
Inferred innovations (ˆ
t )
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
ARCH/GARCH Models
p
Inferred conditional standard deviations ( ĥt )
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
ARCH/GARCH Models
Outline
1 Random Numbers
2 Regression Models
4 (G)ARCH Models
5 Modeling Process
6 Questions
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Modeling Process
Modeling Process
Modeling Process
Modeling Process
Modeling Process
Modeling Process
Modeling Process
Cross Validation
Model tested against independent data not used for estimation.
1 Holdout Validation
Training set (insample) and validation set (holdout sample)
Simple to use, but results depends on partitioning
2 Repeated Random Subsampling Validation
Data randomly split several times, results summarized
Proportion not fixed, but results vary every time
3 Leave-one-out Cross-Validation (LOOCV)
Validation set has one sample, others form training set
Repeated for all points, results summarized
Influential outliers detected, but computationally expensive
4 K-fold Cross-Validation
Data divided into K subsets, each made validation set
Repeated K times (folds)
K = N is same as LOOCV
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Modeling Process
Outline
1 Random Numbers
2 Regression Models
4 (G)ARCH Models
5 Modeling Process
6 Questions
Random Numbers Regression Models Time Series Models (G)ARCH Models Modeling Process Questions
Questions?
Thank You!