<< Ïðåä. ñòð. ñòð. 14(îáùåå êîëè÷åñòâî: 18)ÎÃËÀÂËÅÍÈÅ Ñëåä. ñòð. >>
outliers. Different data weighting schemes are used to address this
problem. In a simple approach, the historical data X(t Ã€ k) are multi-
plied by the factor lk where 0 < l < 1. Another interesting idea is
weighting the historical data with their volatility [4]. Namely, the asset
returns R(t) at time t used in forecasting VaR for time T are scaled
with the volatility ratio
R0 (t) Â¼ R(t)s(T)=s(t) (11:2:1)
where s(t) is the historical forecast of the asset volatility.3 As a result,
the actual return at day t is increased if the volatility forecast at day T
is higher than that of day t, and vice versa. The scaled forecasts R0 (t)
are further used in calculating VaR in the same way as the forecasts
R(t) are used in equal-weight historical simulation. Other more so-
phisticated non-parametric techniques are discussed in [2] and refer-
ences therein.
An obvious advantage of the non-parametric approaches is their
relative conceptual and implementation simplicity. The main disad-
vantage of the non-parametric approaches is their absolute depend-
ence on the historical data: Collecting and filtering empirical data
always comes at a price.
The parametric approach is a plausible alternative to historical
simulation. This approach is based on fitting the P/L probability
distribution to some analytic function. The (log)normal, Student
126 Market Risk Measurement

and extreme value distributions are commonly used in modeling P/L
[2, 5]. The parametric approach is easy to implement since the analytic
expressions can often be used. In particular, the assumption of the
normal distribution reduces calculating VaR to (11.1.2). Also, VaR
for time interval T can be easily expressed via VaR for unit time (e.g.,
via daily VaR (DVaR) providing T is the number of days)
pï¬ƒï¬ƒï¬ƒï¬ƒ
VaR(T) Â¼ DVaR T (11:2:2)

VaR for a portfolio of N assets is calculated using the variance of the
multivariate normal distribution

X
N
2
sN Â¼ (11:2:3)
sij
i, jÂ¼1

If the P/L distribution is normal, ETL can also be calculated analyt-
ically

ETL(a) Â¼ sPSN (Za )=(1 Ã€ a) Ã€ m (11:2:4)
The value za in (11.2.4) is determined with (11.1.3). Obviously, the
parametric approach is as good and accurate as the choice of the
analytic probability distribution.
Calculating VaR has become a part of the regulatory environment
in the financial industry [6]. As a result, several methodologies have
been developed for testing the accuracy of VaR models. The most
widely used method is the Kupiec test. This test is based on the
assumption that if the VaR(a) model is accurate, the number of the
tail losses n in a sample N is determined with the binomial distribu-
tion
N!
(1 Ã€ a)n a(NÃ€n)
PB (n; N, 1 Ã€ a) Â¼ (11:2:5)
n!(N Ã€ n)!
The null hypothesis is that n/N equals 1 Ã€ a, which can be tested with
the relevant likelihood ratio statistic. The Kupiec test has clear mean-
ing but may be inaccurate for not very large data samples. Other
approaches for testing the VaR models are described in [2, 6] and
references therein.
127
Market Risk Measurement

The Jorionâ€™s monograph [1] is a popular reference for VaR-based
risk management. The Dowdâ€™s textbook [2] is a good resource for the
modern risk measurement approaches beyond VaR.

11.4 EXERCISES
1. Consider a portfolio with two assets: asset 1 has current value \$1
million and annual volatility 12%; asset 2 has current value \$2
million and annual volatility 24%. Assuming that returns are
normally distributed and there are 250 working days per year,
calculate 5-day VaR of this portfolio with 99% confidence level.
Perform calculations for the asset correlation coefficient equal
to (a) 0.5 and (b) Ã€0.5.
2. Verify (11.2.4).
*3. Implement the algorithm of calculating ETL for given P/L
density function. Analyze the algorithm accuracy as a function
of the number of integration points by comparing the calcula-
tion results with the analytic expression for the normal distribu-
tion (11.2.4).
Chapter 12

Agent-Based Modeling
of Financial Markets

12.1 INTRODUCTION
Agent-based modeling has become a popular methodology in
social sciences, particularly in economics.1 Here we focus on the
agent-based modeling of financial markets [1]. The very idea of
describing markets with models of interacting agents (traders, invest-
ors) does not fit well with the classical financial theory that is based
on the notions of efficient markets and rational investors. However, it
has become obvious that investors are neither perfectly rational nor
2.3). Agent-based modeling proves to be a flexible framework for a
realistic description of the investor adaptation and decision-making
process.
The paradigm of agent-based modeling applied to financial markets
implies that trader actions determine price. This concept is similar to
that of statistical physics within which the thermodynamic (macro-
scopic) properties of the medium are described via molecular inter-
actions. A noted expansion of the microscopic modeling methodology
into social systems is the minority game (see [2] and references therein).
Its development was inspired by the famous El Farolâ€™s bar problem [3].
This problem considers a number of patrons N willing to attend a bar
with a number of seats Ns . It is assumed that Ns < N and every patron
prefers to stay at home if he expects that the number of people

129
130 Agent-Based Modeling of Financial Markets

attending the bar will exceed Ns . There is no communication among
patrons and they make decisions using only information on past
attendance and different predictors (e.g., attendance today is the
same as yesterday, or is some average of past attendance).
The minority game is a simple binary choice problem in which
players have to choose between two sides, and those on the minority
side win. Similarly to the El Farolâ€™s bar problem, in the minority
game there is no communication among players and only a given set
of forecasting strategies defines player decisions. The minority game
is an interesting stylized model that may have some financial implica-
tions [2]. But we shall focus further on the models derived specifically
for describing financial markets.
In the known literature, early work on the agent-based modeling of
financial markets can be traced back to 1980 [4]. In this paper, Beja and
Goldman considered two major trading strategies, value investing and
trend following. In particular, they showed that system equilibrium
may become unstable when the number of trend followers grows.
Since then, many agent-based models of financial markets have
been developed (see, e.g., reviews [1, 5], the recent collection [6] and
references therein). We divide these models into two major groups. In
the first group, agents make decisions based on their own predictions
of future prices and adapt their beliefs using different predictor func-
tions of past returns. The principal feature of this group is that price is
derived from the supply-demand equilibrium [7â€“10].2 Therefore, we
call this group the adaptive equilibrium models. In the other group, the
assumption of the equilibrium price is not employed. Instead, price is
assumed to be a dynamic variable determined via its empirical relation
to the excess demand (see, e.g., [11, 12]). We call this group the non-
equilibrium price models. In the following two sections, we discuss two
instructive examples for both groups of models, respectively. Finally,
Section 12.4 describes a non-equilibrium price model that is derived
exclusively in terms of observable variables [13].

In this group of models [7â€“10], agents can invest either in the risk-
free asset (bond) or in the risky asset (e.g., a stock market index). The
risk-free asset is assumed to have an infinite supply and a constant
131
Agent-Based Modeling of Financial Markets

interest rate. Agents attempt to maximize their wealth by using some
risk aversion criterion. Predictions of future return are adapted using
past returns. The solution to the wealth maximization problem yields
the investor demand for the risky asset. This demand in turn deter-
mines the asset price in equilibrium. Let us formalize these assump-
tions using the notations from [10]. The return on the risky asset at
time t is defined as
rt Â¼ (pt Ã€ ptÃ€1 Ã¾ yt )=ptÃ€1 (12:2:1)
where pt and yt are (ex-dividend) price and dividend of one share of
the risky asset, respectively. Wealth dynamics of agent i is given by
Wi, tÃ¾1 Â¼ R(1 Ã€ pi, t )Wi, t Ã¾ pi, t Wi, t (1 Ã¾ rtÃ¾1 )
Â¼ Wi, t [R Ã¾ pi, t (rtÃ¾1 Ã€ r)] (12:2:2)
where r is the interest rate of the risk-free asset, R Â¼ 1 Ã¾ r, and pi, t is
the proportion of wealth of agent i invested in the risky asset at time t.
Every agent is assumed to be a taker of the risky asset at price that is
established in the demand-supply equilibrium. Let us denote Ei, t and
Vi, t the â€˜â€˜beliefsâ€™â€™ of trader i at time t about the conditional expect-
ation of wealth and the conditional variance of wealth, respectively. It
follows from (12.2.2) that
Ei, t [Wi, tÃ¾1 ] Â¼ Wi, t [R Ã¾ pi, t (Ei, t [rtÃ¾1 ] Ã€ r)], (12:2:3)
Vi, t [Wi, tÃ¾1 ] Â¼ p2 t W2 t Vi, t [rtÃ¾1 ] (12:2:4)
i, i,

Also, every agent i believes that return of the risky asset is normally
distributed with mean Ei, t [rtÃ¾1 ] and variance Vi, t [rtÃ¾1 ]. Agents choose
the proportion pi, t of their wealth to invest in the risky asset, which
maximizes the utility function U
max {Ei, t [U(Wi, tÃ¾1 )]} (12:2:5)
pi, t

The utility function chosen in [9, 10] is
U(Wi, t ) Â¼ log (Wi, t ) (12:2:6)
Then demand pi, t that satisfies (12.2.5) equals
Ei, t [rtÃ¾1 ] Ã€ r
pi, t Â¼ (12:2:7)
Vi, t [rtÃ¾1 ]
132 Agent-Based Modeling of Financial Markets

Another utility function used in the adaptive equilibrium models
employs the so-called constant absolute risk aversion (CARA) function
[7, 8]
a
U(Wi, t ) Â¼ Ei, t [Wi, tÃ¾1 ] Ã€ Vi, t [Wi, tÃ¾1 ] (12:2:8)
2
where a is the risk aversion constant. For the constant conditional
variance Vi, t Â¼ s2 , the CARA function yields the demand
Ei, t [rtÃ¾1 ] Ã€ r
pi, t Â¼ (12:2:9)
as2
The number of shares of the risky asset that corresponds to demand
pi, t equals
Ni, t Â¼ pi, t Wi, t =pt (12:2:10)
Since the total number of shares assumed to be fixed
P 
Ni, t Â¼ N Â¼ const , the market-clearing price equals
i
1X
pt Â¼ pi, t Wi, t (12:2:11)
Ni

the classical asset pricing theory. The new concept in this model is the
heterogeneous beliefs. In its general form [7, 10]
Ei, t [rtÃ¾1 ] Â¼ fi (rtÃ€1 , . . . , rtÃ€Li ), (12:2:12)
Vi, t [rtÃ¾1 ] Â¼ gi (rtÃ€1 , . . . , rtÃ€Li ) (12:2:13)
The deterministic functions fi and gi depend on past returns with lags
up to Li and may vary for different agents.3
While variance is usually assumed to be constant (gi Â¼ s2 ), several
trading strategies fi are discussed in the literature. First, there are
fundamentalists who use analysis of the business fundamentals to
make their forecasts on the risk premium dF
EF, t [rtÃ¾1 ] Â¼ r Ã¾ dF (12:2:14)
In simple models, the risk premium dF > 0 is a constant but it can be a
function of time and/or variance in the general case. Another major
chartists). Momentum traders use history of past returns to make
their forecasts. Namely, their strategy can be described as
133
Agent-Based Modeling of Financial Markets

X
L
EM, t [rtÃ¾1 ] Â¼ r Ã¾ dM Ã¾ ak rtÃ€k (12:2:15)
kÂ¼1

where dM > 0 is the constant component of the momentum risk
premium and ak > 0 are the weights of past returns rtÃ€k . Finally,
contrarians employ the strategy that is formally similar to the momen-
tum strategy
X
L
EC, t [rtÃ¾1 ] Â¼ r Ã¾ dC Ã¾ bk rtÃ€k (12:2:16)
kÂ¼1

with the principal difference that all bk are negative. This implies that
contrarians expect the market to turn around (e.g., from bull market
to bear market).
An important feature of adaptive equilibrium models is that agents
are able to analyze performance of different strategies and choose the
most efficient one. Since these strategies have limited accuracy, such
In the limit of infinite number of agents, Brock and Hommes offer
a discrete analog of the Gibbs probability distribution for the fraction
of traders with the strategy i [7]
X
nit Â¼ exp [b(Fi, tÃ€1 Ã€ Ci )]=Zt , Zt Â¼ exp [b(Fi, tÃ€1 Ã€ Ci )] (12:2:17)
i

In (12.2.17), Ci ! 0 is the cost of the strategy i, the parameter b is
called the intensity of choice, and Fi, t is the fitness function that
characterizes the efficiency of strategy i. The natural choice for the
fitness function is
Fi, t Â¼ gFi, tÃ€1 Ã¾ wi, t , wi, t Â¼ pi, t (Wi, t Ã€ Wi, tÃ€1 )=Wi, tÃ€1 (12:2:18)
where 0 g 1 is the memory parameter that retains part of past
performance in the current strategy.
Adaptive equilibrium models have been studied in several direc-
tions. Some work has focused on analytic analysis of simpler models.
In particular, the system stability and routes to chaos have been
discussed in [7, 10]. In the meantime, extensive computational model-
ing has been performed in [9] and particularly for the so-called Santa
Fe artificial market, in which a significant number of trading strat-
egies were implemented [8].
134 Agent-Based Modeling of Financial Markets

12.3 NON-EQUILIBRIUM PRICE MODELS
The concept of market clearing that is used in determining price of
the risky asset in the adaptive equilibrium models does not accurately
reflect the way real markets work. In fact, the number of shares
involved in trading varies with time, and price is essentially a dynamic
variable. A simple yet reasonable alternative to the price-clearing
paradigm is the equation of price formation that is based on the
empirical relation between price change and excess demand [4].
Different agent decision-making rules may be implemented within
this approach. Here the elaborated model offered by Lux [11] is
described. In this model, two groups of agents, namely chartists and
fundamentalists, are considered. Agents can compare the efficiency of
different trading strategies and switch from one strategy to another.
Therefore, the numbers of chartists, nc (t), and fundamentalists, nf (t),
vary with time while the total number of agents in the market N is
assumed constant. The chartist group in turn is sub-divided into
optimistic (bullish) and pessimistic (bearish) traders with the numbers
nÃ¾ (t) and nÃ€ (t), respectively
nc (t) Ã¾ nf (t) Â¼ N, nÃ¾ (t) Ã¾ nÃ€ (t) Â¼ nc (t) (12:3:1)
Several aspects of trader behavior are considered. First, the chartist
decisions are affected by the peer opinion (so-called mimetic conta-
gion). Secondly, traders change strategy while seeking optimal per-
formance. Finally, traders may exit and enter markets. The bullish
chartist dynamics is formalized in the following way:
dnÃ¾ =dt Â¼ (nÃ€ pÃ¾Ã€ Ã€ nÃ¾ pÃ€Ã¾ )(1 Ã€ nf =N) Ã¾ mimetic contagion
nf nÃ¾ (pÃ¾f Ã€ pfÃ¾ )=N Ã¾ changes of strategy
(b Ã€ a)nÃ¾ market entry and exit (12:3:2)
Here, pab denotes the probability of transition from group b to group
a. Similarly, the bearish chartist dynamics is given by
dnÃ€ =dt Â¼ (nÃ¾ pÃ€Ã¾ Ã€ nÃ€ pÃ¾Ã€ )(1 Ã€ nf =N) Ã¾ mimetic contagion
nf nÃ€ (pÃ€f Ã€ pfÃ€ )=N Ã¾ changes of strategy
(b Ã€ a)nÃ€ market entry and exit (12:3:3)
strategy. Therefore, constant total number of traders yields the
135
Agent-Based Modeling of Financial Markets

relation b Â¼ aN=nc . Equations (12.3.1)â€“(12.3.3) describe the dynam-
ics of three trader groups (nf , nÃ¾ , nÃ€ ) assuming that all transfer
probabilities pab are determined. The change between the chartist
bullish and bearish mood is given by
pÃ¾Ã€ Â¼ 1=pÃ€Ã¾ Â¼ n1 exp(Ã€U1 ),
U1 Â¼ a1 (nÃ¾ Ã€ nÃ€ )=nc Ã¾ (a2 =n1 )dP=dt (12:3:4)
where n1 , a1 and a2 are parameters and P is price. Conversion of
fundamentalists into bullish chartists and back is described with
pÃ¾f Â¼ 1=pfÃ¾ Â¼ n2 exp(Ã€U21 ),
U21 Â¼ a3 ((r Ã¾ nÃ€1 dP=dt)=P Ã€ R Ã€ sj(Pf Ã€ P)=Pj) (12:3:5)
2

where n2 and a3 are parameters, r is the stock dividend, R is the
average revenue of economy, s is a discounting factor 0 < s < 1, and
Pf is the fundamental price of the risky asset assumed to be an input
parameter. Similarly, conversion of fundamentalists into bearish
chartists and back is given by
pÃ€f Â¼ 1=pfÃ€ Â¼ n2 exp(Ã€U22 ),
U22 Â¼ a3 (R Ã€ (r Ã¾ nÃ€1 dP=dt)=P Ã€ sj(Pf Ã€ P)=Pj) (12:3:6)
2

Price P in (12.3.4)â€“(12.3.6) is a variable that still must be defined.
Hence, an additional equation is needed in order to close the system
(12.3.1)â€“(12.3.6). As it was noted previously, an empirical relation
between the price change and the excess demand constitutes the
specific of the non-equilibrium price models4
dP=dt Â¼ bDex (12:3:7)
In the model [11], the excess demand equals
Dex Â¼ tc (nÃ¾ Ã€ nÃ€ ) Ã¾ gnf (Pf Ã€ P) (12:3:8)
The first and second terms in the right-hand side of (12.3.8) are the
excess demands of the chartists and fundamentalists, respectively;
b, tc and g are parameters.
The system (12.3.1)â€“(12.3.8) has rich dynamic properties deter-
mined by its input parameters. The system solutions include stable
equilibrium, periodic patterns, and chaotic attractors. Interestingly,
the distributions of returns derived from the chaotic trajectories
may have fat tails typical for empirical data. Particularly in [14], the
136 Agent-Based Modeling of Financial Markets

model [11] was modified to describe the arrival of news in the market,
which affects the fundamental price. This process was modeled with
the Gaussian random variable e(t) so that
ln Pf (t) Ã€ ln Pf (t Ã€ 1) Â¼ e(t) (12:3:9)
The modeling results exhibited the power-law scaling and temporal
volatility dependence in the price distributions.

12.4 THE OBSERVABLE VARIABLES MODEL

12.4.1 THE FRAMEWORK
The models discussed so far are capable of reproducing important
features of financial market dynamics. Yet, one may notice a degree
of arbitrariness in this field. The number of different agent types and
the rules of their transition and adaptation vary from one model to
another. Also, little is known about optimal choice of the model
parameters [15, 16]. As a result, many interesting properties, such as
deterministic chaos, may be the model artifacts rather than reflections
of the real world.5
A parsimonious approach to choosing variables in the agent-based
modeling of financial markets was offered in [17]. Namely, it was
suggested to derive agent-based models exclusively in terms of observ-
able variables. Note that the notion of observable data in finance
should be discerned from the notion of publicly available data. While
the transaction prices in regulated markets are publicly available, the
 << Ïðåä. ñòð. ñòð. 14(îáùåå êîëè÷åñòâî: 18)ÎÃËÀÂËÅÍÈÅ Ñëåä. ñòð. >>