Volume 1
Volume 1
QUANTITATIVE
METHODS
©2024 by CFA Institute. All rights reserved. This copyright covers material written
expressly for this volume by the editor/s as well as the compilation itself. It does
not cover the individual selections herein that first appeared elsewhere. Permission
to reprint these has been obtained by CFA Institute for this edition only. Further
reproductions by any means, electronic or mechanical, including photocopying and
recording, or by any information storage or retrieval systems, must be arranged with
the individual copyright holders noted.
CFA®, Chartered Financial Analyst®, AIMR-PPS®, and GIPS® are just a few of the
trademarks owned by CFA Institute. To view a list of CFA Institute trademarks and the
Guide for Use of CFA Institute Marks, please visit our website at www.cfainstitute.org.
This publication is designed to provide accurate and authoritative information
in regard to the subject matter covered. It is sold with the understanding that the
publisher is not engaged in rendering legal, accounting, or other professional service.
If legal advice or other expert assistance is required, the services of a competent pro-
fessional should be sought.
All trademarks, service marks, registered trademarks, and registered service marks
are the property of their respective owners and are used herein for identification
purposes only.
ISBN 978-1-961409-21-7 (paper)
ISBN 978-1-961409-32-3 (ebook)
August 2024
© CFA Institute. For candidate use only. Not for distribution.
CONTENTS
Quantitative Methods
Learning Module 2 Evaluating Regression Model Fit and Interpreting Model Results 25
Introduction 25
Goodness of Fit 26
Testing Joint Hypotheses for Coefficients 33
Forecasting Using Multiple Regression 43
Practice Problems 45
Solutions 48
Practice Problems 71
Solutions 73
Glossary G-1
© CFA Institute. For candidate use only. Not for distribution.
vii
knowledge, skills, and abilities described by the LOS and the assigned reading. Use
the LOS as a self-check to track your progress and highlight areas of weakness for
later review.
Successful candidates report an average of more than 300 hours preparing for each
exam. Your preparation time will vary based on your prior education and experience,
and you will likely spend more time on some topics than on others.
ERRATA
The curriculum development process is rigorous and involves multiple rounds of
reviews by content experts. Despite our efforts to produce a curriculum that is free of
errors, in some instances, we must make corrections. Curriculum errata are periodically
updated and posted by exam level and test date on the Curriculum Errata webpage
(www.cfainstitute.org/en/programs/submit-errata). If you believe you have found an
error in the curriculum, you can submit your concerns through our curriculum errata
reporting process found at the bottom of the Curriculum Errata webpage.
OTHER FEEDBACK
Please send any comments or suggestions to info@cfainstitute.org, and we will review
your feedback thoughtfully.
© CFA Institute. For candidate use only. Not for distribution.
Quantitative Methods
© CFA Institute. For candidate use only. Not for distribution.
© CFA Institute. For candidate use only. Not for distribution.
LEARNING MODULE
1
Basics of Multiple Regression
and Underlying Assumptions
LEARNING OUTCOMES
Mastery The candidate should be able to:
INTRODUCTION
Multiple linear regression uses two or more independent variables to describe the
1
variation of the dependent variable rather than just one independent variable, as in
simple linear regression. It allows the analyst to estimate using more complex models
with multiple explanatory variables and, if used correctly, may lead to better predic-
tions, better portfolio construction, or better understanding of the drivers of security
returns. If used incorrectly, however, multiple linear regression may yield spurious
relationships, lead to poor predictions, and offer a poor understanding of relationships.
The analyst must first specify the model and make several decisions in this process,
answering the following, among other questions: What is the dependent variable of
interest? What independent variables are important? What form should the model
take? What is the goal of the model—prediction or understanding of the relationship?
The analyst specifies the dependent and independent variables and then employs
software to estimate the model and produce related statistics. The good news is that
the software, such as shown in Exhibit 1, does the estimation, and our primary tasks
are to focus on specifying the model and interpreting the output from this software,
which are the main subjects of this content.
© CFA Institute. For candidate use only. Not for distribution.
4 Learning Module 1 Basics of Multiple Regression and Underlying Assumptions
Software Programs/Functions
Excel Data Analysis > Regression
Python scipy.stats.linregress
statsmodels.lm
sklearn.linear_model.LinearRegression
R lm
SAS PROC REG
PROC GLM
STATA regress
There are many investment problems in which the analyst needs to consider the
impact of multiple factors on the subject of research rather than a single factor. In
the complex world of investments, it is intuitive that explaining or forecasting a
financial variable by a single factor may be insufficient. The complexity of financial
and economic relations calls for models with multiple explanatory variables, subject
to fundamental justification and various statistical tests.
Examples of how multiple regression may be used include the following:
■ A portfolio manager wants to understand how returns are influenced by a
set of underlying factors; the size effect, the value effect, profitability, and
investment aggressiveness. The goal is to estimate a Fama–French five-factor
model that will provide an understanding of the factors that are important
for driving a particular stock’s excess returns.
■ A financial adviser wants to identify whether certain variables, such as
financial leverage, profitability, revenue growth, and changes in market
share, can predict whether a company will face financial distress.
■ An analyst wants to examine the effect of different dimensions of country
risk, such as political stability, economic conditions, and environmental,
social, and governance (ESG) considerations, on equity returns in that
country.
Multiple regression can be used to identify relationships between variables, to
test existing theories, or to forecast. We outline the general process of regression
analysis in Exhibit 2. As you can see, there are many decisions that the analyst must
make in this process.
For example, if the dependent variable is continuous, such as returns, the tradi-
tional regression model is typically the first step. If, however, the dependent variable is
discrete—for example, an indicator variable such as whether a company is a takeover
target or not a takeover target—then, as we shall see, the model may be estimated as
a logistic regression.
In either case, the process of determining the best model follows a similar path.
The model must first be specified, including independent variables that may be con-
tinuous, such as company financial features, or discrete (i.e., dummy variables), indi-
cating membership in a class, such as an industry sector. Next, the regression model
is estimated and analyzed to ensure it satisfies key underlying assumptions and meets
the analyst’s goodness-of-fit criteria. Once the model is tested and its out-of-sample
performance is deemed acceptable, then it can be used for further identifying rela-
tionships between variables, for testing existing theories, or for forecasting.
© CFA Institute. For candidate use only. Not for distribution.
6 Learning Module 1 Basics of Multiple Regression and Underlying Assumptions
Is the
Use logistic
dependent variable NO
regression
continuous?
YES
Estimate the
regression model
Are the
Adjust the assumptions of
NO regression
model
satisfied?
YES
Examine the
goodness of fit
of the model
YES
YES
KNOWLEDGE CHECK
Issue Action
The dependent variable takes on a value of
1 if the company is a merger target and 0
otherwise.
The analyst estimates a model with five inde-
pendent variables, and none of these variables
are significant explanatory variables.
The residuals do not appear to be homoske-
dastic, thus violating a regression assumption.
The regression assumptions are satisfied, the
overall fit is significant, and the model is the
best model of the possible models.
Solution
Issue Action
The dependent variable takes on a value of Use logistic regression.
1 if the company is a merger target and 0
otherwise.
The analyst estimates a model with five inde- Adjust the model and
pendent variables, and none of these variables re-estimate.
are significant explanatory variables.
The residuals do not appear to be homoske- Adjust the model and
dastic, thus violating a regression assumption. re-estimate.
The regression assumptions are satisfied, the Use the model for analysis and
overall fit is significant, and the model is the prediction.
best model of the possible models.
The goal of simple regression is to explain the variation of the dependent variable, Y,
using the variation of an independent variable, X. The goal of multiple regression is
the same, to explain the variation of the dependent variable, Y, but using the variations
in a set of independent variables, X1, X2, . . ., Xk. Recall the variation of Y is
n _2
Variation of Y = ∑
(Yi− Y ) ,
i=1
which we also refer to as the sum of squares total. The simple regression equation is
Yi = b0 + b1Xi + εi, i=1, 2, 3, …, n.
When we introduce additional independent variables to help explain the variation of
the dependent variable, we have the multiple regression equation:
Yi = b0 + b1X1i + b2X2i + b3X3i + … + bkXki + εi, i = 1, 2, 3, …, n. (1)
In this equation, the terms involving the k independent variables are the deterministic
part of the model, whereas the error term, εi, is the stochastic or random part of the
model. The model is estimated over n observations, where n must be larger than k.
It is important to note that a slope coefficient in a multiple regression, known as
a partial regression coefficient or a partial slope coefficient, must be interpreted
with care. A partial regression coefficient, bj, describes the impact of that indepen-
dent variable on the dependent variable, holding all the other independent variables
constant. For example, in the multiple regression equation,
Yi = b0 + b1X1i + b2X2i + b3X3i + εi,
the coefficient b2 measures the change in Y for a one-unit change in X2 assuming X1
and X3 are held constant. The estimated regression equation is
Yi = bˆ0+ bˆ1X1i
+ bˆ2X2i
+ bˆ3X3i
,
with ^ indicating estimated coefficients.
Consider an estimated regression equation in which the monthly excess returns
of a bond index (RET) are regressed against the change in monthly government bond
yields (BY) and the change in the investment-grade credit spreads (CS). The estimated
regression, using 60 monthly observations, is
RET = 0.0023 − 5.0585BY − 2.1901CS.
We learn the following from this regression:
1. The bond index RET yields, on average, 0.0023% per month, or approxi-
mately 0.028% per year, if the changes in the government bond yields and
investment-grade credit spreads are zero.
2. The change in the bond index return for a given one-unit change in the
monthly government bond yield, BY, is –5.0585%, holding CS constant. This
means that the bond index has an empirical duration of 5.0585.
3. If the investment-grade credit spreads, CS, increase by one unit, the bond
index returns change by –2.1901%, holding BY constant.
4. For a month in which the change in the credit spreads is 0.001 and the
change in the government bond yields is 0.005, the expected excess return
on the bond index is
KNOWLEDGE CHECK
Using Python
import pandas as pd
df = pd.read_csv(“ABC_FF.csv”,parse_dates=True,index_col=0)
sns.pairplot(df )
plt.show()
Using R
df <- read.csv(“data.csv”)
pairs(df[c(“ABC_RETRF”,”MKTRF”,”SMB”,”HML”)])
The pairwise scatterplots for all variables are shown in Exhibit 3. For example, the
bottom row shows the relationships for the following three pairs: ABC_RETRF and
MKTRF, ABC_RETRF and SMB, and ABC_RETRF and HML. The simple regression
line and corresponding 95% confidence interval for the variables in each pair are also
shown, along with the histogram of each variable along the diagonal.
0.06
0.04
0.02
SMB
0.00
–0.02
–0.04
0.05
0.00
HML
–0.05
–0.10
–0.15
0.2
ABC_RETRF
0.1
0.0
–0.1
–0.2
–0.10 0.00 0.10 –0.05 0.00 0.05 –0.1 0.00 –0.2 0.0 0.2
MKTRF SMB HML ABC_RETRF
© CFA Institute. For candidate use only. Not for distribution.
12 Learning Module 1 Basics of Multiple Regression and Underlying Assumptions
You can see the following from the lower set of scatterplots between ABC_RET and
the three independent variables:
■ There is a positive relationship between ABC_RETF and the market factor,
MKTRF.
■ There seems to be no apparent relation between ABC_RETRF and the size
factor, SMB. The reason is the scatterplot compares the two variables in iso-
lation and does not show the “partial” correlation picked up by the regres-
sion, which explains why SMB is significant in the regression (see Exhibit 4)
but not in the scatterplot.
■ There is a negative relationship between ABC_RETF and the value factor,
HML.
Looking at the scatterplots between the independent variables, SMB and HML
have little or no correlation, as indicated by the relatively flat line for the SMB–HML
pair. This is a desirable characteristic between explanatory variables.
An additional benefit of the scatterplot matrix is that all data points are displayed,
so it can also be used to identify extreme values and outliers.
We now estimate the model of ABC’s excess returns using software such as
Microsoft Excel, Python, or R; results are shown in Exhibit 4. Focusing on the regres-
sion residuals, we look for clues to potential violations of the assumptions of multiple
linear regression.
Regression Statistics
Multiple R 0.6238
R-Squared 0.3891
Adjusted R-Squared 0.3733
Standard Error 0.0628
Observations 120
ANOVA
Df SS MS F Significance F
Regression 3 0.2914 0.0971 24.6278 0.0000
Residual 116 0.4575 0.0039
Total 119 0.7489
Standard Lower
Coefficient error t-Stat. P-value 95% Upper 95%
Intercept 0.0052 0.0061 0.8435 0.4007 –0.0070 0.0173
MKTRF 1.2889 0.1538 8.3791 0.0000 0.9842 1.5935
SMB –0.5841 0.2664 –2.1922 0.0304 –1.1118 –0.0564
HML –-0.6810 0.2231 –3.0523 0.0028 –1.1229 –0.2391
© CFA Institute. For candidate use only. Not for distribution.
Assumptions Underlying Multiple Linear Regression 13
CODE: REGRESSION
Using Python
import pandas as pd
df = pd.read_csv(“data.csv”)
print(model.summary())
Using R
df <- read.csv(“data.csv”)
print(summary(model))
0.15
0.10
0.05
Residual
0.00
–0.05
–0.10
–0.15
–0.20
–0.25
–0.15 –0.1 –0.05 0 0.05 0.1 0.15 0.2
Predicted value
Potential outliers indicated with square markers
As indicated by the line centered near residual value 0.00, a visual inspection of Exhibit
5 does not reveal any directional relationship between the residuals and the predicted
values from the regression model. This outcome is good, because we want residuals to
behave in an independent manner compared to what the model predicts, and suggests
the regression’s errors have a constant variance and are uncorrelated with each other,
thereby satisfying several of the underlying assumptions of multiple linear regression.
© CFA Institute. For candidate use only. Not for distribution.
14 Learning Module 1 Basics of Multiple Regression and Underlying Assumptions
Notably, we detect three residuals (square markers) that may be outliers, Months 7, 25,
and 95. This information can be used to check for shocks from factors not considered
in the model that may have occurred at these points in time.
Exhibit 6 presents plots of the regression residuals versus each of the three factors
in Panels A, B, and C. A visual inspection does not indicate any directional relationship
between the residuals and the explanatory variables, suggesting there is no violation
of a multiple linear regression assumption. Importantly, the three potential outliers
detected in the residual versus predicted value plot are also apparent in Exhibit 6, as
indicated by the square markers.
© CFA Institute. For candidate use only. Not for distribution.
Assumptions Underlying Multiple Linear Regression 15
0.00
–0.05
–0.10
–0.15
–0.20
–0.25
–0.15 –0.1 –0.05 0.00 0.05 0.1 0.15 0.2
MKTRF
0.15
0.10
0.05
Residual
0.00
–0.05
–0.10
–0.15
–0.20
–0.25
–0.06 –0.04 –0.02 0.00 0.02 0.04 0.06 0.08
SMB
0.15
0.10
0.05
Residual
0.00
–0.05
–0.10
–0.15
–0.20
–0.25
–0.20 –0.15 –0.10 –0.05 0.00 0.05 0.10
HML
Using Python
import pandas as pd
© CFA Institute. For candidate use only. Not for distribution.
16 Learning Module 1 Basics of Multiple Regression and Underlying Assumptions
import statsmodels.api as sm
import numpy as np
df = pd.read_csv(“data.csv”,parse_dates=True,index_col=0)
fig = sm.graphics.plot_partregress_grid(model)
fig.tight_layout(pad=1.0)
plt.show()
fig = sm.graphics.plot_ccpr_grid(model)
fig.tight_layout(pad=1.0)
plt.show()
Using R
library(ggplot2)
library(gridExtra)
df <- read.csv(“data.csv”)
grid.arrange(g1,g2,g3,nrow=3)
Finally, in Exhibit 7 we present a normal Q-Q plot. A normal Q-Q plot, or simply a
Q-Q plot, is used to visualize the distribution of a variable by comparing it to a normal
distribution. In the case of regression, we can use a Q-Q plot to compare the model’s
standardized residuals to a theoretical standard normal distribution. If the residuals
are normally distributed, they should align along the diagonal. Recall that 5% of obser-
vations that are normally distributed should fall below –1.65 standard deviations, so
the 5th percentile residual observation should appear at –1.65 standard deviations.
© CFA Institute. For candidate use only. Not for distribution.
Assumptions Underlying Multiple Linear Regression 17
0.15
0.10
0.05
Empirical distribution
0.00
–0.05
–0.10
–0.15
–0.20
–0.25
–3 –2 –1 0 1 2 3
Theoretical distribution
Superimposed on the plot is a linear relation
However, after –2 standard deviations, observations 25 and 95 fall well below the
theoretical standard normal distribution range, while Observation 7, lying above the
diagonal line around +2.5 standard deviations, is somewhat above the theoretical
range. This evidence again suggests these three residual observations are potential
outliers. However, setting them aside, the normal Q-Q plot does provide ample evi-
dence that the regression residuals overall are distributed consistently with the normal
distribution. Thus, we can conclude that the regression model error term is close to
being normally distributed.
KNOWLEDGE CHECK
2. Describe the purpose of a plot of the regression residuals versus the predict-
ed value of CRYPTO.
Solution
This plot is useful for examining whether there is any clustering or pattern
that may suggest the residuals are not homoskedastic and whether there are
any potential outliers.
40
CRYPTO returns (%)
20
–20
–40
–60
–10 –5 0 5 10
TECH returns (%)
Solution
Based on the plot, there appears to be a positive relationship between
CRYPTO and TECH, which may be significant. Several potential outliers are
also apparent.
© CFA Institute. For candidate use only. Not for distribution.
Assumptions Underlying Multiple Linear Regression 19
8. Interpret this normal Q-Q plot from our regression of CRYPTO price
changes:
50
40
30
20
10
0
–10
–20
–30
–40
–4 –3 –2 –1 0 1 2 3 4
Solution
Based on the plot, the residuals are not normally distributed, as indicated
by the deviation of residuals from the diagonal evident past ±2 standard
deviations, and several potential outliers are also apparent. This normal Q-Q
plot suggests the distribution of residuals is “fat-tailed.” Note that fat-tailed
distributions of residuals are a commonly observed feature of financial data
time series.
© CFA Institute. For candidate use only. Not for distribution.
20 Learning Module 1 Basics of Multiple Regression and Underlying Assumptions
PRACTICE PROBLEMS
RET vs VIX
30
20
Portfolio excess returns
10
–10
–20
–30
–40
–60 –40 –20 0 20 40 60 80 100 120 140 160
% Change in volatility factor
RET vs MRKT
30
20
Portfolio excess returns
10
0
–10
–20
–30
–40
–15 –10 –5 0 5 10 15 20
Market excess returns
MRKT vs HML
10
5
MRKT excess returns
–5
–10
–15
–20
–15 –10 –5 0 5 10 15 20
HML values
Residuals vs Predicted
15.00
10.00
5.00
RET residuals
0.00
–5.00
–10.00
–15.00
–40.00 –30.00 –20.00 –10.00 0.00 10.00 20.00 30.00
RET predicted values
© CFA Institute. For candidate use only. Not for distribution.
22 Learning Module 1 Basics of Multiple Regression and Underlying Assumptions
2. Determine which one of the following statements about the coefficient of the
volatility factor (VIX) is true.
A. A 1.0% increase in XVIX would result in a –0.962% decrease in YRET.
C. A 1.0% increase in XVIX, holding all the other independent variables con-
stant, would result in a 0.037% increase in YRET.
3. Identify the regression assumption that may be violated based on Chart 1, RET
vs. VIX.
A. Independence of errors
4. Identify which chart, among Charts 2, 3, and 4, is most likely to be used to assess
homoskedasticity.
A. Chart 2
B. Chart 3
C. Chart 4
5. Identify which chart, among Charts 2, 3, and 4, is most likely to be used to assess
independence of independent variables.
A. Chart 2
B. Chart 3
C. Chart 4
© CFA Institute. For candidate use only. Not for distribution.
Solutions 23
SOLUTIONS
1. C is correct. You should use a multiple linear regression model since the depen-
dent variable is continuous (not discrete) and there is more than one explana-
tory variable. If the dependent variable were discrete, then the model should be
estimated as a logistic regression.
2. C is correct. The coefficient of the volatility factor (XVIX) is 0.037. It should be in-
terpreted to mean that holding all the other independent variables constant, a 1%
increase (decrease) would result in a 0.037% increase (decrease) in the monthly
portfolio excess return (YRET).
20
Portfolio excess returns
10
–10
–20
–30
–40
–60 –40 –20 0 20 40 60 80 100 120 140 160
% Change in volatility factor
LEARNING MODULE
2
Evaluating Regression Model Fit
and Interpreting Model Results
LEARNING OUTCOMES
Mastery The candidate should be able to:
INTRODUCTION
1
LEARNING MODULE OVERVIEW
2 GOODNESS OF FIT
Note that if k ≥ 1, then R2 is strictly greater than adjusted R2. Further, the adjusted R2
may be negative, whereas the R2 has a minimum of_ zero.
The following are two key observations about R 2 when adding a new variable to
a regression:
_
■ If the coefficient’s t-statistic > |1.0|, then R 2 increases.
_
■ If the coefficient’s t-statistic < |1.0|, then R 2 decreases.
Note that a t-statistic with an absolute value of 1.0 does not indicate the indepen-
dent variable is different from zero at typical levels of significance, 5% and 1%. So,
adjusted R2 does not set a very high bar for the statistic to increase.
Consider the regression output provided in Exhibit 1, which shows the results
from the regression of portfolio returns on the returns for five hypothetical funda-
mental factors, which we shall call Factors 1 through 5. The goal of this regression is
to identify the factors that best explain the returns on the portfolio.
Multiple R 0.7845
R-Squared 0.6155
Adjusted R-Squared 0.5718
Standard Error 0.0113
Log-Likelihood -74.054
Observations 50
ANOVA Table
Degrees of Sum of Mean Significance of
Source freedom squares squares F-statistic F-statistic
Regression 5 90.6234 18.1247 14.0853 < 0.0000
Residual 44 56.6182 1.2868
Total 49 147.2416
© CFA Institute. For candidate use only. Not for distribution.
28 Learning Module 2 Evaluating Regression Model Fit and Interpreting Model Results
95% confidence
interval
Using Python
Let df be the data frame containing the data.
import statsmodels.api as sm
formula='Portfolio ~ Factor1+Factor2+Factor3+Factor4+Factor5'
results=ols(formula,df ).fit()
print(results.summary())
Using R
Let df be the data frame containing the data.
df$Factor1+df$Factor2+df$Factor3+df$Factor4+df$Factor5)
anova(model11)
summary(model11)
We see in Exhibit 1 that R2 is 0.6155, or 61.55%, and can we visualize this rela-
tionship using the graph in Exhibit 2.
© CFA Institute. For candidate use only. Not for distribution.
Goodness of Fit 29
0 R2 = 0.6155
–1
–2
–3
–4
–5
–6
–7
–8 –6 –4 –2 0 2
Actual portfolio return (%)
We can use the analysis of variance (ANOVA) table in Exhibit 1 to describe the model
fit. We know from simple regression that the R2 is the ratio of the sum of squares
regression to the sum of squares total. We confirm this as
SSR 90.6234
R2 = _
SST = _
147.2416 = 0.6155
The effect of successively adding each factor to the model is shown in Exhibit 3. The
regression of the portfolio returns starts with the returns of Factor 1, then in the next
model adds Factor 2, and so on, until all five are included in the full model. Note that
with each added variable, the R2 either stays the same or increases. However, while
the adjusted R2 increases when Factors 3 and 4 are added, it declines when Factors 2
and 5 are added to those models, respectively. This illustrates the relationship between
the |t-statistic| of the added variable and adjusted R2.
© CFA Institute. For candidate use only. Not for distribution.
30 Learning Module 2 Evaluating Regression Model Fit and Interpreting Model Results
0.6155
0.6146
0.6400
0.5803
0.6200
0.5718
0.5618
0.6000
0.5409
0.5409
0.5800
0.5332
0.5313
0.5214
0.5600
0.5400
0.5200
0.5000
0.4800
0.4600
Factor 1 Factors Factors Factors Factors
only 1–2 1–3 1–4 1–5
Model
R2 Adjusted R2
KNOWLEDGE CHECK
You are a junior portfolio manager (PM) reviewing your firm’s research
on diversified manufacturers. You are considering Model 1, a cross-sec-
tional regression of return on assets (ROA) for a sample of 26 diversified man-
ufacturing companies on capital expenditures scaled by beginning year PPE
(CAPEX):
Model 1: ROAi = b0 + bCAPEX
CAPEXi+ εi.
Multiple R 0.9380
R-Squared 0.8799
Adjusted R-Squared 0.8749
Standard Error 1.5274
Log-Likelihood −46.842
Observations 26
© CFA Institute. For candidate use only. Not for distribution.
Goodness of Fit 31
95% confidence
interval
Multiple R 0.9384
R-Squared 0.8805
Adjusted R-Squared 0.8701
Standard Error 1.55666
Log-Likelihood −46.795
Observations 26
95% confidence
interval
1. Interpret and contrast R2 and adjusted R2 for Models 1 and 2 using the
regression output provided.
Solution
The R2 for Model 1 (CAPEX only) indicates that 87.99% of the variation of
ROA is explained by CAPEX. For Model 2 (CAPEX and ADV), the R2 in-
creases to 88.05%. However, the adjusted R2 for Model 2 declines to 0.8701
(87.01%) from 0.8749 for Model 1. The lower adjusted R2 is consistent with
the |t-statistic| for ADV’s coefficient < 1.0 (i.e., −0.3320) and the coefficient
not being different from zero at typical significance levels (P-value = 0.7429).
To conclude, adding the ADV variable does not improve the overall statisti-
cal performance and explanatory power of the model.
As both the R2 and adjusted R2 may increase when we add independent variables,
we risk model overfitting. Fortunately, there are several statistics to help compare
model quality and identify the most parsimonious model, including two statistics
more commonly known by their acronyms, AIC and BIC.
© CFA Institute. For candidate use only. Not for distribution.
32 Learning Module 2 Evaluating Regression Model Fit and Interpreting Model Results
AIC = n ln( )
Sum of squares error
_______________
n + 2(k + 1). (3)
As the formula indicates, the AIC statistic depends on the sample size (n), the number
of independent variables in the model (k), and the sum of squares error (SSE) of the
model. One goal in multiple regression is to derive the best fitting model without
adding extraneous independent variables. AIC is a measure of model parsimony, so
a lower AIC indicates a better-fitting model. The term 2(k + 1) is the penalty assessed
for adding independent variables to the model.
In a similar manner, Schwarz’s Bayesian information criterion (BIC or SBC) allows
comparison of models with the same dependent variable, as follows:
BIC = n ln(_______________ )
Sum of squares error
n + ln(n)(k + 1). (4)
Compared to AIC, BIC assesses a greater penalty for having more parameters in
a model, so it will tend to prefer small, more parsimonious models. This is because
ln(n) is greater than 2, even for very small sample sizes. Because we also use BIC to
choose the best model among a set of models (i.e., the one with the lowest BIC), when
do we prefer one measure over the other?
Practically speaking, AIC is preferred if the model is used for prediction purposes,
but BIC is preferred when the best goodness of fit is desired. Importantly, the value
of these measures considered alone is meaningless; the relative values of AIC or BIC
among a set of models is what really matters.
For the regression of portfolio returns on five factors, we present several
goodness-of-fit measures in Exhibit 4 generated for five models out of the 31 possible
combinations (5Cr, r = 1−5) of models using these five variables.
The following are important observations that can be made from Exhibit 4:
■ The R2 increases or remains the same as we add variables to the model.
■ The adjusted R2 increases with the addition of some variables (Factors 3 and
4) but decreases with the addition of other variables (Factors 2 and 5).
■ The AIC is minimized with the model using Factors 1, 2, 3, and 4.
■ The BIC is minimized with the model using Factor 1 only.
If we are developing a model for prediction purposes, then we would likely select
the four-factor model that AIC indicates, whereas if we are seeking the most parsi-
monious, best-fitting model, we would choose the one-factor model. We now have a
framework for selecting the best model from a given set of models.
© CFA Institute. For candidate use only. Not for distribution.
Testing Joint Hypotheses for Coefficients 33
KNOWLEDGE CHECK
1. The research report you are reviewing presents goodness-of-fit statistics for
the two models explaining the variation in return on assets (ROA) for the
sample of diversified manufacturers, as follows:
In multiple regression, the interpretation of the intercept and slope coefficients is sim-
ilar to that in simple regression, but with a subtle difference. In simple regression, the
intercept is the expected value of the dependent variable if the independent variable
is zero. In multiple regression, the intercept is the expected value of the dependent
variable if all independent variables are zero.
Regarding interpretation of slope coefficients, as noted earlier, in multiple regres-
sion, the slope coefficient for a given independent variable is the expected change in
the dependent variable for a one-unit change in that independent variable with all
other independent variables remaining constant.
© CFA Institute. For candidate use only. Not for distribution.
34 Learning Module 2 Evaluating Regression Model Fit and Interpreting Model Results
This joint hypothesis test indicates Factors 4 and 5 do not provide sufficient explan-
atory power (i.e., SSE declines by just 7.8994 = 64.5176 – 56.6182) to compensate
for the loss of two degrees of freedom by their inclusion in the unrestricted model.
Thus, we conclude the restricted, more parsimonious model fits the data better than
the unrestricted model.
Python
Let df be the data frame containing the data.
formula='Portfolio ~ Factor1+Factor2+Factor3+Factor4+Factor5'
results=ols(formula,df ).fit()
hypotheses='(Factor4=Factor5=0)'
f_test = results.f_test(hypotheses)
print(f_test)
R
Let df be the data frame containing the data.
anova(model5,model3)
We can extend the F-distributed joint test of hypotheses for coefficients to test
the significance of the whole regression equation, which is often referred to as a
goodness-of-fit test. For the multiple linear regression,
Yi = b0 + b1X1i + b2X2i + b3X3i + … + bkXki + εi,
where k is the number of independent variables, we can use the general linear
F-test to test the null hypothesis that slope coefficients on all variables are equal to zero:
H0: b1 = b2 = b3 = … = bk = 0
© CFA Institute. For candidate use only. Not for distribution.
Testing Joint Hypotheses for Coefficients 37
against the alternative that at least one slope coefficient is different from zero:
Ha: At least one bj ≠ 0.
This F-statistic is calculated in the same way as in simple regression—the ratio of the
mean square regression (MSR) to the mean square error (MSE)—but the degrees of
freedom are now k in the numerator and n – k – 1 in the denominator:
MSR
F = _
MSE .
Using the ANOVA table in Exhibit 1 for the five-factor model of portfolio returns,
18.1247
F = _
1.2868 = 14.0853.
We present partial ANOVA results in Exhibit 6, Panel A, and show in Panel B the
steps for the hypothesis test for model goodness of fit using the F-statistic at the 5%
significance level.
Exhibit 6: Test of Hypothesis for Goodness of Fit Using F-Statistic for Model of
Portfolio Returns Regressed against Five Factors
Panel A Partial ANOVA Results (repeated from Exhibit 1)
Analysis of Variance
Degrees of
Source freedom Sum of squares Mean squares
Regression 5 90.6234 18.1247
Residual 44 56.6182 1.2868
Total 49 147.2416
Step 6 Make a decision. Reject the null hypothesis because the calculated
F-statistic exceeds the critical F-value. There is
sufficient evidence to indicate that at least one
slope coefficient is different from zero.
Exhibit 7 summarizes the statistics we have introduced for judging the goodness
of fit of multiple regression models. Importantly, finding the “best” model is not a
straight-line process but is, rather, iterative, because it depends on reviewing the
regression results and adjusting the model accordingly.
© CFA Institute. For candidate use only. Not for distribution.
38 Learning Module 2 Evaluating Regression Model Fit and Interpreting Model Results
Exhibit 8 shows model fit statistics visually for all 31 possible models from our example
of regressing portfolio returns on the five factors. Here the models are ranked by BIC,
from lowest (best model) to highest (worst model). Note that AIC and BIC may differ
because BIC imposes a greater penalty on more complex models.
60 0.6
0.5
50
R2 or adjusted R2
0.4
40
AIC, BIC
0.3
30
0.2
20
0.1
10 0
0 -0.1
14
134
1
124
145
13
1345
1234
15
12
1245
135
123
125
1235
12345
2345
2
3
23
25
35
24
5
4
34
235
234
245
45
345
Note: Each model is designated by its factors. For example, “1 2 4” is the model incorporating
Factors 1, 2, and 4 only.
The best model of all 31 models is the model with just Factors 1 and 4. This model has
the lowest BIC and AIC and the highest adjusted R2. Note the model with the highest
R2 has all five factors and ranks relatively poorly on all the other metrics. This visual
demonstrates the consistency between AIC and BIC when comparing models and
how these statistics differ from the R2 and adjusted R2 in selecting the best model.
© CFA Institute. For candidate use only. Not for distribution.
Testing Joint Hypotheses for Coefficients 39
KNOWLEDGE CHECK
Significance
Df SS MS F F
Regression 1 410.3606 410.3606 175.8896 0.0000
Residual 24 55.9934 2.3331
Total 25 466.3540
Log-likelihood –46.842
Significance
Df SS MS F F
Regression 2 410.6278 205.3139 84.7396 0.0000
Residual 23 55.7263 2.4229
Total 25 466.3540
Log-likelihood –46.795
© CFA Institute. For candidate use only. Not for distribution.
40 Learning Module 2 Evaluating Regression Model Fit and Interpreting Model Results
Degrees
of Sum of Mean Significance
Source freedom squares squares F-statistic of F-statistic
Regression 3 410.9591 136.9864 54.4039 0.0000
Residual 22 55.3949 2.5180
Total 25 466.3540
Log-likelihood –46.716
95% confidence
interval
Before the next investment meeting, the PM asks you to do the following:
Adjusted R2 = 1 − [ _
22 (1 − 0.8812)] = 0.8650.
25
freedom.
Step 3 Specify the level of α = 1% (two-tail).
significance.
Step 4 State the decision rule. Critical t-values = ± 2.8188. Reject the null
hypothesis if the calculated t-statistic is
greater than 2.8188 or less than –2.8188.
Step 5 Calculate the test 1.2302 − 0
_
CAPEX: t = 0.1056 = 11.649.
statistic.
− 0.0371 − 0
_
ADV: t = 0.1062 = 0.3493.
0.1029 − 0
_
R&D: t = 0.2837 = 0.3627.
Note calculated t-statistics may differ from
output due to rounding.
Step 6 Make a decision. Reject the null hypothesis for CAPEX
because the calculated t-statistic exceeds the
critical t-value. There is sufficient evidence
to indicate the slope coefficient for CAPEX
is different from zero.
Fail to reject the null hypothesis for both
the ADV and R&D variables because the
calculated t-statistics are within the bounds
of the critical values. There is not sufficient
evidence to indicate that the slope coeffi-
cients of ADV or R&D are different from
zero.
Step 1 State the H0: bADV = bR&D = 0 vs. Ha: At least one bj ≠ 0.
hypotheses.
Step 2 Identify the appro- (Sum of squares error restricted model − Sum of squares error unrestricted model)/ q
________________________________________________________________
F =
priate test statistic. Sum of squares error unrestricted model / ( n − k − 1) , with 2 and 22
degrees of freedom
Step 3 Specify the level of α = 1% (one-tail, right side).
significance.
Step 4 State the decision Critical F-value = 5.7190. Reject the null hypothesis if the calculated F-statistic exceeds 5.7190.
rule.
Step 5 Calculate the test 55.9934
( − 55.3949)/ 2
_________________
F = = 0.1188
statistic. 55.3949 / 22 .
Step 6 Make a decision. Fail to reject the null hypothesis because the calculated F-statistic does not exceed the critical
F-value. There is not sufficient evidence to indicate that at least one of the two slope coeffi-
cients is different from zero. This evidence suggests that Model 1, using only CAPEX, is the
better model compared to Model 3.
Recommend the best model from the set and justify your choice.
Solution
The simple regression model with CAPEX alone is the best model among
those presented. This model has the highest adjusted R2 and the lowest AIC
and BIC. These model-fit statistics confirm that the model with CAPEX
alone, which is the most parsimonious, is the best-fitting model.
© CFA Institute. For candidate use only. Not for distribution.
Forecasting Using Multiple Regression 43
The process for predicting the value of the dependent variable using an estimated
multiple regression model is similar to that in simple regression, but with more items
to sum, as shown in the following formula:
Yˆf = bˆ0+ bˆ1X + bˆ2X2f
1f + ... + bˆkXkf
= bˆ0+ ∑ kj=1bˆjXjf . (6)
As the formula indicates, to determine the predicted (forecasted) value of the depen-
ˆf), the analyst must sum, for each independent variable, the estimated
dent variable (Y
slope coefficient multiplied by the assumed value for that variable (bˆjXf) and then
add the estimated intercept coefficient (bˆ0)times the assumed value for the intercept
of 1.
We can use the regression results from Exhibit 1 of portfolio returns on the five
factors to predict the portfolio return using the following model:
Yi = b0 + b1Factor1i + b2Factor2i + b3Factor3i + b4Factor4i + b5Factor5i + εi,
which now uses assumed values of the factors. This model becomes
Ŷf = −2.1876 + 1.5992 Factor1 + 0.1923 Factor2 − 0.7126 Factor3 + 3.3376
Factor4 − 2.6832 Factor5,
and the assumed values of the five factors are as follows:
Factor 1 2 3 4 5
Assumed Value 0.110 0.040 0.080 –0.010 0.001
Exhibit 9 shows the calculation of the predicted value of the portfolio return, –2.0971%.
KNOWLEDGE CHECK
ˆ
ROAf = 4.7022 + 1.2302(5)− 0.0371(4)+ 0.1029(3) = 11.0135.
© CFA Institute. For candidate use only. Not for distribution.
Practice Problems 45
PRACTICE PROBLEMS
ANOVA
Df SS MS F Significance F
Regression 3 5058.430 1686.143 142.628 0.000
Residual 92 1087.618 11.822
Total 95 6146.048
© CFA Institute. For candidate use only. Not for distribution.
46 Learning Module 2 Evaluating Regression Model Fit and Interpreting Model Results
ANOVA
Df SS MS F Significance F
Regression 4 5236.635 1309.159 131.000 0.000
Residual 91 909.413 9.994
Total 95 6146.048
ANOVA
Df SS MS F Significance F
Regression 5 5237.402 1047.480 103.751 0.000
Residual 90 908.647 10.096
Total 95 6146.048
Your supervisor asks for your assessment of the model that provides the best fit
as well as the model that is best for predicting values of the monthly portfolio
return. So, you calculate Akaike’s information criterion (AIC) and Schwarz’s
Bayesian information criterion (BIC) for all three models, as shown in Exhibit 4.
© CFA Institute. For candidate use only. Not for distribution.
Practice Problems 47
AIC BIC
Model 1 241.03 251.29
Model 2 225.85 238.67
Model 3 227.77 243.16
1. Determine which one of the following reasons for the change in adjusted R2 from
Model 2 to Model 3 is most likely to be correct.
A. Adjusted R2 decreases since adding MOM does not improve the overall
explanatory power of Model 3.
B. Model 2
C. Model 3
B. Model 2
C. Model 3
4. Calculate the predicted RET for Model 3 given the assumed factor values: MRKT
= 3, HML = –2, VIX = –5, SMB = 1, MOM = 3.
A. 3.732
B. 3.992
C. 4.555
5. Calculate the joint F-statistic and determine whether SMB and MOM together
contribute to explaining RET in Model 3 at a 1% significance level (use a critical
value of 4.849).
A. 2.216, so SMB and MOM together do not contribute to explaining RET
SOLUTIONS
1. A is correct. Adjusted R2 in Model 3 decreases to 0.844 from 0.846 in Model 2.
Model 3 includes all independent variables from Model 2, while adding MOM.
Adding variables to a regression model always either increases R2 or causes it to
stay the same. But adjusted R2 only increases if the new variable meets a thresh-
old of significance, |t-statistic| > 1. MOM does not meet this threshold, indicat-
ing it does not improve the overall explanatory power of Model 3.
2. B is correct. BIC is the preferred measure for determining which model provides
the best fit, and a lower BIC is better. Since Model 2 has the lowest BIC value, it
provides the best fit among the three models.
3. B is correct. AIC is the preferred measure for determining the model that is best
used for prediction purposes. As with BIC, a lower AIC is better. Model 2 also
has the lowest AIC value among the three models; thus, it should be used for
prediction purposes.
LEARNING MODULE
3
Model Misspecification
LEARNING OUTCOMES
Mastery The candidate should be able to:
INTRODUCTION
1
LEARNING MODULE OVERVIEW
Model specification refers to the set of variables included in the regression and the
regression equation’s functional form. Here we provide broad guidelines for correctly
specifying a regression and then describe common types of model misspecification.
The principles for good regression model specification are presented concisely
in Exhibit 1.
© CFA Institute. For candidate use only. Not for distribution.
Misspecified Functional Form 51
Principle Explanation
Model should be grounded in Provide economic reasoning behind choice of variables.
economic reasoning.
Model should be parsimonious. Each variable included in regression should play an
essential role.
Model should perform well out Model may explain only the specific dataset on which it
of sample. was trained, meaning it is overfit.
Model functional form should If a nonlinear relationship between regressors is
be appropriate. expected, model should incorporate the appropriate
nonlinear terms.
Model should satisfy regression If heteroskedasticity, serial correlation, or multicol-
assumptions. linearity are detected, revise regression variables and/or
functional form.
We now cover model specification errors. Understanding them will lead to better
model development and more informed use of investment research.
Failures in Regres-
sion Functional Form Explanation Consequence
Omitted variables One or more important variables are May lead to heteroske-
omitted from the regression. dasticity or serial
correlation
Inappropriate form of Ignoring a nonlinear relationship May lead to
variables between the dependent and indepen- heteroskedasticity
dent variable
Inappropriate variable One or more regression variables may May lead to het-
scaling need to be transformed before estimat- eroskedasticity or
ing the regression. multicollinearity
Inappropriate data Regression model pools data from May lead to heteroske-
pooling different samples that should not be dasticity or serial
pooled. correlation
Omitted Variables
First, consider omitted variable bias, the bias resulting from the omission of an
important independent variable from a regression. If the true regression model is
Yi = b0 + b1X1i + b2X2i + εi
but we estimate the model as
© CFA Institute. For candidate use only. Not for distribution.
52 Learning Module 3 Model Misspecification
Yi = b0 + b1X1i + εi,
the latter model is misspecified because X2 is omitted.
If the omitted variable is uncorrelated with X1, the residual will be b2X2i + εi.
Therefore, the residual in the misspecified regression will not have an expected value of
zero nor will it be independent and identically distributed, depending on the behavior
of X2. This means that the estimate of the intercept will be biased, although in this
instance, the coefficient for X1 will still be estimated correctly.
If instead the omitted variable (X2) is correlated with the remaining variable (X1),
the error term in the model will be correlated with X1 and the estimated values of
the regression coefficients in the latter model will be biased and inconsistent. The
estimated coefficient on X1, the intercept, and the residuals will be incorrect. The
estimates of the coefficients’ standard errors will also be inconsistent, so these cannot
be used for conducting statistical tests.
KNOWLEDGE CHECK
returns to gold (GOLD) and changes in the CBOE VIX Index (VIX), estimate
a model with GOLD as the dependent variable and VIX as the independent
variable, and create the following two scatterplots.
Returns on gold vs. changes in the VIX
8
4
Gold return (%)
–2
–4
–6
–40 –20 0 20 40 60 80 100 120 140
VIX change (%)
2
Residual
–2
–4
–6
–6 –4 –2 0 2 4 6 8
Gold return (%)
Next, you are assigned to study a factor model for explaining the excess returns
to precious metals Portfolio A (PORTA), estimated as
PORTAi = b 0 + b1 X1i + b2 X2i + εi,
with the following results:
Standard
Coefficient Error t-Stat. P-Value
Intercept 0.013 0.005 2.671 0.009
X1, Factor 1 1.896 0.208 9.111 0.000
X2, Factor 2 0.170 0.186 0.916 0.361
Also, adjusted R2 is 43%, and the general F-test indicates rejection of the null
hypothesis that the coefficients on X1 and X2 are equal to zero.
You are asked if it is appropriate to include excess stock market return
(MKTRF) as an additional explanatory variable, so you examine the residuals
from the estimated model and their relationship with MKTRF using the fol-
lowing scatterplot:
Residuals from factor model versus MKTRF
0.20
0.15 y = 1.0225x – 0.0118
0.10 R² = 0.6474
0.05
Residual
0.00
–0.05
–0.10
–0.15
–0.20
–0.15 –0.10 –0.05 0.00 0.05 0.10 0.15 0.20
Excess return on the market
Dependent variable
Independent variable
Independent variable
Step 1
Step 2
Run the initial regression:
Yt = b0 + b1X1t + b2X2t + ut Run a new model with the Step 3
fitted residuals squared
from Step 1 as the Test hypotheses on
dependent variable coefficients of the
against the regressors regressors in Step 2
in Step 1: using a chi-squared
uˆ t2 = a0+ a1X1t+ a2X2t+ ɛt distributed test statistic
H0: All aj = 0 versus
Ha: At least one aj ≠ 0
and here R2 is from Step 2. The null hypothesis is that there is no conditional het-
eroskedasticity; the regression’s squared residuals are uncorrelated with the indepen-
dent variables. The alternative is that there is correlation with at least one independent
variable. This is a one-tail, right-side test.
The BP test is illustrated in Exhibit 5. Here, an analyst uses 10 years of monthly
data to assess exposures of Stock XYZ’s excess returns (STOCK_RETRF) using the
Fama–French three-factor model; the regressors are excess market return (MKTRF),
the size factor (SMB), and the value factor (HML). The regression output is in Panel A.
The regression yields significant estimated MKTRF (1.2414) and SMB (1.0953)
exposures. To validate the results, the analyst can conduct a residual analysis by plotting
regression residuals against each of the three factors to look for clues to violations of
© CFA Institute. For candidate use only. Not for distribution.
58 Learning Module 3 Model Misspecification
ANOVA
df SS MS F Significance F
Regression 3 0.5074 0.1691 280.4951 0.0000
Residual 116 0.0699 0.0006
Total 119 0.5773
Using Python
from statsmodels.formula.api import ols
import statsmodels.api as sm
print(model.summary())
print(test)
Using R
library(lmtest)
print(summary(model))
bptest(model)
KNOWLEDGE CHECK
Model A Model B
120 2.0
100 1.5
80
60 1.0
40
Residuals
Residuals
0.5
20 0.0
0
–20 –0.5
–40 –1.0
–60
–80 –1.5
–100 –2.0
0 20 40 60 80 100 120 0 20 40 60 80 100 120
X X
Model C
200.0
150.0
100.0
Residuals
50.0
0.0
–50.0
–100.0
–150.0
0 20 40 60 80 100 120
X
In a follow-up meeting with the research director, she asks you to do the
following:
1. Interpret the scatterplot for each regression model, and determine if it sug-
gests heteroskedasticity is a potential problem.
Solution
The Model A scatterplot shows the spread of residuals narrowing dramati-
cally as the value of X1 increases, suggesting heteroskedasticity is an issue.
The Model B scatterplot shows no discernible pattern, just noise, for resid-
uals versus X2 and thus suggests no heteroskedasticity issue. The Model C
scatterplot shows the spread of residuals widening dramatically in a non-lin-
ear pattern as the value of X3 increases, suggesting the presence of both
heteroskedasticity and non-linearities.
2. Identify the correct conclusion in the following table for BP tests of the
three models using a 5% level of significance.
Solution
If the BP test statistic’s P-value is less than 0.05, then conclude the residuals
are heteroskedastic.
Conclusion: Homoskedastic or
BP test statistic P-value heteroskedastic residuals
A 7.183 0.0072 Heteroskedastic residuals
B 0.035 0.8523 Homoskedastic residuals
C 29.586 0.0001 Heteroskedastic residuals
© CFA Institute. For candidate use only. Not for distribution.
Violations of Regression Assumptions: Serial Correlation 61
A common and serious problem in multiple linear regression is violation of the assump-
tion that regression errors are uncorrelated across observations. When regression
errors are correlated across observations, they are serially correlated. Serial correla-
tion (or autocorrelation) typically arises in time-series regressions. If we have panel
data, which is cross-sectional time-series data, serial correlation may also arise. We
discuss three aspects of serial correlation: its effect on statistical inference, tests for
it, and methods to correct for it.
Positive serial correlation is present when a positive residual for one observation
increases the chance of a positive residual in a subsequent observation, resulting in a
stable pattern of residuals over time. Positive serial correlation also means a negative
residual for one observation increases the chance of a negative residual for another
observation. Conversely, negative serial correlation has the opposite effect, so a
positive residual for one observation increases the chance of a negative residual for
another observation, and so on. We examine positive serial correlation because it
© CFA Institute. For candidate use only. Not for distribution.
62 Learning Module 3 Model Misspecification
is the most common type and assume first-order serial correlation, or correlation
between adjacent observations. In a time series, this means the sign of the residual
tends to persist from one period to the next.
Positive serial correlation does not affect the consistency of regression coefficients,
but it does affect statistical tests. First, the F-statistic may be inflated because the
MSE will tend to underestimate the population error variance. Second, positive serial
correlation typically causes standard errors to be underestimated, so t-statistics are
inflated, which (as with heteroskedasticity) leads to more Type I errors.
Importantly, if a time series exhibits serial correlation, this means that there is
some degree of predictability to it. In the case of asset prices, if these prices were to
exhibit a pattern, investors would likely discern this pattern and exploit it to capture
alpha, thereby eliminating such a pattern. This idea follows directly from the efficient
market hypothesis. Consequently, assuming market efficiency (even weak form), we
should not observe serial correlation in financial market data.
Step 1
The null hypothesis of the BG test is that there is no serial correlation in the model’s
residuals up to lag p. As noted in Exhibit 8, to keep things simple for illustrative
purposes, the order p in Step 2 is 1, so there is one lagged residual, ut–1, as an inde-
pendent variable. The alternative hypothesis is that the correlation of residuals for at
least one of the lags is different from zero and serial correlation exists up to that order.
The test statistic is approximately F-distributed with n – p – k – 1 and p degrees of
freedom, where p is the number of lags. This F-statistic is provided in most statistical
software, so to evaluate the hypotheses, the resulting P-value can be compared with
the desired level of significance.
© CFA Institute. For candidate use only. Not for distribution.
Violations of Regression Assumptions: Serial Correlation 63
Suppose you want to assess the sensitivity of quarterly changes in GDP to changes
in personal consumption expenditures (CONS). You use 30 years of quarterly data
and estimate a model with the results shown in Exhibit 9, Panel A.
The coefficient of CONS is different from zero at the 1% significance level, as indi-
cated by the t-statistic and the corresponding P-value. But because this is a time-series
model, the analyst must also assess the presence of serial correlation in the regression
residuals, especially given the significant F-statistic for the BG test in Panel B.
Standard
Coefficients Error t Stat P-value Lower 95% Upper 95%
Intercept 0.0991 0.050 1.974 0.051 0.000 0.198
CONS 0.8696 0.027 31.990 0.000 0.816 0.923
Using Python
import statsmodels.api as sm
df = pd.read_csv(“data.csv”)
print(model.summary())
r = model.resid
results = sm.stats.diagnostic.acorr_breusch_godfrey(model,nlags=10)
© CFA Institute. For candidate use only. Not for distribution.
64 Learning Module 3 Model Misspecification
print(results)
Using R
library(lmtest)
df <- read.csv(“data.csv”)
summary(model)
bgtest(model,order=10,type=c(“Chisq”,”F”))
r <- model$res
Regression Statistics
Multiple R 0.946
R Squared 0.896
Adjusted R Squared 0.895
F-statistic 591.0
Prob. of F-statistic 0.000
Observations 121
Standard
Coefficients Error t Stat P-value Lower 95% Upper 95%
Intercept 0.0991 0.058 1.701 0.091 −0.016 0.214
CONS 0.8696 0.036 24.310 0.000 0.799 0.940
© CFA Institute. For candidate use only. Not for distribution.
Violations of Regression Assumptions: Serial Correlation 65
KNOWLEDGE CHECK
The senior analyst provides you, the junior analyst, with the following
table for various multiple regression models he has estimated and then
asks you to do the following:
1. Determine the critical F-value and correct conclusion for BG tests using a
5% significance level.
Solution
Conclusions for each model based on the comparison of the BG statistic and
the correct critical F-value are as follows:
Consequences of Multicollinearity
Multicollinearity does not affect the consistency of regression coefficient estimates, but
it makes these estimates imprecise and unreliable. Moreover, it becomes impossible
to distinguish the individual impacts of the independent variables on the dependent
variable. These consequences are reflected in inflated standard errors and dimin-
ished t-statistics, so t-tests of coefficients have little power (ability to reject the null
hypothesis).
Detecting Multicollinearity
Except in the case of exactly two independent variables, using the magnitude of pairwise
correlations among the independent variables to assess multicollinearity is generally
inadequate. With more than two independent variables, high pairwise correlations
are not a necessary condition for multicollinearity. For example, despite low pairwise
correlations, there may be approximate linear combinations among several indepen-
dent variables (which are unobservable) and that themselves are highly correlated.
The classic symptom of multicollinearity is a high R2 and significant F-statistic but
t-statistics for the individual estimated slope coefficients that are not significant due
to inflated standard errors. While the coefficient estimates may be very imprecise,
the independent variables as a group may do a good job of explaining the dependent
variable.
Fortunately, we can use the variance inflation factor (VIF) to quantify multicol-
linearity issues. In a multiple regression, a VIF exists for each independent variable.
Suppose we have k independent variables X1, . . ., Xk. By regressing one independent
variable (Xj) on the remaining k – 1 independent variables, we obtain Rj2 for the
regression—the variation in Xj explained by the other k – 1 independent variables—
from which the VIF for Xj is
1 2 .
VI Fj = _ (2)
1 − Rj
For a given independent variable, Xj, the minimum VIFj is 1, which occurs when Rj2
is 0, so when there is no correlation between Xj and the remaining independent vari-
ables. VIF increases as the correlation increases; the higher the VIF, the more likely
© CFA Institute. For candidate use only. Not for distribution.
Violations of Regression Assumptions: Multicollinearity 67
a given independent variable can be accurately predicted from the remaining inde-
pendent variables, making it increasingly redundant. The following are useful rules
of thumb:
■ VIFj > 5 warrants further investigation of the given independent variable.
■ VIFj >10 indicates serious multicollinearity requiring correction.
Regression Statistics
Multiple R 0.884
R-Squared 0.782
Adjusted R-Squared 0.774
Standard Error 0.027
Observations 60
ANOVA
Significance
df SS MS F F
Regression 2 0.1486 0.0743 102.2425 0.0000
Residual 57 0.0414 0.0007
Total 59 0.1900
Suppose the analyst runs another regression, adding returns to the S&P 500
Index (SPX) to the model with SGX and SVX. Importantly, the S&P 500 Index
includes the component stocks of these two style indexes (large-cap growth and
value), so the analyst is inadvertently introducing severe multicollinearity and
is over-specifying the model.
The results of the new regression are shown in Panel A of Exhibit 12. While
the adjusted R2 is little changed, now standard errors of the coefficients are
higher: 6.166 for SGX and 5.503 for SVX versus 0.196 for both regressors in the
prior model. Adding SPX returns does not explain any more of the variance in
FSPTX fund returns, but now the coefficients for SGX and SVX are no longer
statistically significant. This situation represents classic multicollinearity. We can
visualize this in Panel B, with the correlation matrix representing the pairwise
correlations between the variables.
Regression Statistics
Multiple R 0.884
R-Squared 0.782
Adjusted R-Squared 0.770
Standard Error 0.027
Observations 60
ANOVA
Significance
df SS MS F F
Regression 3 0.1486 0.0495 66.9683 0.0000
Residual 56 0.0414 0.0007
Total 59 0.1900
To understand the size of the multicollinearity problem, the analyst may compute
VIFs for each independent variable in both regressions, as shown in Exhibit 13. Clearly,
all three variables in the regression with SPX have large VIFs, indicating the error
variances of their estimated coefficients are highly inflated and these variables are
highly correlated. In contrast, VIFs for the coefficients of the two independent vari-
ables in the regression without SPX are both less than 5, suggesting multicollinearity
is likely not a concern.
KNOWLEDGE CHECK
Standard
Coefficient Error t-Stat. P-Value
Intercept 4.7022 1.2349 3.8078 0.0010
CAPEX 1.2302 0.1056 11.6490 0.0000
ADV –0.0371 0.1062 –0.3490 0.7304
R&D 0.1029 0.2837 0.3628 0.7203
Variable VIF
CAPEX 1.164
ADV 1.068
RD 1.095
PRACTICE PROBLEMS
Regression Statistics
Multiple R 0.25517
R-Squared 0.06511
Adjusted R-Squared 0.01317
Standard Error 18.22568
Observations 96
Now the chief investment officer (CIO) joins the meeting and asks you to analyze
two regression models (A and B) for the portfolio he manages. He gives you the
test results for each of the models, shown in Exhibit 2.
Independent Variable Is
Test Critical Lagged Value of Depen-
Test Type Statistic Value dent Variable
Model A Breusch–Godfrey 12.124 3.927 Yes
Model B Durbin–Watson 5.088 4.387 No
The CIO also asks you to test a factor model for multicollinearity among its four
explanatory variables. You calculate the variance inflation factor (VIF) for each of
© CFA Institute. For candidate use only. Not for distribution.
72 Learning Module 3 Model Misspecification
Variable R2 VIF
X1 0.748 3.968
X2 0.451 1.820
X3 0.942 17.257
X4 0.926 13.434
1. Calculate the BP test statistic using the data in Exhibit 1 and determine whether
there is evidence of heteroskedasticity.
A. 1.264, so there is no evidence of heteroskedasticity
2. Identify the type of error and its impacts on regression Model A indicated by the
data in Exhibit 2.
A. Serial correlation, invalid coefficient estimates, and deflated standard errors.
3. Determine using Exhibit 3 which one of the following statements is most likely to
be correct. Multicollinearity issues exist for variables:
A. X1 and X2.
B. X2 and X3.
C. X3 and X4.
SOLUTIONS
1. B is correct. The BP test statistic is calculated as nR2, where n is the number of
observations and R2 is from the regression for the BP test. So, the BP test statistic
= 96 × 0.06511 = 6.251. This is less than the critical value of 11.07, so we cannot
reject the null hypothesis of no heteroskedasticity. Thus, there is no evidence of
heteroskedasticity.
2. A is correct. The Breusch–Godfrey (BG) test is for serial correlation, and for
Model A, the BG test statistic exceeds the critical value. In the presence of serial
correlation, if the independent variable is a lagged value of the dependent vari-
able, then regression coefficient estimates are invalid and coefficients’ standard
errors are deflated, so t-statistics are inflated.
LEARNING MODULE
4
Extensions of Multiple Regression
LEARNING OUTCOMES
Mastery The candidate should be able to:
INTRODUCTION
1
LEARNING MODULE OVERVIEW
2 INFLUENCE ANALYSIS
Besides violations of regression assumptions, there is the issue that a small number
of observations in a sample could potentially influence and bias regression results.
An influential observation is an observation whose inclusion may significantly alter
regression results. We discuss how to detect them and how to determine whether
they do influence regression results.
Exhibit 2 shows an outlier data point (triangle) in a sample of observations. Its Y value
does not follow the trend of the other observations; rather, it has an unusual, possibly
extreme, Y value relative to its predicted value, Ŷ, resulting in a large residual, (Y –
Ŷ). This observation should be investigated to determine whether it is an influential
outlier. Also, note the two estimated regression lines: The dashed line includes the
outlier in the regression sample; the solid line deletes it from the sample.
Outliers and high-leverage points are unusual but not necessarily a problem. For
instance, a high-leverage point may deviate substantially from the other observa-
tions (in terms of values of the independent variable), but it may still lay close to the
(solid) regression line. Problems arise if the high-leverage point or the outlier point
are distant from the regression line. In these cases, the effect of the extreme value
is to “tilt” the estimated regression line toward it, affecting slope coefficients and
goodness-of-fit statistics.
A high-leverage point can be identified using a measure called leverage (hii). For a
particular independent variable, leverage measures the distance between the value of the
ith observation of that independent variable and the mean value of that variable across
all n observations. Leverage is a value between 0 and 1, and the higher the leverage,
the more distant the observation’s value is from the variable’s mean and, hence, the
more influence the ith observation can potentially exert on the estimated regression.
The sum of the individual leverages for all observations equals k + 1, where k is
the number of independent variables and 1 is added for the intercept. A useful rule
of thumb for the leverage measure is that if an observation’s leverage exceeds 3( _ n )
k + 1 ,
KNOWLEDGE CHECK
0.8
0.7
0.6
Leverage measure
0.5
0.4
0.3
0.2
0.1
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Observation
4
3
2
Studentized residual
1
0
–1
–2
–3
–4
–5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Observation
3(_
k +n 1 ) = 3 × _
2 15
+ 1 = _9 = 0.60, for flagging possible influential data
15
points.
3. Discuss how the regression results change after removing the potentially
influential observation from the dataset.
Solution:
After removing Observation 7, the revised regression results show a larger
intercept (9.81) and reduced significance for PROD, now with a P-value
of 5%. However, while this observation may be considered influential, the
full sample conclusion—PROD’s coefficient is different from zero at the 5%
significance level—still holds.
*
ei ei
ti* = _
se* = ____________
_____________ (1)
MSE(i)( 1 − hii )
√
Also, note the equivalent formula (on the right) for ti*, whose terms are all based
on the initial estimated regression with n observations, where
MSE(i) = the mean squared error of the regression model that deletes the ith
observation
If … Then …
|ti*| > 3 Flag observation as being an outlier
|ti*| > critical value of t-statistic with n − k Flag outlier observation as being potentially
− 2 degrees of freedom at selected signifi- influential
cance level
Consider the junior analyst testing the OPM regression model with two regressors
(PROD and ONLINE) based on the sample of 15 nutritional supplement retailers. The
analyst wants to detect outliers and, if any, determine whether they are influential.
A visual of the studentized residuals for the regression model is provided in Exhibit
5. Note that the absolute value of the studentized residuals for Observations 2 and
3 exceeds the critical t-value of 2.2010 for 11, (n − k − 2) = 15 − 2 − 2, degrees of
freedom, indicating they may be influential. Consequently, these observations should
be flagged for further examination.
1
0
–1
–2
–3
–4
–5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Observation
Influence of …
To summarize, leverage is key for detecting high-leverage data points and studen-
tized residuals are key for revealing potentially influential outliers. Leverage and
studentized residuals, with the influence plot for visualizing them, and the revised
regression results should all be evaluated when the analyst’s objective is detection of
influential data points.
Besides detecting influential data points, we must investigate why they occur and
determine a remedy. In some cases, an influential data point is simply due to data input
errors or inaccurate measurements. The remedy is to either correct the erroneous data
or discard them and then to re-estimate the regression using the cleansed sample.
Alternatively, the dataset can also be winsorized to mitigate the impact of outliers
found in the dataset. In other cases, the influential data points are valid, which may
indicate that important explanatory variables are omitted from the model or regres-
sion assumptions are being violated. We must resolve these issues by identifying and
including potentially useful explanatory variables and/or checking that our model
satisfies all regression assumptions; effectively, the modeling objective determines
whether influential observations are outliers or integral to the data.
QUESTION SET
Studentized residual
–6 –4 –2 0 2 4
1 0.182
–0.956
3 2.915
1.932
5 –4.033
–0.328
7 0.357
–0.381
9 –0.275
–0.058
11 0.503
Observation
0.244
13 0.646
–0.696
15 0.297
–0.531
17 –0.212
0.411
19 –0.275
–0.597
21 –0.463
–0.616
23 0.607
0.752
25 0.015
–0.018
While meeting with the research director to discuss your results, she asks
you to do the following:
2. Recommend what actions, if any, you should take to deal with any influential
observations.
Solution:
From the results of studentized residuals , the analyst should investigate out-
lier Observations 3 and 5 to ensure there are no data entry or quality issues.
Dummy Variables
Financial
Industry Sector Technology Services Health Care Energy
Technology 1 0 0 0
Financial Services 0 1 0 0
Health Care 0 0 1 0
Energy 0 0 0 1
Food & Beverage* 0 0 0 0
The reason for using n − 1 dummy variables is to avoid violating the assumption that
no exact linear relationship exists between two or more independent variables. If we
included dummy variables for all n categories, rather than n − 1, the regression would
fail because the dummies would sum to the variable used to estimate the intercept
in the regression.
This single regression model estimates two lines of best fit corresponding to the value
of the dummy variable:
■ If D = 0, then the equation becomes Y = b0 + b1X + ε (base category).
■ If D = 1, then the equation becomes Y = (b0 + d0) + b1X + ε (category to
which the changed intercept applies).
Panel A of Exhibit 8 illustrates the effect of the intercept shift from a dummy
variable; it is the vertical distance d0. The shift can be positive or negative (here it is
positive). The solid line where the dummy takes the value of zero (D = 0) relates to
the base category; the parallel dashed line where the dummy variable takes the value
of 1 (D = 1) relates to the category to which the dummy variable applies.
© CFA Institute. For candidate use only. Not for distribution.
86 Learning Module 4 Extensions of Multiple Regression
Y = (b0 + d0) + b1 X
Y = b 0 + b1 X
b0 + d0
b0
X
Without intercept or slope dummies With intercept dummy
Y = b0 + (d1 + b1) X
Y = b0 + b1 X
b0
X
Without intercept or slope dummies With slope dummy
Y = b0 + b1X
b0 + d0
b0
A different scenario uses a dummy that allows for slope differences, a slope dummy,
which can be explained using a simple model with one continuous variable (X) and
one slope dummy variable (D).
Yi = b0 + b1Xi + d1DiXi + εi. (3)
© CFA Institute. For candidate use only. Not for distribution.
Dummy Variables in a Multiple Linear Regression 87
The slope dummy variable creates an interaction term between the X variable and
the condition represented by D = 1. The slope dummy is interpreted as a change in
the slope between the categories captured by the dummy variable:
■ If D = 0, then Y = b0 + b1X + ε (base category).
■ If D = 1, then Y = b0 + (b1 + d1) X + ε (category to which changed slope
applies).
As before, the case of D = 0 is the base category. The dummy variable allows for
slopes to differ between the two categories. In Panel B of Exhibit 8, the base category
is the same as before (shown by the solid line). For the other category, the relation-
ship between Y and X is shown by the steeper-sloping dashed line for Y = b0 + (b1 +
d1)X. The difference between slopes may be positive or negative, depending on the
scenario (here it is positive).
It is also possible for a regression to use dummies in both the slope and the inter-
cept. To do so, we combine the two previous models.
Yi – b0 + d0D1 + b1Xi + d1DiXi + εi. (4)
Blend Growth
Blend 1 0
Growth 0 1
Value* 0 0
ANOVA Df SS MS F Significance F
Regression 6 57,636.46 9,606 538 0
Residual 23,018 410,816.9 17.85
Total 23,024 468,453.3
The analyst extends the study by adding slope dummies. Initial results suggests
a small impact of fund age on returns, 0.07% per year of age. She wonders whether
this relationship between age and performance differs by fund type. For example,
does the age factor affect growth or blend funds differently from how it affects value
funds? To explore this idea, she introduces two interaction variables—slope dummies,
AGE_BLEND and AGE_GROWTH—and estimates the following model:
Returnsi = b0 + b1EXPi + b2CASHi + b3AGEi + b4SIZEi + d1BLENDi +
d2GROWTHi + d3AGE_BLENDi + d4AGE_GROWTHi + εi.
When BLEND = 1, the interaction term AGE_BLEND takes the value of AGE; other-
wise, it takes the value of zero. Similarly, when GROWTH = 1, the interaction term
AGE_GROWTH takes the value of AGE; otherwise, it takes the value of zero. Exhibit
10 presents the revised regression results.
Exhibit 10: Explaining Mutual Fund Returns with Intercept and Slope
Dummies
Regression Statistics
R2 0.123
Adjusted R2 0.123
Standard Error 4.224
Observations 23,025
ANOVA Df SS MS F Significance F
Regression 8 57,760.46 7,220 404.6 0.000
Residual 23,016 410,692.9 17.84
Total 23,024 468,453.3
These results show that the values and significance of the slope coefficients are
little changed. But the revised model provides more information on AGE. For the base
group (value funds), the AGE coefficient suggests those funds earn an extra return of
0.065% as time passes. This is when BLEND = 0 and GROWTH = 0.
The interaction term AGE_GROWTH is statistically significant, with a p-value =
0.01, implying for growth funds an extra annual return with each year of age equal to
the sum of the AGE and AGE_GROWTH coefficients, or 0.085% (= 0.065% + 0.020%).
So, the “slope” coefficient for GROWTH (with respect to AGE) is the sum of those
© CFA Institute. For candidate use only. Not for distribution.
90 Learning Module 4 Extensions of Multiple Regression
two coefficients. Finally, we can interpret the overall result as suggesting that growth
funds’ returns exceed those of value funds by 2.347%, or 2.262% (GROWTH) plus
0.085% (AGE + AGE_GROWTH), for each year of a fund’s age (since inception).
QUESTION SET
You are interviewing for the position of junior analyst at a global macro
hedge fund. The managing director (MD) interviewing you outlines the
following scenario: You are tasked with studying the relation between stock
market returns and GDP growth for multiple countries and must use a binary
variable in your regression model to categorize countries by stock market type,
emerging (1) or developed (0) markets. The MD provides the following three
modeling choices:
A. Slope dummy: It allows for a change in slope to classify countries
into weak stock performance countries and strong stock performance
countries.
B. Intercept dummy: It allows for a change in intercept to classify coun-
tries by their stock market development status.
C. Interaction term: It allows for a change in intercept to classify coun-
tries into low-GDP growth and high-GDP growth countries.
1. To answer the MD’s question, identify the appropriate new variable and its
function.
A. Slope dummy.
B. Intercept dummy.
C. Interaction term.
Solution:
B is correct. The new variable, an intercept dummy, allows for a change in
intercept to classify countries by emerging versus developed stock market
status.
The MD continues, indicating that you must refine the model to capture the
effect on stock returns of the interaction of each country’s GDP growth and its
stock market development status. He then asks you to do the following:
2. Identify the model you should use (noting the following definitions).
Another MD joins the interview and mentions that an analyst on her team esti-
mated a regression to explain a cross-section of returns on assets of companies
using a regulation dummy variable (REG = 1 if regulated, 0 otherwise), market
share (MKTSH), and an interaction term, REG_MKTSH, the product of REG
and MKTSH. She notes the resulting model is
RET = 0.50 – 0.5REG + 0.4MKTSH – 0.2REG_MKTSH
and asks you to do the following:
In contrast to a linear regression, the dependent variable here is not continuous but
discrete (binary). Estimating such a model using linear regression is not appropriate.
If we were to try to estimate this using the qualitative dependent variable, such as Y
= 1 if bankrupt and 0 if not, in a linear model with three independent variables, then
we would be estimating a linear probability model:
Yi = b0 + b1X1i + b2X2i + b3X3i + εi. (5)
The problem with this form is that the predicted value of the dependent variable
could be greater than 1 or less than 0, depending on the estimated coefficients bi and
the value of observed independent variables. Generating predicted values above 1.0
or below 0 would be invalid, because the probability of bankruptcy (or of anything)
cannot be greater than 1.0 or less than 0. Moreover, linear regression assumes the
relationship between the probability of bankruptcy and each financial variable is linear
over the range of the financial variable, which might be unrealistic. For example, one
can reasonably expect that the probability of bankruptcy and the debt-to-equity ratio
are not linearly related for very low or high levels of that variable.
To address these issues, we apply a non-linear transformation to the probability
of bankruptcy and relate the transformed probabilities linearly to the independent
variables. The most commonly used transformation is the logistic transformation.
Exhibit 11 shows the linear probability model (Panel A) and logistic regression model
(Panel B), where the logit model’s non-linear function takes on a sigmoidal shape and
is approximately linear except when probability estimates are close to zero or one.
1 1
0 0
X1 X1
ln(_
1 −P P ). (6)
Logistic regression (logit) uses the logistic transformation of the event probability
(P) into the log odds, ln(_
1 −P P ), as the dependent variable:
ln(_
1 −P P ) = b0 + b 1 X1 + b2 X
2 + b3 X3 + ε. (7)
Once the log odds are estimated, the event probability can be derived as
P = ___________________________
1
.
1 + exp[− (b0 + b1 X1 + b2 X2 + b3 X3 )]
(8)
Logistic regression assumes a logistic distribution for the error term; the distribution’s
shape is similar to the normal distribution but with fatter tails.
Logistic regression coefficients are typically estimated using the maximum like-
lihood estimation (MLE) method rather than by least squares. The MLE method
estimates logistic regression coefficients that make it most likely that the choices in the
sample would occur by maximizing the likelihood function for the data. For logistic
regression, the probability distribution used to construct the likelihood function for
the data is the binomial distribution because each outcome is binary.
The prediction is binary (0 or 1), and the logistic regression function produces
the probability (P) that the outcome is 1. MLE estimates of the intercept and slope
coefficients in the logistic regression are the values that make the data in the regression
sample “most likely” and are derived via statistical software. Notably, a hypothesis
test that a logit regression coefficient is significantly different from zero is similar to
the test in OLS regression.
For logistic regression, most statistical software packages produce the log-likelihood,
a chi-square-distributed test statistic. The performance of a logit model in classifying
the dependent variable (as 0 or 1) may be evaluated by examining the p-value of this
test statistic versus selected significance levels.
Logistic regression does not have an equivalent measure to R2 because it cannot
be fitted using least squares. Pseudo-R2 has been proposed to capture the explained
variation in a logistic regression and is generated in standard software output. The
pseudo-R2 must be interpreted with care because it can only be used to compare
different specifications of the same model (not models based on different datasets).
Determining the marginal effect of a change in a variable in the logistic model is
not as straightforward as in a regression model. Unlike the linear OLS regression, a
logistic regression is non-linear and the interpretation of the estimates for a logistic
regression depends not only on the estimate for the specific variable estimate but also
on the level of the other variable estimates. The non-linear nature of the relationship
in the logistic regression estimate depicts the marginal contribution of each variable
estimate to the slope of the probability curve. That is why the impact of a one-unit
incremental change of an independent variable on the probability of Y = 1 depends
on the level of all the other independent variables.
In a logistic regression, the change in the probability for a given change in a variable
is the slope of the probability curve. The slope can be expressed as the derivative of
probability. That probability contains both an exponential function and the derivative
of that exponential function. The derivative is the exponential function itself multiplied
by the derivative of the contents of the exponential function. Effectively in a logistic
model, the value of the derivative changes depending on the slope and its relative
position. In the linear probability model, however, the derivative is a constant; thus,
the slope is constant and the marginal effect is a constant.
In Exhibit 12, it is clear that the impact of a one-unit change in X1 on P(Y = 1)
will depend on the overall value of ( bˆ0+ bˆ1X1 + bˆ2X2 + bˆ3X3 ) . When
(bˆ0+ bˆ1X
1 + bˆ2X2 + bˆ3X
3 )is very small or very large for an observation, the impact
of a one-unit change in X1 on P(Y = 1) will be small because the slope of P(Y = 1) is
© CFA Institute. For candidate use only. Not for distribution.
94 Learning Module 4 Extensions of Multiple Regression
close to zero. However, when (bˆ0+ bˆ1X1 + bˆ2X2 + bˆ3X3 )is near the inflection point,
P(Y = 1) =0.5, a one-unit change in X1 will have a larger impact on P(Y = 1), since the
slope of P(Y = 1) is large.
^ = 1|x)
P(y 0.5
One way to estimate this marginal effect of an independent variable is to find the
marginal effect for the “average” company/investment/observation. This process uses
the mean value in the dataset for each of the Xi’s, calculates the probability using these
mean values, and then calculates the probability again using the mean values for all
variables except the independent variable of interest, which is increased from its mean
value by one unit. This provides an estimate of the marginal effect of a change in the
chosen independent variable on P(Y = 1). Most software programs have an option to
conduct this analysis. For instance in Python, “sklearn, get_margeff” can be
used, and in R, in the margins package, “margins,” can be used.
It is equally reasonable to examine the marginal effect for a particular observation—
may it be associated with a company, an investment, or any other relevant observation—
by first specifying the observation values and using these in the calculations outlined
previously to calculate the marginal effect of the chosen variable based on its charac-
teristics. Then this result provides an estimate of the marginal probability: how much
the probability of the event changes should one or more of its characteristics change.
Effectively, this approach provides a sensitivity analysis to incremental changes.
The likelihood ratio (LR) test is a method to assess the fit of logistic regression
models and is based on the log-likelihood metric that describes the fit to the data.
The LR test statistic is
LR = −2 × (Log-likelihood restricted model − Log-likelihood unrestricted model).
The test is similar to the joint F-test of hypotheses used in least squares multiple
regression (discussed in an earlier learning module) in that it compares the fit of the
restricted and unrestricted models; however, it uses the log-likelihoods of each model.
The LR test is distributed as chi-squared with q degrees of freedom (i.e., number of
restrictions).
© CFA Institute. For candidate use only. Not for distribution.
Multiple Linear Regression with Qualitative Dependent Variables 95
ln(_
1 −P P )
= b0 + b 1 X1 + b2 X
2 + b3 X3 + ε,
ln(_
1 −P P ) = b0 + b 1 X1 + ε,
then the null hypothesis is H0: b2 = b3 = 0 and the alternative hypothesis is that
at least one of the coefficients is different from zero.
Here, the LR test is a joint test of the restricted coefficients. Rejecting the null
hypothesis is a rejection of the smaller, restricted model in favor of the larger, unre-
stricted model. Finally, the LR test performs best when applied to large samples.
Logistic regression does not have an equivalent measure to R2 because it cannot
be fitted using least squares. Pseudo-R2 has been proposed to capture the explained
variation in a logistic regression and is generated in standard software output. The
pseudo-R2 must be interpreted with care because it can be used only to compare
different specifications of the same model (not models based on different datasets).
KNOWLEDGE CHECK
Exhibit 13
95% CI
In the weekly research team meeting, the research director asks you to
explain your logistic regression model and assess how the model fits the data.
P = ___________________________
1
,
1 + exp[− (b0 + b 1 X1 + b 2 X2 + b 3 X3 )]
we use the values of the coefficients from the logistic equation result and
the mean, or average values of the independent variables, to find the initial
average probability of repurchasing shares:
P = ___________________________________________________________
{ [
1
)]}
.
1 + exp − − 0.4738 + − 0.9118 0.0830 + 0.9407 − 0.0535 + − 0.3186 0.9182
( )( ) ( )( ) ( )(
P = 29.06%.
This implies that for the average firm, there is a 29.06% probability of share
repurchase.
Now, for each independent variable, let us increase it by 1%, or 0.01, while
holding the others constant and see the marginal impact to probability of a
share buyback.
CASH:
We increase the CASH variable by 1%, from 0.083 to 0.093, and calculate the
new probability of share buyback:
P = ___________________________________________________________
{ [
1
)]}
.
1 + exp − − 0.4738 + − 0.9118 0.0930 + 0.9407 − 0.0535 + − 0.3186 0.9182
( )( ) ( )( ) ( )(
© CFA Institute. For candidate use only. Not for distribution.
Multiple Linear Regression with Qualitative Dependent Variables 97
P = 28.87%.
Therefore, the marginal impact of increasing the CASH variable by 1% and
holding all the other variables constant is a change in the probability of a
share buyback of 28.87% − 29.06% = −0.19%; differently put, increasing the
CASH variable by 1% decreases the probability of a buyback by 0.19%.
NPM:
We increase the NPM variable by 1%, from −0.0535 to −0.0435, and calcu-
late the new probability of a share buyback:
1
___________________________________________________________
P =
{ [ )]}
.
1 + exp − − 0.4738 + − 0.9118 0.0830 + 0.9407 − 0.0435 + − 0.3186 0.9182
( )( ) ( )( ) ( )(
P = 29.26%
Therefore, the marginal impact of increasing the NPM variable by 1% is an
increase in the probability of a share buyback of 29.26% − 29.06% = 0.20%.
DE:
We increase the DE variable by 1%, from 0.9182 to 0.9282, and calculate the
new probability of a share buyback:
P = ___________________________________________________________
{ [
1
)]}
.
1 + exp − − 0.4738 + − 0.9118 0.0830 + 0.9407 − 0.0535 + − 0.3186 0.9282
( )( ) ( )( ) ( )(
P = 29.00%.
Therefore, the marginal impact of increasing the NPM variable by 1%,
rounded to two decimal places, is a decrease in the probability of a share
buyback of 29.00% − 29.06% = −0.07%; differently put, it increases the prob-
ability of a share buyback.
3. Evaluate how your logistic regression model fits the data using the LR test
and an intercept-only model as the restricted model.
Solution:
The log-likelihood statistics from the logistic regression results are as
follows:
Model Log-likelihood
Restricted: Intercept only −312.68
Unrestricted: Intercept, CASH, DE, NPM −304.20
The LR test is a test of the hypothesis for the restrictions, using the standard
six-step hypothesis test process, as follows:
Based on the LR test, your conclusion should be that the unrestricted model
fits the data better than the intercept-only model, indicating that the three
explanatory variables are jointly significant. Note the regression results
show the LR test statistic’s P-value is 0.0007. Moreover, individual (z-statis-
tic) tests of the coefficients show that DE and NPM are each significant at
the 5% level.
Code: Logistic Regression
In Python:
import pandas as pd
from statsmodels.formula.api import logit
df = pd.read_csv(“data.csv”)
formula = ('Repurchase ~ CASH + DE + NPM')
model=logit(formula=formula,data=df).
fit(method='newton')
print(model.summary())
In R:
df <- read.csv(‘data.csv')
logit <- glm(Repurchase ~ CASH+DE+NPM,
family=binomial(link=”logit”),data=df)
summary(logit)
PRACTICE PROBLEMS
Finally, you are tasked with investigating whether there is any monthly seasonali-
ty in the excess portfolio returns. You construct a regression model using dum-
my variables for the months; your regression statistics and ANOVA results are
shown in Exhibit 2.
© CFA Institute. For candidate use only. Not for distribution.
100 Learning Module 4 Extensions of Multiple Regression
Regression Statistics
Multiple R 0.321
R-Squared 0.103
Adjusted R-Squared –0.014
Standard Error 8.100
Observations 96.000
ANOVA
df SS MS F Signif. F
Regression 11 634.679 57.698 0.879 0.563
Residual 84 5511.369 65.612
Total 95 6146.048
B. Observations 1, 6, 50, and 92, because the absolute values of their studen-
tized residuals exceed 2.63
C. All the observations shown except Observation 95, because the absolute
value of its studentized residual is less than 0.094
3. Identify both the base month and the coefficient that represents its returns in
© CFA Institute. For candidate use only. Not for distribution.
Practice Problems 101
Exhibit 2.
A. December is the base month, and the intercept coefficient represents its
returns.
B. November is the base month, and the intercept coefficient represents its
returns.
C. December is the base month, and the average of the coefficients for the
other 11 months represents its returns.
4. Determine using Exhibit 2 which one of the following statements is most likely to
be correct. Monthly seasonality in the firm’s portfolio is:
A. highly likely.
B. highly unlikely.
Variable Description
1 net_assets Net assets of ETF in US dollars
2 small_fund Dummy variable = 1 if a small-size fund and 0 otherwise,
with large-size fund as the base
3 medium_fund Dummy variable =1 if a medium-size fund and 0 otherwise,
with large-size fund as the base
4 portfolio_stocks Percentage of portfolio invested in stocks (1 – 100)
5 portfolio_bonds Percentage of portfolio invested in bonds (1 – 100)
6 price_earnings Ratio of price per share to earnings per share
7 price_book Ratio of price per share to book value per share
8 price_sales Ratio of price per share to sales per share
9 price_cashflow Ratio of price per share to cash flow per share
10 label (dependent 1 = winning fund, an ETF whose monthly return is one
variable) standard deviation or more above the mean monthly
return across all ETFs in the dataset, and 0 = average fund,
otherwise
© CFA Institute. For candidate use only. Not for distribution.
102 Learning Module 4 Extensions of Multiple Regression
For the first logistic regression, you are asked to use all the independent variables,
except for the fund size dummy variables (small_fund and medium_fund). For
the second logistic regression, you are asked to use all the independent variables
except the fund size continuous variable (net assets).
You use a standard software package (in Python or R) to develop the logistic
regression models. Your results are as follows:
Logistic Regression 1
P-Value
Coefficient Std. Err. z-Statistic > |z| [0.025 0.975]
Intercept –2.0350 0.5221 –3.8979 0.0001 –3.0583 –1.0118
net_assets –0.7667 1.3571 –0.5649 0.5721 –3.4265 1.8932
portfolio_stocks –0.0089 0.0051 –1.7550 0.0793 –0.0188 0.0010
portfolio_bonds –0.1113 0.0729 –1.5263 0.1269 –0.2543 0.0316
price_earnings 0.0292 0.0200 1.4647 0.1430 –0.0099 0.0683
price_book –0.0390 0.1029 –0.3791 0.7046 –0.2407 0.1627
price_sales 0.3432 0.0777 4.4160 0.0000 0.1909 0.4956
price_cashflow –0.0502 0.0363 –1.3805 0.1674 –0.1214 0.0211
Logistic Regression 2
P-Value
Coefficient Std. Err. z-Statistic > |z| [0.025 0.975]
Intercept –1.9589 0.5254 –3.7283 0.0002 –2.9886 –0.9291
small_fund –0.4794 0.3719 –1.2888 0.1975 –1.2083 0.2496
medium_fund –0.3509 0.2348 –1.4948 0.1350 –0.8111 0.1092
portfolio_stocks –0.0092 0.0051 –1.8099 0.0703 –0.0191 0.0008
© CFA Institute. For candidate use only. Not for distribution.
Practice Problems 103
P-Value
Coefficient Std. Err. z-Statistic > |z| [0.025 0.975]
portfolio_bonds –0.1121 0.0727 –1.5433 0.1228 –0.2546 0.0303
price_earnings 0.0389 0.0211 1.8467 0.0648 –0.0024 0.0802
price_book –0.0803 0.1068 –0.7519 0.4521 –0.2897 0.1291
price_sales 0.3453 0.0796 4.3362 0.0000 0.1892 0.5014
price_cashflow –0.0510 0.0376 –1.3573 0.1747 –0.1247 0.0227
5. Identify which one of the following choices is most likely to be correct: Logistic
regression is the appropriate regression method for your assignment because the:
A. independent variables include dummy variables for small- and medium-size
funds.
6. Identify which one of the following statements best describes the interpretation
of an independent variable’s slope coefficient in a logistic regression model: The
slope coefficient is the change in the:
A. log odds that the event happens per unit change in the independent vari-
able, while all other independent variables increase by one unit.
B. odds that the event happens per unit change in the independent variable,
holding all other independent variables constant.
C. log odds that the event happens per unit change in the independent vari-
able, holding all other independent variables constant.
7. Determine which one of the following statements is true. The intercept in these
logistic regressions is interpreted as the:
A. probability of the ETF being a winning fund if all independent variables are
one.
B. log odds of the ETF being a winning fund if all independent variables are
zero.
C. log odds of the ETF being an average fund if all independent variables are
zero.
8. Based on the output for Logistic Regression 1 in the table below, which of the
following alternatives is closest to the probability that any ETF will be a winning
fund?
A. 6.75%
B. 5.96%
C. 5.67%
© CFA Institute. For candidate use only. Not for distribution.
104 Learning Module 4 Extensions of Multiple Regression
9. Based on the output for Logistic Regression 1 and the information in the table
above, which of the following alternatives is closest to the change in the probabil-
ity that an ETF will be a winning fund if its price-to-earnings ratio increases by
one unit and all else stays constant?
A. 17.0%
B. 0.16%
C. 1.5%
10. Based on the output from with Logistic Regression 1, how will the change in the
probability that an ETF will be a winning fund increase if one of the other inde-
pendent variable values, except for net_assets, is decreased by one unit, holding
all else constant?
A. The probability will increase, but not as much as with the price-to-earnings
increasing by one unit.
11. Identify which one of the following statements about the logistic regression mod-
el fit is most likely to be correct: Based on the log-likelihood criteria:
A. Model 2 has a better fit because it has a higher log-likelihood value.
12. Determine, using only the statistically significant variable estimate(s) in Logis-
tic Regression 2 and the information provided below, which of the following is
closest to the probability of the Alpha ETF being a winning fund and whether it
would be classified as a winning fund.
Alpha ETF variable values:
■ small_fund = 0.
■ medium_fund = 0.
■ portfolio_stocks = 99.3%.
■ portfolio_bonds = 0.7%.
■ price_earnings = 25.0.
■ price_book =1.1.
© CFA Institute. For candidate use only. Not for distribution.
Practice Problems 105
■ price_sales = 4.0.
■ price_cashflow = 5.7.
Use a significance level of 5% and a probability threshold for being a winner of
65%.
A. 27.4%, and the Alpha ETF is not classified as a winning fund
SOLUTIONS
1. C is correct. The rule of thumb for the leverage measure is that if it exceeds
3( _
k +n 1 ), where k is the number of independent variables, then it is a potentially
= (_
influential observation. Since n = 96 and k = 2, then 3 2 96 )
+ 1 = 0.09375.
Three observations exceed this value: 6, 50, and 94. So, they are potentially
influential observations.
2. B is correct. For the studentized residuals measure, the critical t-value is 2.63. So,
any observation with a studentized residual whose absolute value exceeds 2.63 is
a potentially influential observation. The studentized residuals for Observations
1, 6, 50, and 92 have absolute values exceeding 2.63; therefore, they are potential-
ly influential observations.
3. A is correct. December is the base month, and the intercept coefficient represents
its returns. We use 11 dummy variables to represent the returns for each month
from January through November. December results are measured when each of
these dummy variables equals zero, leaving the intercept coefficient to represent
December returns.
Using the mean values and coefficient estimates of the independent variables, the
probability of the average ETF being a winner is
1
P = _______________________________________________________
(− 2.0350 + − 0.7667 0.2911 + − 0.0089 92.9093 +
)( ) ( )( )
P = 5.67%.
This implies that for an ETF with the average values of the independent variables,
there is a 5.67% probability that it will be a winning ETF.
9. B is correct. Keeping all the independent variables’ average values fixed and in-
creasing the P/E value by 1, from 15.1743 to 16.1743, yields the new probability.
1
P = ________________________________________________________
− 2.0350 + − 0.7667 0.2911 + − 0.0089 92.9093 +
( )( ) ( )( )
P = 5.82%.
From the previous question, we know that the marginal probability is 5.67%.
Therefore, the marginal increase in the probability of an average ETF being a win-
ner went up 5.82% − 5.67% = 0.15%. A one-unit change in the P/E of an ETF will
increase the probability of it becoming a winning fund by 0.15%, and therefore, B
is the closest answer.
10. B is correct. In the previous question, the price-to-earnings variable value and
the coefficient are both positive. By increasing the variable value incrementally by
one, we are increasing the overall positive value of the series of items in the exp
function. Therefore, if we are reducing the product of a coefficient value pair that
is negative, we are increasing the overall value of the series of items in the exp
function.
The next step is to look to see how many negative coefficient and value prod-
ucts are in the series of items in the exp function, then calculate the coeffi-
cient value product, and compare them to the coefficient value product for the
price-to-earnings variable.
Avg. Avg.
Avg. Initial Value Value + New
Variable Coeff. Value Product Change Change Product Increase
portfolio_ −0.0089 92.9093 −0.8269 −1 91.9093 −0.8180 0.0089
stocks coeff
portfolio_ −0.1113 2.3068 −0.2567 −1 1.3068 −0.1454 0.1113
bonds coeff
price_earn- 0.0292 15.1743 0.4431 1 16.1743 0.4723 0.0292
ings coeff
price_book −0.0390 2.0711 −0.0808 −1 1.0711 −0.0418 0.0390
coeff
price_cash- −0.0502 7.6489 −0.3840 −1 6.6489 −0.3338 0.0502
flow coeff
11. A is correct. Model 2 has a better fit because it has a higher (less negative)
log-likelihood value, –450.40 versus –451.66, compared to Model 1.
12. B is correct. Besides the significant intercept, the only significant (at the 5% level)
variable in Logistic Regression 2 is price_sales. Using these two factors, the prob-
ability of this ETF being a winning fund is calculated to be 35.95%, as follows:
© CFA Institute. For candidate use only. Not for distribution.
108 Learning Module 4 Extensions of Multiple Regression
Because this probability is well below the 65% threshold for being a winner, the
Alpha ETF would not be classified as a winning fund.
© CFA Institute. For candidate use only. Not for distribution.
LEARNING MODULE
5
Time-Series Analysis
by Richard A. DeFusco, PhD, CFA, Dennis W. McLeavey, DBA, CFA, Jerald
E. Pinto, PhD, CFA, and David E. Runkle, PhD, CFA.
Richard A. DeFusco, PhD, CFA, is at the University of Nebraska-Lincoln (USA). Dennis W.
McLeavey, DBA, CFA, is at the University of Rhode Island (USA). Jerald E. Pinto, PhD,
CFA, is at CFA Institute (USA). David E. Runkle, PhD, CFA, is at Jacobs Levy Equity
Management (USA).
LEARNING OUTCOMES
Mastery The candidate should be able to:
calculate and evaluate the predicted trend value for a time series,
modeled as either a linear trend or a log-linear trend, given the
estimated trend coefficients
describe factors that determine whether a linear or a log-linear trend
should be used with a particular time series and evaluate limitations
of trend models
explain the requirement for a time series to be covariance stationary
and describe the significance of a series that is not stationary
describe the structure of an autoregressive (AR) model of order
p and calculate one- and two-period-ahead forecasts given the
estimated coefficients
explain how autocorrelations of the residuals can be used to test
whether the autoregressive model fits the time series
explain mean reversion and calculate a mean-reverting level
contrast in-sample and out-of-sample forecasts and compare the
forecasting accuracy of different time-series models based on the
root mean squared error criterion
explain the instability of coefficients of time-series models
describe characteristics of random walk processes and contrast them
to covariance stationary processes
describe implications of unit roots for time-series analysis, explain
when unit roots are likely to occur and how to test for them, and
demonstrate how a time series with a unit root can be transformed
so it can be analyzed with an AR model
describe the steps of the unit root test for nonstationarity and
explain the relation of the test to autoregressive time-series models
© CFA Institute. For candidate use only. Not for distribution.
110 Learning Module 5 Time-Series Analysis
LEARNING OUTCOMES
Mastery The candidate should be able to:
explain how to test and correct for seasonality in a time-series model
and calculate and interpret a forecasted value using an AR model
with a seasonal lag
explain autoregressive conditional heteroskedasticity (ARCH) and
describe how ARCH models can be applied to predict the variance of
a time series
explain how time-series variables should be analyzed for
nonstationarity and/or cointegration before use in a linear regression
determine an appropriate time-series model to analyze a given
investment problem and justify that choice
1 INTRODUCTION
As financial analysts, we often use time-series data to make investment decisions. A
time series is a set of observations on a variable’s outcomes in different time periods:
the quarterly sales for a particular company during the past five years, for example, or
the daily returns on a traded security. In this reading, we explore the two chief uses
of time-series models: to explain the past and to predict the future of a time series.
We also discuss how to estimate time-series models, and we examine how a model
describing a particular time series can change over time. The following two examples
illustrate the kinds of questions we might want to ask about time series.
Suppose it is the beginning of 2020 and we are managing a US-based investment
portfolio that includes Swiss stocks. Because the value of this portfolio would decrease
if the Swiss franc depreciates with respect to the dollar, and vice versa, holding all else
constant, we are considering whether to hedge the portfolio’s exposure to changes
in the value of the franc. To help us in making this decision, we decide to model the
time series of the franc/dollar exchange rate. Exhibit 1 shows monthly data on the
franc/dollar exchange rate. The data are monthly averages of daily exchange rates. Has
the exchange rate been more stable since 1987 than it was in previous years? Has the
exchange rate shown a long-term trend? How can we best use past exchange rates to
predict future exchange rates?
© CFA Institute. For candidate use only. Not for distribution.
Introduction 111
2.5
2.0
1.5
1.0
0.5
0
77 80 84 88 91 95 99 02 06 10 13 17
Source: Board of Governors of the Federal Reserve System.
As another example, suppose it is the beginning of 2020. We cover retail stores for
a sell-side firm and want to predict retail sales for the coming year. Exhibit 2 shows
monthly data on US retail sales. The data are not seasonally adjusted, hence the spikes
around the holiday season at the turn of each year. Because the reported sales in the
stores’ financial statements are not seasonally adjusted, we model seasonally unadjusted
retail sales. How can we model the trend in retail sales? How can we adjust for the
extreme seasonality reflected in the peaks and troughs occurring at regular intervals?
How can we best use past retail sales to predict future retail sales?
500,000
400,000
300,000
200,000
100,000
0
Jan/95 Oct/97 Jul/00 Apr/03 Jan/06 Oct/08 Jul/11 Apr/14 Jan/17
Source: US Department of Commerce, Census Bureau.
© CFA Institute. For candidate use only. Not for distribution.
112 Learning Module 5 Time-Series Analysis
■ The mean or variance of the time series changes over time. Regression
results are invalid if we estimate an autoregressive model for a time series
with mean or variance that changes over time.
Before we try to use time series for forecasting, we may need to transform the
time-series model so that it is well specified for linear regression. With this objective in
mind, you will observe that time-series analysis is relatively straightforward and logical.
Estimating a trend in a time series and using that trend to predict future values of the
time series is the simplest method of forecasting. For example, we saw in Exhibit 2
that monthly US retail sales show a long-term pattern of upward movement—that is,
a trend. In this section, we examine two types of trends—linear trends and log-linear
trends—and discuss how to choose between them.
yt = the value of the time series at time t (value of the dependent variable)
dicted value of y5 is 15.1 and at t = 6 the predicted value of y6 is 17.1. Note that each
consecutive observation in this time series increases by bˆ1 = 2, irrespective of the
level of the series in the previous period.
EXAMPLE 1
25
20
15
10
–5
–10
–15
–20
–25
95 97 99 01 03 05 07 09 11 13 15 17 19
Regression Statistics
R2 0.0099
Standard error 3.1912
© CFA Institute. For candidate use only. Not for distribution.
Linear Trend Models 115
Regression Statistics
Observations 294
Durbin–Watson 1.2145
25
20
15
10
–5
–10
–15
–20
–25
Jan/95 May/99 Sep/03 Jan/08 May/12 Sep/16
calculate and evaluate the predicted trend value for a time series,
modeled as either a linear trend or a log-linear trend, given the
estimated trend coefficients
describe factors that determine whether a linear or a log-linear trend
should be used with a particular time series and evaluate limitations
of trend models
Sometimes a linear trend does not correctly model the growth of a time series. In those
cases, we often find that fitting a linear trend to a time series leads to persistent rather
than uncorrelated errors. If the residuals from a linear trend model are persistent, then
we need to employ an alternative model satisfying the conditions of linear regression.
For financial time series, an important alternative to a linear trend is a log-linear
trend. Log-linear trends work well in fitting time series that have exponential growth.
Exponential growth means constant growth at a particular rate. For example,
annual growth at a constant rate of 5% is exponential growth. How does exponential
growth work? Suppose we describe a time series by the following equation:
yt = e b0 +b1 t, t = 1, 2, …, T. (2)
Exponential growth is growth at a constant rate (eb1 − 1)with continuous com-
pounding. For instance, consider values of the time series in two consecutive periods.
In Period 1, the time series has the value y1 = eb0 +b1 (1) , and in Period 2, it has the
value y2 = e b0 +b1 (2) . The resulting ratio of the values of the time series in the first two
periods is y2/y1 = (eb0 +b1 (2) )/ (eb0 +b1 (1) ) = e b1 (1) . Generally, in any period t, the
time series has the value yt = e b0 +b1 (t) . In period t + 1, the time series has the value
yt+1 = e b0 +b1 (t+1). The ratio of the values in the periods (t + 1) and t is yt+1/yt =
© CFA Institute. For candidate use only. Not for distribution.
Log-Linear Trend Models 117
eb0 +b1 ( t+1)/ e b0 +b1 (t) = eb1 (1) . Thus, the proportional rate of growth in the time series
over two consecutive periods is always the same: (yt+1 − yt)/yt = yt+1/yt − 1 = e b1 − 1.
For example, if we use annual periods and eb1 = 1.04 for a particular series, then that
series grows by 1.04 − 1 = 0.04, or 4% a year. Therefore, exponential growth is growth
at a constant rate. Continuous compounding is a mathematical convenience that allows
us to restate the equation in a form that is easy to estimate.
If we take the natural log of both sides of Equation 2, the result is the following
equation:
ln yt = b0 + b1t, t = 1, 2, . . . , T.
Therefore, if a time series grows at an exponential rate, we can model the natural
log of that series using a linear trend (an exponential growth rate is a compound
growth rate with continuous compounding). Of course, no time series grows exactly
at a constant rate. Consequently, if we want to use a log-linear model, we must esti-
mate the following equation:
ln yt = b0 + b1t + εt, t = 1, 2, . . . , T. (3)
Note that this equation is linear in the coefficients b0 and b1. In contrast to a linear
trend model, in which the predicted trend value of yt is bˆ0+ bˆ1t, the predicted trend
value of yt in a log-linear trend model is e bˆ0+bˆ1tbecause e lnyt= yt.
Examining Equation 3, we see that a log-linear model predicts that ln yt will increase
by b1 from one time period to the next. The model predicts a constant growth rate
in yt of e b1 − 1. For example, if b1 = 0.05, then the predicted growth rate of yt in each
period is e0.05 − 1 = 0.051271, or 5.13%. In contrast, the linear trend model (Equation
1) predicts that yt grows by a constant amount from one period to the next.
Example 2 illustrates the problem of nonrandom residuals in a linear trend model,
and Example 3 shows a log-linear regression fit to the same data.
EXAMPLE 2
8,000
7,000
6,000
5,000
4,000
3,000
2,000
1,000
0
1/Apr/01 3/Apr/05 29/Mar/09 31/Mar/13 2/Apr/17
Source: Bloomberg.
Regression Statistics
R2 0.9603
Standard error 353.36
Observations 74
Durbin–Watson 0.40
Source: Bloomberg.
At first glance, the results shown in Exhibit 7 seem quite reasonable: The trend
coefficient is highly statistically significant. When Benedict plots the data on
Starbucks’ sales and the trend line, however, he sees a different picture. As Exhibit
8 shows, before 2008 the trend line is persistently below sales. Subsequently,
until 2015, the trend line is persistently above sales and then varies somewhat
thereafter.
© CFA Institute. For candidate use only. Not for distribution.
Log-Linear Trend Models 119
8,000
7,000
6,000
5,000
4,000
3,000
2,000
1,000
0
1/Apr/01 2/Jan/05 28/Sep/08 1/Jul/12 27/Mar/16
Source: Bloomberg.
Recall a key assumption underlying the regression model: that the regression
errors are not correlated across observations. If a trend is persistently above or
below the value of the time series, however, the residuals (the difference between
the time series and the trend) are serially correlated. Exhibit 9 shows the resid-
uals (the difference between sales and the trend) from estimating a linear trend
model with the raw sales data. The figure shows that the residuals are persistent:
They are consistently negative from 2008 to 2015 and consistently positive from
2001 to 2008 and from 2017 to 2019.
Because of this persistent serial correlation in the errors of the trend model,
using a linear trend to fit sales at Starbucks would be inappropriate, even though
the R2 of the equation is high (0.96). The assumption of uncorrelated residual
errors has been violated. Because the dependent and independent variables
are not distinct, as in cross-sectional regressions, this assumption violation is
serious and causes us to search for a better model.
1,000
800
600
400
200
–200
–400
–600
–800
1/Apr/01 2/Jan/05 28/Sep/08 1/Jul/12 27/Mar/16
Source: Bloomberg.
© CFA Institute. For candidate use only. Not for distribution.
120 Learning Module 5 Time-Series Analysis
EXAMPLE 3
This equation seems to fit the sales data well. As Exhibit 10 shows, the R2 for
this equation is 0.95. An R2 of 0.95 means that 95% of the variation in the
natural log of Starbucks’ sales is explained solely by a linear trend.
Regression Statistics
R2 0.9771
Standard error 0.1393
Observations 74
Durbin–Watson 0.26
Source: Compustat.
Although both Equations 1 and Equation 3 have a high R2, Exhibit 11 shows
how well a linear trend fits the natural log of Starbucks’ sales (Equation 3).
The natural logs of the sales data lie very close to the linear trend during the
sample period, and log sales are not substantially above or below the trend
for long periods of time. Thus, a log-linear trend model seems better suited
for modeling Starbucks’ sales than a linear trend model is.
10
9
8
7
6
5
4
3
2
1
0
1/Apr/01 2/Jan/05 28/Sep/08 1/Jul/12 27/Mar/16
Source: Compustat.
2. How much different is the previous forecast from the prediction of the
linear trend model?
Solution:
Exhibit 7 showed that for the linear trend model, the estimated value of bˆ0is
137.4213 and the estimated value of b ˆ1is 80.2060. Thus, if we predict
Starbucks’ sales for the fourth quarter of 2019 (t = 75) using the linear trend
model, the forecast is ˆ
y 75= 137.4213 + 80.2060(75) = $6,152.87 million. This
forecast is far below the prediction made by the log-linear regression model.
Later we will examine whether we can build a better model of Starbucks’
quarterly sales than a model that uses only a log-linear trend.
Both the linear trend model and the log-linear trend model are single-variable regres-
sion models. If they are to be correctly specified, the regression model assumptions
must be satisfied. In particular, the regression error for one period must be uncorrelated
with the regression error for all other periods. In Example 2 in the previous section, we
could infer an obvious violation of that assumption from a visual inspection of a plot
of residuals (Exhibit 9). The log-linear trend model of Example 3 appeared to fit the
data much better, but we still need to confirm that the uncorrelated errors assumption
is satisfied. To address that question formally, we must carry out a Durbin–Watson
test on the residuals.
© CFA Institute. For candidate use only. Not for distribution.
122 Learning Module 5 Time-Series Analysis
A key feature of the log-linear model’s depiction of time series, and a key feature of
time series in general, is that current-period values are related to previous-period
values. For example, Starbucks’ sales for the current period are related to its sales in
© CFA Institute. For candidate use only. Not for distribution.
AR Time-Series Models and Covariance-Stationary Series 123
the previous period. An autoregressive model (AR), a time series regressed on its
own past values, represents this relationship effectively. When we use this model, we
can drop the normal notation of y as the dependent variable and x as the independent
variable because we no longer have that distinction to make. Here we simply use xt.
For example, Equation 4 shows a first-order autoregression, AR(1), for the variable xt:
xt = b0 + b1xt−1 + εt. (4)
Thus, in an AR(1) model, we use only the most recent past value of xt to predict the
current value of xt. In general, a pth-order autoregression, AR(p), for the variable xt
is shown by
xt = b0 + b1xt−1 + b2xt−2 + . . . + bpxt–p + εt. (5)
In this equation, p past values of xt are used to predict the current value of xt. In the
next section, we discuss a key assumption of time-series models that include lagged
values of the dependent variable as independent variables.
Covariance-Stationary Series
Note that the independent variable (xt−1) in Equation 4 is a random variable. This fact
may seem like a mathematical subtlety, but it is not. If we use ordinary least squares to
estimate Equation 4 when we have a randomly distributed independent variable that
is a lagged value of the dependent variable, our statistical inference may be invalid. To
make a valid statistical inference, we must make a key assumption in time-series anal-
ysis: We must assume that the time series we are modeling is covariance stationary.1
What does it mean for a time series to be covariance stationary? The basic idea is
that a time series is covariance stationary if its properties, such as mean and variance,
do not change over time. A covariance stationary series must satisfy three principal
requirements. First, the expected value of the time series must be constant and finite
in all periods: E(yt) = μ and |μ | < ∞, t = 1, 2, . . . , T (for this first requirement, we use
the absolute value to rule out the case in which the mean is negative without limit—i.e.,
minus infinity). Second, the variance of the time series must be constant and finite in
all periods. Third, the covariance of the time series with itself for a fixed number of
periods in the past or future must be constant and finite in all periods. The second
and third requirements can be summarized as follows:
cov(yt, yt–s) = λs; |λs| < ∞; t = 1, 2, . . . , T; s = 0, ±1, ±2, . . . , ±T,
where λ signifies a constant. (Note that when s in this equation equals 0, this equa-
tion imposes the condition that the variance of the time series is finite, because the
covariance of a random variable with itself is its variance: cov(yt, yt) = var(yt).) What
happens if a time series is not covariance stationary but we model it using Equation 4?
The estimation results will have no economic meaning. For a non-covariance-stationary
time series, estimating the regression in Equation 4 will yield spurious results. In
particular, the estimate of b1 will be biased, and any hypothesis tests will be invalid.
How can we tell if a time series is covariance stationary? We can often answer this
question by looking at a plot of the time series. If the plot shows roughly the same
mean and variance over time without any significant seasonality, then we may want
to assume that the time series is covariance stationary.
Some of the time series we looked at in the exhibits appear to be covariance sta-
tionary. For example, the inflation data shown in Exhibit 3 appear to have roughly
the same mean and variance over the sample period. Many of the time series one
1 “Weakly stationary” is a synonym for covariance stationary. Note that the terms “stationary” and “sta-
tionarity” are often used to mean “covariance stationary” or “covariance stationarity,” respectively. You may
also encounter the more restrictive concept of “strictly” stationary, which has little practical application.
For details, see Diebold (2008).
© CFA Institute. For candidate use only. Not for distribution.
124 Learning Module 5 Time-Series Analysis
encounters in business and investments, however, are not covariance stationary. For
example, many time series appear to grow (or decline) steadily over time and thus
have a mean that is nonconstant, which implies that they are nonstationary. As an
example, the time series of quarterly sales in Exhibit 8 clearly shows the mean increas-
ing as time passes. Thus, Starbucks’ quarterly sales are not covariance stationary (in
general, any time series accurately described with a linear or log-linear trend model
is not covariance stationary, although a transformation of the original series might be
covariance stationary). Macroeconomic time series such as those relating to income
and consumption are often strongly trending as well. A time series with seasonality
(regular patterns of movement with the year) also has a nonconstant mean, as do
other types of time series that we discuss later (in particular, random walks are not
covariance stationary).
Exhibit 2 showed that monthly retail sales (not seasonally adjusted) are also not
covariance stationary. Sales in December are always much higher than sales in other
months (these are the regular large peaks), and sales in January are always much lower
(these are the regular large drops after the December peaks). On average, sales also
increase over time, so the mean of sales is not constant.
Later we will show that we can often transform a nonstationary time series into a
stationary time series. But whether a stationary time series is original or transformed,
a warning is necessary: Stationarity in the past does not guarantee stationarity in the
future. There is always the possibility that a well-specified model will fail when the
state of the world changes and yields a different underlying model that generates the
time series.
We can estimate an autoregressive model using ordinary least squares if the time
series is covariance stationary and the errors are uncorrelated. Unfortunately, our
previous test for serial correlation, the Durbin–Watson statistic, is invalid when the
independent variables include past values of the dependent variable. Therefore, for
most time-series models, we cannot use the Durbin–Watson statistic. Fortunately, we
can use other tests to determine whether the errors in a time-series model are serially
correlated. One such test reveals whether the autocorrelations of the error term are
significantly different from 0. This test is a t-test involving a residual autocorrelation
and the standard error of the residual autocorrelation. As background for the test,
we next discuss autocorrelation in general before moving to residual autocorrelation.
The autocorrelations of a time series are the correlations of that series with its
own past values. The order of the correlation is given by k, where k represents the
number of periods lagged. When k = 1, the autocorrelation shows the correlation of
the variable in one period with its occurrence in the previous period. For example,
the kth-order autocorrelation (ρk) is
© CFA Institute. For candidate use only. Not for distribution.
Detecting Serially Correlated Errors in an AR Model 125
where E stands for the expected value. Note that we have the relationship cov(xt,
xt–k) ≤ σ x2, with equality holding when k = 0. This means that the absolute value of ρk
is less than or equal to 1.
Of course, we can never directly observe the autocorrelations, ρk. Instead, we must
_
estimate them. Thus, we replace the expected value of xt, μ, with its estimated value, x ,
to compute the estimated autocorrelations. The kth-order estimated autocorrelation
of the time series xt, which we denote ρˆk, is
T _ _
∑ [(xt− x ) ( xt−k− x ) ]
ρˆk = ___________________
t=k+1
T .
_ 2
(xt− x )
∑
t=1
Analogous to the definition of autocorrelations for a time series, we can define the
autocorrelations of the error term for a time-series model as2
cov( εt, εt−k)
ρε,k = _
2
σε
E[ ( ε− 0)(ε − 0)]
_________________
=
t
2
t−k
σε
E( εtεt−k)
=_
2 .
σε
We assume that the expected value of the error term in a time-series model is 0.3
We can determine whether we are using the correct time-series model by test-
ing whether the autocorrelations of the error term (error autocorrelations) differ
significantly from 0. If they do, the model is not specified correctly. We estimate the
error autocorrelation using the sample autocorrelations of the residuals (residual
autocorrelations) and their sample variance.
A test of the null hypothesis that an error autocorrelation at a specified lag equals
0 is based on the residual autocorrelation _ for that lag and the standard error of the
residual correlation, which is equal to 1 / √T , where T is the number of observations
in the time series (Diebold 2008). Thus, if we have 100 observations in a time series,
the standard error for each of the estimated autocorrelations is 0.1. We can compute
the t-test of the null hypothesis that the error correlation at a particular lag equals _
0 by dividing the residual autocorrelation at that lag by its standard error ( 1 / √T ).
How can we use information about the error autocorrelations to determine
whether an autoregressive time-series model is correctly specified? We can use a
simple three-step method. First, estimate a particular autoregressive model—say, an
AR(1) model. Second, compute the autocorrelations of the residuals from the model.4
Third, test to see whether the residual autocorrelations differ significantly from 0. If
significance tests show that the residual autocorrelations differ significantly from 0,
2 Whenever we refer to autocorrelation without qualification, we mean autocorrelation of the time series
itself rather than autocorrelation of the error term or residuals.
3 This assumption is similar to the one made in earlier coverage of regression analysis about the expected
value of the error term.
4 We can compute these residual autocorrelations easily with most statistical software packages. In Microsoft
Excel, for example, to compute the first-order residual autocorrelation, we compute the correlation of the
residuals from Observations 1 through T − 1 with the residuals from Observations 2 through T.
© CFA Institute. For candidate use only. Not for distribution.
126 Learning Module 5 Time-Series Analysis
the model is not correctly specified; we may need to modify it in ways that we will
discuss shortly.5 We now present an example to demonstrate how this three-step
method works.
EXAMPLE 4
Regression Statistics
R2 0.5746
Standard error 0.03002
Observations 65
Durbin–Watson 1.743
Source: Bloomberg.
The first thing to note about Exhibit 12 is that both the intercept (b ˆ0=
ˆ1= 0.7462) of the gross margin
0.1513) and the coefficient on the first lag (b
are highly significant in the regression equation. The first lag of a time series
is the value of the time series in the previous period. The t-statistic for the
5 Often, econometricians use additional tests for the significance of residual autocorrelations. For example,
the Box–Pierce Q-statistic is frequently used to test the joint hypothesis that all autocorrelations of the
residuals are equal to 0. For further discussion, see Diebold (2008).
© CFA Institute. For candidate use only. Not for distribution.
Mean Reversion and Multiperiod Forecasts 127
intercept is about 3.2, whereas the t-statistic for the first lag of the gross
margin is more than 9. With 65 observations and two parameters, this
model has 63 degrees of freedom. At the 0.05 significance level, the critical
value for a t-statistic is about 2.0. Therefore, Jones must reject the null
hypotheses that the intercept is equal to 0 (b0 = 0) and the coefficient on the
first lag is equal to 0 (b1 = 0) in favor of the alternative hypothesis that the
coefficients, individually, are not equal to 0. But are these statistics valid?
Although the Durbin–Watson statistic is presented in Exhibit 12, it cannot
be used to test serial correlation when the independent variables include
past values of the dependent variable. The correct approach is to test
whether the residuals from this model are serially correlated.
At the bottom of Exhibit 12, the first four autocorrelations of the residual
are displayed along with the standard error and the t-statistic for each of
those autocorrelations.6 The sample has 65 _ observations, so the standard
error for each of the autocorrelations is 1 / √
65 = 0.1240. Exhibit 12 shows
that none of the first four autocorrelations has a t-statistic larger than 1.6818
in absolute value. Therefore, Jones can conclude that none of these autocor-
relations differs significantly from 0. Consequently, she can assume that the
residuals are not serially correlated and that the model is correctly specified,
and she can validly use ordinary least squares to estimate the parameters
and the parameters’ standard errors in the autoregressive model (for other
tests for serial correlation of residuals, see Diebold 2008).
Now that Jones has concluded that this model is correctly specified, how
can she use it to predict Intel’s gross margin in the next period? The estimat-
ed equation is Gross margint = 0.1513 + 0.7462(Gross margint−1) + εt. The
expected value of the error term is 0 in any period. Therefore, this model
predicts that gross margin in period t + 1 will be Gross margint+1 = 0.1513
+ 0.7462(Gross margint). For example, if gross margin is 55% in this quarter
(0.55), the model predicts that in the next quarter gross margin will increase
to 0.1513 + 0.7462(0.55) = 0.5617, or 56.17%. However, if gross margin is
currently 65% (0.65), the model predicts that in the next quarter, gross mar-
gin will fall to 0.1513 + 0.7462(0.65) = 0.6363, or 63.63%. As we show in the
following section, the model predicts that gross margin will increase if it is
below a certain level (59.61%) and decrease if it is above that level.
6 For seasonally unadjusted data, analysts often compute the same number of autocorrelations as there
are observations in a year (for example, four for quarterly data). The number of autocorrelations computed
also often depends on sample size, as discussed in Diebold (2008).
© CFA Institute. For candidate use only. Not for distribution.
128 Learning Module 5 Time-Series Analysis
We say that a time series shows mean reversion if it tends to fall when its level is
above its mean and rise when its level is below its mean. Much like the temperature in
a room controlled by a thermostat, a mean-reverting time series tends to return to its
long-term mean. How can we determine the value that the time series tends toward? If
a time series is currently at its mean-reverting level, then the model predicts that the
value of the time series will be the same in the next period. At its mean-reverting level,
we have the relationship xt+1 = xt. For an AR(1) model (xt+1 = b0 + b1xt), the equality
xt+1 = xt implies the level xt = b0 + b1xt or that the mean-reverting level, xt, is given by
b0
xt = _
1 − b .
1
So the AR(1) model predicts that the time series will stay the same if its current value
is b0/(1 − b1), increase if its current value is below b0/(1 − b1), and decrease if its
current value is above b0/(1 − b1).
In the case of gross margins for Intel, the mean-reverting level for the model
shown in Exhibit 12 is 0.1513/(1 − 0.7462) = 0.5961. If the current gross margin is
above 0.5961, the model predicts that the gross margin will fall in the next period. If
the current gross margin is below 0.5961, the model predicts that the gross margin
will rise in the next period. As we will discuss later, all covariance-stationary time
series have a finite mean-reverting level.
EXAMPLE 5
EXAMPLE 6
Regression Statistics
R2 0.1586
Standard error 2.9687
Observations 287
Durbin–Watson 1.8442
As Exhibit 13 shows, both the intercept (bˆ0= 1.3346) and the coefficient on
the first lagged value of inflation (bˆ1= 0.3984) are highly statistically significant,
with large t-statistics. With 287 observations and two parameters, this model
has 285 degrees of freedom. The critical value for a t-statistic at the 0.05 signif-
icance level is about 1.97. Therefore, Miller can reject the individual null hypoth-
eses that the intercept is equal to 0 (b0 = 0) and the coefficient on the first lag
is equal to 0 (b1 = 0) in favor of the alternative hypothesis that the coefficients,
individually, are not equal to 0.
Are these statistics valid? Miller will know when she tests whether the
residuals from this model are serially correlated. With 287 observations in _ this
sample, the standard error for each of the estimated autocorrelations is 1 / √ 287
= 0.0590. The critical value for the t-statistic is 1.97. Because the second esti-
mated autocorrelation has t-statistic larger than 1.97 in absolute value, Miller
concludes that the autocorrelations are significantly different from 0. This model
is thus misspecified because the residuals are serially correlated.
If the residuals in an autoregressive model are serially correlated, Miller
can eliminate the correlation by estimating an autoregressive model with more
lags of the dependent variable as explanatory variables. Exhibit 14 shows the
result of estimating a second time-series model, an AR(2) model using the
same data as in the analysis shown in Exhibit 13. With 286 observations and
three parameters, this model has 283 degrees of freedom. Because the degrees
of freedom are almost the same as those for the estimates shown in Exhibit 13,
the critical value of the t-statistic at the 0.05 significance level also is almost
the same (1.97). If she estimates the equation with two lags—Inflationt = b0 +
b1(Inflationt−1) + b2(Inflationt−2) + εt—Miller finds that all three of the coef-
ficients in the regression model (an intercept and the coefficients on two lags
of the dependent variable) differ significantly from 0. The bottom portion of
Exhibit 14 shows that none of the first four autocorrelations of the residual has
a t-statistic greater in absolute value than the critical value of 1.97. Therefore,
Miller fails to reject the hypothesis that the individual autocorrelations of the
residual equal 0. She concludes that this model is correctly specified because
she finds no evidence of serial correlation in the residuals.
Regression Statistics
R2 0.1907
Standard error 2.9208
© CFA Institute. For candidate use only. Not for distribution.
Comparing Forecast Model Performance 131
Regression Statistics
Observations 286
Durbin–Watson 1.9934
1. The analyst selected an AR(2) model because the residuals from the AR(1)
model were serially correlated. Suppose that in a given month, inflation
had been 4% at an annual rate in the previous month and 3% in the month
before that. What would be the difference in the analyst forecast of inflation
for that month if she had used an AR(1) model instead of the AR(2) model?
Solution:
The AR(1) model shown in Exhibit 13 predicted that inflation in the next
month would be 1.3346 + 0.3984(4) = 2.93%, approximately, whereas the
AR(2) model shown in Exhibit 14 predicts that inflation in the next month
will be 1.5996 + 0.4759(4) − 0.1964(3) = 2.91% approximately. If the analyst
had used the incorrect AR(1) model, she would have predicted inflation
to be 2 bps higher (2.93% versus 2.91%) than when using the AR(2) model.
Although in this case the difference in the predicted inflation is actually very
small, this kind of scenario illustrates that using an incorrect forecast could
adversely affect the quality of her company’s investment choices.
One way to compare the forecast performance of two models is to compare the vari-
ance of the forecast errors that the two models make. The model with the smaller
forecast error variance will be the more accurate model, and it will also have the
smaller standard error of the time-series regression. (This standard error usually is
reported directly in the output for the time-series regression.)
In comparing forecast accuracy among models, we must distinguish between
in-sample forecast errors and out-of-sample forecast errors. In-sample forecast
errors are the residuals from a fitted time-series model. For example, when we esti-
mated a linear trend with raw inflation data from January 1995 to December 2018, the
in-sample forecast errors were the residuals from January 1995 to December 2018.
If we use this model to predict inflation outside this period, the differences between
actual and predicted inflation are out-of-sample forecast errors.
EXAMPLE 7
Often, we want to compare the forecasting accuracy of different models after the
sample period for which they were estimated. We wish to compare the out-of-sample
forecast accuracy of the models. Out-of-sample forecast accuracy is important because
the future is always out of sample. Although professional forecasters distinguish
between out-of-sample and in-sample forecasting performance, many articles that
analysts read contain only in-sample forecast evaluations. Analysts should be aware that
out-of-sample performance is critical for evaluating a forecasting model’s real-world
contribution.
Typically, we compare the out-of-sample forecasting performance of forecasting
models by comparing their root mean squared error (RMSE), which is the square
root of the average squared error. The model with the smallest RMSE is judged the
most accurate. The following example illustrates the computation and use of RMSE
in comparing forecasting models.
© CFA Institute. For candidate use only. Not for distribution.
Comparing Forecast Model Performance 133
EXAMPLE 8
Exhibit 15: Out-of-Sample Forecast Error Comparisons: January 2019–September 2019 US CPI Inflation
(Annualized)
Date Infl(t) Infl(t−1) Infl(t−2) AR(1) Error Squared Error AR(2) Error Squared Error
2019
January 0.0000 0.0000 0.0000 0.1335 0.0178 −1.6000 2.5599
February 2.4266 0.0000 0.0000 −2.2931 5.2585 0.8266 0.6833
March 4.9070 2.4266 0.0000 −3.8068 14.4916 2.1522 4.6320
April 3.6600 4.9070 2.4266 −1.5716 2.4699 0.2014 0.0406
May 1.2066 3.6600 4.9070 0.3850 0.1482 −1.1714 1.3722
June 1.2066 1.2066 3.6600 −0.5924 0.3510 −0.2488 0.0619
July 3.6600 1.2066 1.2066 −3.0458 9.2770 1.7228 2.9680
August 1.2066 3.6600 1.2066 0.3850 0.1482 −1.8982 3.6030
September 0.0000 1.2066 3.6600 0.6142 0.3772 −1.4554 2.1181
Average 3.6155 Average 2.0043
RMSE 1.9014 RMSE 1.4157
Note: Any apparent discrepancies between error and squared error results are due to rounding.
One of the important issues an analyst faces in modeling a time series is the sample
period to use. The estimates of regression coefficients of the time-series model can
change substantially across different sample periods used for estimating the model.
Often, the regression coefficient estimates of a time-series model estimated using an
earlier sample period can be quite different from those of a model estimated using a
later sample period. Similarly, the estimates can be different between models estimated
using relatively shorter and longer sample periods. Further, the choice of model for a
particular time series can also depend on the sample period. For example, an AR(1)
model may be appropriate for the sales of a company in one particular sample period,
but an AR(2) model may be necessary for an earlier or later sample period (or for a
longer or shorter sample period). Thus, the choice of a sample period is an important
decision in modeling a financial time series.
Unfortunately, there is usually no clear-cut basis in economic or financial the-
ory for determining whether to use data from a longer or shorter sample period to
estimate a time-series model. We can get some guidance, however, if we remember
that our models are valid only for covariance-stationary time series. For example, we
should not combine data from a period when exchange rates were fixed with data
from a period when exchange rates were floating. The exchange rates in these two
periods would not likely have the same variance because exchange rates are usually
much more volatile under a floating-rate regime than when rates are fixed. Similarly,
many US analysts consider it inappropriate to model US inflation or interest-rate
behavior since the 1960s as a part of one sample period, because the Federal Reserve
had distinct policy regimes during this period. A simple way to determine appropriate
samples for time-series estimation is to look at graphs of the data to see whether the
time series looks stationary before estimation begins. If we know that a government
policy changed on a specific date, we might also test whether the time-series relation
was the same before and after that date.
In the following example, we illustrate how the choice of a longer versus a shorter
period can affect the decision of whether to use, for example, a first- or second-order
time-series model. We then show how the choice of the time-series model (and the
associated regression coefficients) affects our forecast. Finally, we discuss which sample
period, and accordingly which model and corresponding forecast, is appropriate for
the time series analyzed in the example.
EXAMPLE 9
starting in 2008. Because of his suggestion, Miller first estimates an AR(1) model
for inflation using data for a sample period from 2008 to 2018. Exhibit 16 shows
her AR(1) estimates.
Regression Statistics
R2 0.2536
Standard error 3.0742
Observations 132
Durbin–Watson 1.8164
data have more than one regime and Miller should estimate a separate model for
inflation from 2009 to 2018, as shown previously. In fact, the standard deviation
of annualized monthly inflation rates is just 2.86% for 1995–2007 but 3.54% for
2008–2018, largely because of volatility during the 2008 crisis. As the example
shows, experience (such as knowledge of government policy changes) and judg-
ment play a vital role in determining how to model a time series. Simply relying
on autocorrelations of the residuals from a time-series model cannot tell us the
correct sample period for our analysis.
25
20
15
10
–5
–10
–15
–20
–25
Jan/95 May/99 Sep/03 Jan/08 May/12 Sep/16
10 RANDOM WALKS
So far, we have examined those time series in which the time series has a tendency
to revert to its mean level as the change in a variable from one period to the next
follows a mean-reverting pattern. In contrast, there are many financial time series in
which the changes follow a random pattern. We discuss these “random walks” in the
following section.
Random Walks
A random walk is one of the most widely studied time-series models for financial
data. A random walk is a time series in which the value of the series in one period
is the value of the series in the previous period plus an unpredictable random error.
A random walk can be described by the following equation:
© CFA Institute. For candidate use only. Not for distribution.
Random Walks 137
xt = xt−1+ εt, E( εt) = 0, E( εt2) = σ2, cov( εt, εs ) = E( εtε s )
= 0 if t ≠ s. (8)
Equation 8 means that the time series xt is in every period equal to its value in the
previous period plus an error term, εt, that has constant variance and is uncorrelated
with the error term in previous periods. Note two important points. First, this equa-
tion is a special case of an AR(1) model with b0 = 0 and b1 = 1.7 Second, the expected
value of εt is zero. Therefore, the best forecast of xt that can be made in period t − 1
is xt−1. In fact, in this model, xt−1 is the best forecast of x in every period after t − 1.
Random walks are quite common in financial time series. For example, many
studies have tested whether and found that currency exchange rates follow a random
walk. Consistent with the second point made in the previous paragraph, some studies
have found that sophisticated exchange rate forecasting models cannot outperform
forecasts made using the random walk model and that the best forecast of the future
exchange rate is the current exchange rate.
Unfortunately, we cannot use the regression methods we have discussed so far to
estimate an AR(1) model on a time series that is actually a random walk. To see why
this is so, we must determine why a random walk has no finite mean-reverting level
or finite variance. Recall that if xt is at its mean-reverting level, then xt = b0 + b1xt, or
xt = b0/(1 − b1). In a random walk, however, b0 = 0 and b1 = 1, so b0/(1 − b1) = 0/0.
Therefore, a random walk has an undefined mean-reverting level.
What is the variance of a random walk? Suppose that in Period 1, the value of x1 is
0. Then we know that x2 = 0 + ε2. Therefore, the variance of x2 = var(ε2) = σ2. Now x3 =
x2 + ε3 = ε2 + ε3. Because the error term in each period is assumed to be uncorrelated
with the error terms in all other periods, the variance of x3 = var(ε2) + var(ε3) = 2σ2.
By a similar argument, we can show that for any period t, the variance of xt = (t − 1)
σ2. But this means that as t grows large, the variance of xt grows without an upper
bound: It approaches infinity. This lack of upper bound, in turn, means that a random
walk is not a covariance-stationary time series, because a covariance-stationary time
series must have a finite variance.
What is the practical implication of these issues? We cannot use standard regression
analysis on a time series that is a random walk. We can, however, attempt to convert
the data to a covariance-stationary time series if we suspect that the time series is a
random walk. In statistical terms, we can difference it.
We difference a time series by creating a new time series—say, yt—that in each
period is equal to the difference between xt and xt−1. This transformation is called
first-differencing because it subtracts the value of the time series in the first prior
period from the current value of the time series. Sometimes the first difference of
xt is written as Δxt = xt − xt−1. Note that the first difference of the random walk in
Equation 8 yields
yt = xt− xt−1 = ε t, E( εt) = 0, E( εt2) = σ2, cov( εt, ε s ) = E( εtεs )
= 0 for t ≠ s.
The expected value of εt is 0. Therefore, the best forecast of yt that can be made
in period t − 1 is 0. This implies that the best forecast is that there will be no change
in the value of the current time series, xt−1.
The first-differenced variable, yt, is covariance stationary. How is this so? First, note
that this model (yt = εt) is an AR(1) model with b0 = 0 and b1 = 0. We can compute the
mean-reverting level of the first-differenced model as b0/(1 − b1) = 0/1 = 0. Therefore,
a first-differenced random walk has a mean-reverting level of 0. Note also that the
variance of yt in each period is var(εt) = σ2. Because the variance and the mean of yt
7 Equation 8 with a nonzero intercept added (as in Equation 9, given later) is sometimes referred to as a
random walk with drift.
© CFA Institute. For candidate use only. Not for distribution.
138 Learning Module 5 Time-Series Analysis
are constant and finite in each period, yt is a covariance-stationary time series and we
can model it using linear regression. Of course, modeling the first-differenced series
with an AR(1) model does not help us predict the future, because b0 = 0 and b1 = 0.
We simply conclude that the original time series is, in fact, a random walk.
Had we tried to estimate an AR(1) model for a time series that was a random walk,
our statistical conclusions would have been incorrect because AR models cannot be
used to estimate random walks or any time series that is not covariance stationary.
The following example illustrates this issue with exchange rates.
EXAMPLE 10
1. Financial analysts often assume that exchange rates are random walks. Con-
sider an AR(1) model for the Japanese yen/US dollar exchange rate (JPY/
USD). Exhibit 18 shows the results of estimating the model using month-
end observations from October 1980 through August 2019.
Regression Statistics
R2 0.9897
Standard error 4.5999
Observations 467
Durbin–Watson 1.9391
The results in Exhibit 18 suggest that the yen/US dollar exchange rate is a
random walk because the estimated intercept does not appear to be signifi-
cantly different from 0 and the estimated coefficient on the first lag of the
exchange rate is very close to 1. Can we use the t-statistics in Exhibit 18 to
test whether the exchange rate is a random walk? Unfortunately, no, because
the standard errors in an AR model are invalid if the model is estimated
using a data series that is a random walk (remember, a random walk is not
covariance stationary). If the exchange rate is, in fact, a random walk, we
might come to an incorrect conclusion based on faulty statistical tests and
© CFA Institute. For candidate use only. Not for distribution.
Random Walks 139
then invest incorrectly. We can use a test presented in the next section to
test whether the time series is a random walk.
Suppose the exchange rate is a random walk, as we now suspect. If so, the
first-differenced series, yt = xt − xt−1, will be covariance stationary. We
present the results from estimating yt = b0 + b1yt−1 + εt in Exhibit 19. If the
exchange rate is a random walk, then b0 = 0, b1 = 0, and the error term will
not be serially correlated.
Regression Statistics
R2 0.0008
Standard error 4.6177
Observations 466
Durbin–Watson 2.0075
In Exhibit 19, neither the intercept nor the coefficient on the first lag of the
first-differenced exchange rate differs significantly from 0, and no residual
autocorrelations differ significantly from 0. These findings are consistent
with the yen/US dollar exchange rate being a random walk.
rate over the previous month. If they cannot be predicted, the R2 in Exhibit
19 should be very low. In fact, it is low (0.0008). This comparison provides a
good example of the general rule that we cannot necessarily choose which
model is correct solely by comparing the R2 from the two models.
The exchange rate is a random walk, and changes in a random walk are by
definition unpredictable. Therefore, we cannot profit from an investment
strategy that predicts changes in the exchange rate.
To this point, we have discussed only simple random walks—that is, random walks
without drift. In a random walk without drift, the best predictor of the time series
in the next period is its current value. A random walk with drift, however, should
increase or decrease by a constant amount in each period. The equation describing a
random walk with drift is a special case of the AR(1) model:
x t = b 0 + b1 x t−1+ εt,
b
1 = 1, b0 ≠ 0, or (9)
xt = b 0 + xt−1+ εt, E( εt) = 0.
A random walk with drift has b0 ≠ 0, compared to a simple random walk, which
has b0 = 0.
We have already seen that b1 = 1 implies an undefined mean-reversion level and
thus nonstationarity. Consequently, we cannot use an AR model to analyze a time
series that is a random walk with drift until we transform the time series by taking
first differences. If we first-difference Equation 9, the result is yt = xt − xt−1, yt = b0
+ εt, b0 ≠ 0.
In this section, we discuss how to use random walk concepts to determine whether a
time series is covariance stationary. This approach focuses on the slope coefficient in
the random-walk-with-drift case of an AR(1) model in contrast with the traditional
autocorrelation approach, which we discuss first.
The examination of the autocorrelations of a time series at various lags is a
well-known prescription for inferring whether or not a time series is stationary.
Typically, for a stationary time series, either autocorrelations at all lags are statistically
indistinguishable from zero or the autocorrelations drop off rapidly to zero as the
number of lags becomes large. Conversely, the autocorrelations of a nonstationary
time series do not exhibit those characteristics. However, this approach is less definite
than a currently more popular test for nonstationarity known as the Dickey–Fuller
test for a unit root.
We can explain what is known as the unit root problem in the context of an AR(1)
model. If a time series comes from an AR(1) model, then to be covariance stationary,
the absolute value of the lag coefficient, b1, must be less than 1.0. We could not rely
© CFA Institute. For candidate use only. Not for distribution.
The Unit Root Test of Nonstationarity 141
on the statistical results of an AR(1) model if the absolute value of the lag coefficient
were greater than or equal to 1.0 because the time series would not be covariance
stationary. If the lag coefficient is equal to 1.0, the time series has a unit root: It is
a random walk and is not covariance stationary (note that when b1 is greater than 1
in absolute value, we say that there is an “explosive root”). By definition, all random
walks, with or without a drift term, have unit roots.
How do we test for unit roots in a time series? If we believed that a time series, xt,
was a random walk with drift, it would be tempting to estimate the parameters of the
AR(1) model xt = b0 + b1xt−1 + εt using linear regression and conduct a t-test of the
hypothesis that b1 = 1. Unfortunately, if b1 = 1, then xt is not covariance stationary and
the t-value of the estimated coefficient, bˆ1, does not actually follow the t-distribution;
consequently, a t-test would be invalid.
Dickey and Fuller (1979) developed a regression-based unit root test based on a
transformed version of the AR(1) model xt = b0 + b1xt−1 + εt. Subtracting xt−1 from
both sides of the AR(1) model produces
xt − xt−1 = b0 + (b1 − 1)xt−1 + εt,
or
xt − xt−1 = b0 + g1xt−1 + εt, E(εt) = 0, (10)
where g1 = (b1 − 1). If b1 = 1, then g1 = 0 and thus a test of g1 = 0 is a test of b1 =
1. If there is a unit root in the AR(1) model, then g1 will be 0 in a regression where
the dependent variable is the first difference of the time series and the independent
variable is the first lag of the time series. The null hypothesis of the Dickey–Fuller test
is H0: g1 = 0—that is, that the time series has a unit root and is nonstationary—and
the alternative hypothesis is Ha: g1 < 0, that the time series does not have a unit root
and is stationary.
To conduct the test, one calculates a t-statistic in the conventional manner for ˆ g 1
but instead of using conventional critical values for a t-test, one uses a revised set
of values computed by Dickey and Fuller; the revised critical values are larger in
absolute value than the conventional critical values. A number of software packages
incorporate Dickey–Fuller tests.
EXAMPLE 11
(Historical Example)
AstraZeneca’s Quarterly Sales (1)
In January 2012, equity analyst Aron Berglin is building a time-series model
for the quarterly sales of AstraZeneca, a British/Swedish biopharmaceutical
company headquartered in London. He is using AstraZeneca’s quarterly sales
in US dollars for January 2000 to December 2011 and any lagged sales data that
he may need prior to 2000 to build this model. He finds that a log-linear trend
model seems better suited for modeling AstraZeneca’s sales than does a linear
trend model. However, the Durbin–Watson statistic from the log-linear regres-
sion is just 0.7064, which causes him to reject the hypothesis that the errors in
the regression are serially uncorrelated. He concludes that he cannot model the
log of AstraZeneca’s quarterly sales using only a time trend line. He decides to
model the log of AstraZeneca’s quarterly sales using an AR(1) model. He uses
ln Salest = b0 + b1(ln Salest−1) + εt.
Before he estimates this regression, the analyst should use the Dickey–Fuller
test to determine whether there is a unit root in the log of AstraZeneca’s quarterly
sales. If he uses the sample of quarterly data on AstraZeneca’s sales from the
first quarter of 2000 through the fourth quarter of 2011, takes the natural log
© CFA Institute. For candidate use only. Not for distribution.
142 Learning Module 5 Time-Series Analysis
of each observation, and computes the Dickey–Fuller t-test statistic, the value
of that statistic might cause him to fail to reject the null hypothesis that there
is a unit root in the log of AstraZeneca’s quarterly sales.
If a time series appears to have a unit root, how should we model it? One method
that is often successful is to model the first-differenced series as an autoregressive
time series. The following example demonstrates this method.
EXAMPLE 12
Ln ($ millions)
10,000
8,000
6,000
4,000
2,000
0
00 02 04 06 08 10 12
Year
Source: Compustat.
So he creates a new series, yt, that is the first difference of the log of
AstraZeneca’s quarterly sales. Exhibit 21 shows that series.
Berglin compares Exhibit 21 to Exhibit 20 and notices that first-differencing
the log of AstraZeneca’s quarterly sales eliminates the strong upward trend that
was present in the log of AstraZeneca’s sales. Because the first-differenced series
has no strong trend, Berglin is better off assuming that the differenced series is
covariance stationary rather than assuming that AstraZeneca’s sales or the log
of AstraZeneca’s sales is a covariance-stationary time series.
© CFA Institute. For candidate use only. Not for distribution.
The Unit Root Test of Nonstationarity 143
Ln Difference
0.2
0.1
–0.1
–0.2
00 02 04 06 08 10 12
Year
Source: Compustat.
Now suppose Berglin decides to model the new series using an AR(1) model.
Berglin uses ln(Salest) − ln(Salest−1) = b0 + b1[ln(Salest−1) − ln(Salest−2)] + εt.
Exhibit 22 shows the results of that regression.
Regression Statistics
R2 0.3005
Standard error 0.0475
Observations 48
Durbin–Watson 1.6874
Source: Compustat.
The lower part of Exhibit 22 suggests that the first four autocorrelations of
residuals in this model are not statistically significant. With 48 observations
and two parameters, this model has 46 degrees of freedom. The critical value
for a t-statistic in this model is above 2.0 at the 0.05 significance level. None of
the t-statistics for these autocorrelations has an absolute value larger than 2.0.
© CFA Institute. For candidate use only. Not for distribution.
144 Learning Module 5 Time-Series Analysis
Therefore, we fail to reject the null hypotheses that each of these autocorrela-
tions is equal to 0 and conclude instead that no significant autocorrelation is
present in the residuals.
This result suggests that the model is well specified and that we could use
the estimates. Both the intercept (bˆ0= 0.0222) and the coefficient (b
ˆ1= −0.5493)
on the first lag of the new first-differenced series are statistically significant.
Solution:
The value of the intercept (0.0222) implies that if sales have not changed in
the current quarter (yt = ln Salest − ln Salest−1 = 0), sales will grow by 2.22%
next quarter.8 If sales have changed during this quarter, however, the model
predicts that sales will grow by 2.22% minus 0.5493 times the sales growth in
this quarter.
2. AstraZeneca’s sales in the third and fourth quarters of 2011 were $8,405
million and $8,872 million, respectively. If we use the previous model soon
after the end of the fourth quarter of 2011, what will be the predicted value
of AstraZeneca’s sales for the first quarter of 2012?
Solution:
Let us say that t is the fourth quarter of 2011, so t − 1 is the third quarter
of 2011 and t + 1 is the first quarter of 2012. Then we would have to com-
pute ˆ
y t+1= 0.0222 − 0.5493yt. To compute ˆ y t+1, we need to know yt = ln
Salest − ln Salest−1. In the third quarter of 2011, AstraZeneca’s sales were
$8,405 million, so ln Salest−1 = ln 8,405 = 9.0366. In the fourth quarter
of 2011, AstraZeneca’s sales were $8,872 million, so ln Salest = ln 8,872
= 9.0907. Thus yt = 9.0907 − 9.0366 = 0.0541. Therefore, ˆ y t+1= 0.0222 −
0.5493(0.0541) = −0.0075. If ˆ y t+1= −0.0075, then −0.0075 = ln Salest+1 − ln
Salest = ln(Salest+1/Salest). If we exponentiate both sides of this equation,
the result is
8 Note that 2.22 percent is the exponential growth rate, not [(Current quarter sales/Previous quarter sales)
− 1]. The difference between these two methods of computing growth is usually small.
© CFA Institute. For candidate use only. Not for distribution.
Moving-Average Time-Series Models 145
EXAMPLE 13
We often plot the moving average of a series with large fluctuations to help discern
any patterns in the data. Exhibit 23 shows monthly retail sales for the United States
from December 1995 to June 2019, along with a 12-month moving average of the
data (data from January 1995 are used to compute the 12-month moving average).
© CFA Institute. For candidate use only. Not for distribution.
146 Learning Module 5 Time-Series Analysis
Exhibit 23: Monthly US Real Retail Sales and 12-Month Moving Average of
Retail Sales
600,000
500,000
400,000
300,000
200,000
100,000
0
Dec/95 Dec/98 Dec/01 Dec/04 Dec/07 Dec/10 Dec/13 Dec/17
As Exhibit 23 shows, each year has a very strong peak in retail sales (December)
followed by a sharp drop in sales (January). Because of the extreme seasonality in the
data, a 12-month moving average can help us focus on the long-term movements
in retail sales instead of seasonal fluctuations. Note that the moving average does
not have the sharp seasonal fluctuations of the original retail sales data. Rather, the
moving average of retail sales grows steadily—for example, from 1995 through the
second half of 2008—and then declines for about a year and grows steadily thereafter.
We can see that trend more easily by looking at a 12-month moving average than by
looking at the time series itself.
Exhibit 24 shows monthly Europe Brent Crude Oil spot prices along with a
12-month moving average of oil prices. Although these data do not have the same
sharp regular seasonality displayed in the retail sales data in Exhibit 23, the moving
average smooths out the monthly fluctuations in oil prices to show the longer-term
movements.
© CFA Institute. For candidate use only. Not for distribution.
Moving-Average Time-Series Models 147
Exhibit 24: Monthly Europe Brent Crude Oil Price and 12-Month Moving
Average of Prices
140
120
100
80
60
40
20
0
Jan/97 Oct/99 Jul/02 Apr/05 Jan/08 Oct/10 Jul/13 Apr/16 Jan/19
Exhibit 24 also shows one weakness with a moving average: It always lags large
movements in the actual data. For example, when oil prices rose quickly in late 2007
and the first half of 2008, the moving average rose only gradually. When oil prices
fell sharply toward the end of 2008, the moving average also lagged. Consequently,
a simple moving average of the recent past, though often useful in smoothing out a
time series, may not be the best predictor of the future. A main reason for this is that
a simple moving average gives equal weight to all the periods in the moving average.
In order to forecast the future values of a time series, it is often better to use a more
sophisticated moving-average time-series model. We discuss such models below.
9 Note that a moving-average time-series model is very different from a simple moving average, as
discussed in Section 6.1. The simple moving average is based on observed values of a time series. In a
moving-average time-series model, we never directly observe εt or any other εt–j, but we can infer how a
particular moving-average model will imply a particular pattern of serial correlation for a time series, as
we will discuss.
© CFA Institute. For candidate use only. Not for distribution.
148 Learning Module 5 Time-Series Analysis
We can see if a time series fits an MA(1) model by looking at its autocorrelations
to determine whether xt is correlated only with its preceding and following values.
First, we examine the variance of xt in Equation 12 and its first two autocorrelations.
Because the expected value of xt is 0 in all periods and εt is uncorrelated with its own
past values, the first autocorrelation is not equal to 0, but the second and higher auto-
correlations are equal to 0. Further analysis shows that all autocorrelations except for
the first will be equal to 0 in an MA(1) model. Thus for an MA(1) process, any value
xt is correlated with xt−1 and xt+1 but with no other time-series values; we could say
that an MA(1) model has a memory of one period.
Of course, an MA(1) model is not the most complex moving-average model. A
qth-order moving-average model, denoted MA(q) and with varying weights on lagged
terms, can be written as
xt = ε t+ θ1 εt−1+ ⋯ + θq εt−q, E( εt) = 0, E( εt2) = σ 2,
(13)
cov( εt, εs ) = E( εtεs ) = 0 for t ≠ s.
How can we tell whether an MA(q) model fits a time series? We examine the auto-
correlations. For an MA(q) model, the first q autocorrelations will be significantly
different from 0, and all autocorrelations beyond that will be equal to 0; an MA(q)
model has a memory of q periods. This result is critical for choosing the right value
of q for an MA model. We discussed this result previously for the specific case of q =
1 that all autocorrelations except for the first will be equal to 0 in an MA(1) model.
How can we distinguish an autoregressive time series from a moving-average time
series? Once again, we do so by examining the autocorrelations of the time series
itself. The autocorrelations of most autoregressive time series start large and decline
gradually, whereas the autocorrelations of an MA(q) time series suddenly drop to 0
after the first q autocorrelations. We are unlikely to know in advance whether a time
series is autoregressive or moving average. Therefore, the autocorrelations give us our
best clue about how to model the time series. Most time series, however, are best
modeled with an autoregressive model.
EXAMPLE 14
(Historical Example)
A Time-Series Model for Monthly Returns on the S&P BSE
100 Index
The S&P BSE 100 Index is designed to reflect the performance of India’s top 100
large-cap companies listed on the BSE Ltd. (formerly Bombay Stock Exchange).
Are monthly returns on the S&P BSE 100 Index autocorrelated? If so, we may
be able to devise an investment strategy to exploit the autocorrelation. What is
an appropriate time-series model for S&P BSE 100 monthly returns?
Exhibit 25 shows the first six autocorrelations of returns to the S&P BSE 100
using monthly data from January 2000 through December 2013. Note that all
of the autocorrelations are quite small. Do they reach significance? With 168
observations, the critical value for a t-statistic in this model is about 1.98 at
the 0.05 significance level. None of the autocorrelations has a t-statistic larger
in absolute value than the critical value of 1.98. Consequently, we fail to reject
the null hypothesis that those autocorrelations, individually, do not differ sig-
nificantly from 0.
© CFA Institute. For candidate use only. Not for distribution.
Seasonality in Time-Series Models 149
Autocorrelations
Lag Autocorrelation Standard Error t-Statistic
1 0.1103 0.0772 1.4288
2 −0.0045 0.0772 −0.0583
3 0.0327 0.0772 0.4236
4 0.0370 0.0772 0.4793
5 −0.0218 0.0772 −0.2824
6 0.0191 0.0772 0.2474
Observations 168
10 On the basis of investment theory and evidence, we expect that the mean monthly return on the S&P
BSE 100 is positive (μ > 0). We can also generalize Equation 13 for an MA(q) time series by adding a
constant term, μ. Including a constant term in a moving-average model does not change the expressions
for the variance and autocovariances of the time series. A number of early studies of weak-form market
efficiency used Equation 14 as the model for stock returns. See Garbade (1982).
© CFA Institute. For candidate use only. Not for distribution.
150 Learning Module 5 Time-Series Analysis
EXAMPLE 15
1. Earlier, we concluded that we could not model the log of Starbucks’ quar-
terly sales using only a time-trend line (as shown in Example 3) because the
Durbin–Watson statistic from the regression provided evidence of positive
serial correlation in the error term. Based on methods presented in this
reading, we might next investigate using the first difference of log sales to
remove an exponential trend from the data to obtain a covariance-stationary
time series.
Using quarterly data from the last quarter of 2001 to the second quarter of
2019, we estimate the following AR(1) model using ordinary least squares:
(ln Salest − ln Salest−1) = b0 + b1(ln Salest−1 − ln Salest−2) + εt. Exhibit 26
shows the results of the regression.
Regression Statistics
R2 0.2044
Standard error 0.0611
© CFA Institute. For candidate use only. Not for distribution.
Seasonality in Time-Series Models 151
Regression Statistics
Observations 72
Durbin–Watson 1.9904
Source: Bloomberg.
11 In this example, we restrict the start of the sample period to the beginning of 2001, and we do not use
prior observations for the lags. Accordingly, the number of observations decreases with an increase in the
number of lags. In Exhibit 26, the first observation is for the third quarter of 2001 because we use up to two
lags. In Exhibit 27, the first observation is for the second quarter of 2002 because we use up to five lags.
© CFA Institute. For candidate use only. Not for distribution.
152 Learning Module 5 Time-Series Analysis
Exhibit 27: Log Differenced Sales: AR(1) Model with Seasonal Lag—
Starbucks, Quarterly Observations, 2005–2019
Regression Statistics
R2 0.7032
Standard error 0.0373
Observations 69
Durbin–Watson 2.0392
Source: Compustat.
Note the autocorrelations of the residual shown at the bottom of Exhibit 27.
None of the t-statistics on the first four autocorrelations is now significant.
Because the overall regression is highly significant (an F-test, not shown in
the exhibit, is significant at the 0.01 level), we can take an AR(1) model with
a seasonal lag as a reasonable working model for Starbucks sales. (A model
having only a seasonal lag term was investigated and not found to improve
on this model.)
How can we interpret the coefficients in this model? To predict the cur-
rent quarter’s sales growth at Starbucks, we need to know two things: sales
growth in the previous quarter and sales growth four quarters ago. If sales
remained constant in each of those two quarters, the model in Exhibit 27
would predict that sales will grow by 0.0107 (1.07%) in the current quarter.
If sales grew by 1% last quarter and by 2% four quarters ago, then the model
would predict that sales growth this quarter will be 0.0107 − 0.0154(0.01) +
0.7549(0.02) = 0.0256, or 2.56%. Note that all of these growth rates are expo-
nential growth rates. Notice also that the R2 in the model with the seasonal
lag (0.7032 in Exhibit 27) was more than three times higher than the R2 in
the model without the seasonal lag (0.2044 in Exhibit 26). Again, the season-
al lag model does a much better job of explaining the data.
© CFA Institute. For candidate use only. Not for distribution.
Seasonality in Time-Series Models 153
EXAMPLE 16
(Historical Example)
Retail Sales Growth
We want to predict the growth in monthly retail sales of Canadian furniture
and home furnishing stores so that we can decide whether to recommend the
shares of these stores. We decide to use non-seasonally adjusted data on retail
sales. To begin with, we estimate an AR(1) model with observations on the
annualized monthly growth in retail sales from January 1995 to December 2012.
We estimate the following equation: Sales growtht = b0 + b1(Sales growtht−1) +
εt. Exhibit 28 shows the results from this model.
The autocorrelations of the residuals from this model, shown at the bottom of
Exhibit 28, indicate that seasonality is extremely significant in this model. With
216 observations and two parameters, this model has 214 degrees of freedom.
At the 0.05 significance level, the critical value for a t-statistic is about 1.97. The
12th-lag autocorrelation (the seasonal autocorrelation, because we are using
monthly data) has a value of 0.7620 and a t-statistic of 11.21. The t-statistic on
this autocorrelation is larger than the critical value (1.97), implying that we can
reject the null hypothesis that the 12th autocorrelation is 0. Note also that many
of the other t-statistics for autocorrelations shown in the table differ significantly
from 0. Consequently, the model shown in Exhibit 28 is misspecified, so we
cannot rely on it to forecast sales growth.
Suppose we add the seasonal lag of sales growth (the 12th lag) to the AR(1)
model to estimate the equation Sales growtht = b0 + b1(Sales growtht−1) +
b2(Sales growtht−12) + εt. In this example, although we state that the sample
period begins in 1995, we use prior observations for the lags. This results in
the same number of observations irrespective of the number of lags. Exhibit
29 presents the results of estimating this equation. The estimated value of the
seasonal autocorrelation (the 12th autocorrelation) has fallen to −0.1168. None
of the first 12 autocorrelations has a t-statistic with an absolute value greater
than the critical value of 1.97 at the 0.05 significance level. We can conclude that
there is no significant serial correlation in the residuals from this model. Because
we can reasonably believe that the model is correctly specified, we can use it to
predict retail sales growth. Note that the R2 in Exhibit 29 is 0.6724, much larger
than the R2 in Exhibit 28 (computed by the model without the seasonal lag).
Regression Statistics
R2 0.0509
Standard error 1.8198
© CFA Institute. For candidate use only. Not for distribution.
154 Learning Module 5 Time-Series Analysis
Regression Statistics
Observations 216
Durbin–Watson 2.0956
Regression Statistics
R2 0.6724
Standard error 1.0717
© CFA Institute. For candidate use only. Not for distribution.
AR Moving-Average Models and ARCH Models 155
Regression Statistics
Observations 216
Durbin–Watson 2.1784
12 For the returns on the S&P BSE 100 (see Example 14), we chose a moving-average model over an
autoregressive model.
© CFA Institute. For candidate use only. Not for distribution.
156 Learning Module 5 Time-Series Analysis
than do plain autoregressive (AR) models. However, as we discuss later in this section,
there are severe limitations to estimating and using these models. Because you may
encounter ARMA models, we next provide a brief overview.
An ARMA model combines both autoregressive lags of the dependent variable and
moving-average errors. The equation for such a model with p autoregressive terms
and q moving-average terms, denoted ARMA(p, q), is
xt = b 0 + b1 x t−1+ ⋯ + bp xt−p+ εt+ θ1 εt−1+ ⋯ + θq εt−q,
(16)
E( εt) = 0, E( εt2) = σ2, cov( εt, εs ) = E( εtεs ) = 0 for t ≠ s,
where b1, b2, . . . , bp are the autoregressive parameters and θ1, θ2, . . . , θq are the
moving-average parameters.
Estimating and using ARMA models has several limitations. First, the parameters
in ARMA models can be very unstable. In particular, slight changes in the data sample
or the initial guesses for the values of the ARMA parameters can result in very different
final estimates of the ARMA parameters. Second, choosing the right ARMA model
is more of an art than a science. The criteria for deciding on p and q for a particular
time series are far from perfect. Moreover, even after a model is selected, that model
may not forecast well.
To reiterate, ARMA models can be very unstable, depending on the data sample
used and the particular ARMA model estimated. Therefore, you should be skeptical
of claims that a particular ARMA model provides much better forecasts of a time
series than any other ARMA model. In fact, in most cases, you can use an AR model
to produce forecasts that are just as accurate as those from ARMA models without
nearly as much complexity. Even some of the strongest advocates of ARMA models
admit that these models should not be used with fewer than 80 observations, and
they do not recommend using ARMA models for predicting quarterly sales or gross
margins for a company using even 15 years of quarterly data.
where the distribution of εt, conditional on its value in the previous period, εt−1,
2 . If a = 0, the variance of the error
is normal, with mean 0 and variance a0+ a1εt−1 1
in every period is just a0. The variance is constant over time and does not depend on
past errors. Now suppose that a1 > 0. Then the variance of the error in one period
depends on how large the squared error was in the previous period. If a large error
occurs in one period, the variance of the error in the next period will be even larger.
Engle showed that we can test whether a time series is ARCH(1) by regressing
the squared residuals from a previously estimated time-series model (AR, MA, or
ARMA) on a constant and one lag of the squared residuals. We can estimate the
linear regression equation
εˆ2t = a0+ a 1εˆ2t−1+ ut, (18)
where ut is an error term. If the estimate of a1 is statistically significantly different
from zero, we conclude that the time series is ARCH(1). If a time-series model has
ARCH(1) errors, then the variance of the errors in period t + 1 can be predicted in
period t using the formula σˆ2t+1 = aˆ0+ aˆ1ˆ
ε 2t.
EXAMPLE 17
Regression Statistics
R2 0.0759
Standard error 23.7841
© CFA Institute. For candidate use only. Not for distribution.
158 Learning Module 5 Time-Series Analysis
Regression Statistics
Observations 286
Durbin–Watson 2.0569
Regression Statistics
R2 0.1113
Standard error 24.64
Observations 131
Durbin–Watson 2.0385
Suppose a model contains ARCH(1) errors. What are the consequences of that fact?
First, if ARCH exists, the standard errors for the regression parameters will not be
correct. We will need to use generalized least squares13 or other methods that correct
for heteroskedasticity to correctly estimate the standard error of the parameters in the
time-series model. Second, if ARCH exists and we have it modeled—for example, as
ARCH(1)—we can predict the variance of the errors. Suppose, for instance, that we
want to predict the variance of the error in inflation using the estimated parameters
from Exhibit 30: σˆ2t = 6.3626 + 0.2754 ˆ
ε 2t−1. If the error in one period were 0%, the
predicted variance of the error in the next period would be 6.3626 + 0.2754(0) =
6.3626. If the error in one period were 1%, the predicted variance of the error in the
next period would be 6.3626 + 0.2754(12) = 6.6380.
Engle and other researchers have suggested many generalizations of the ARCH(1)
model, including ARCH(p) and generalized autoregressive conditional heteroskedas-
ticity (GARCH) models. In an ARCH(p) model, the variance of the error term in the
current period depends linearly on the squared errors from the previous p periods:
σt2 = a 2 + ⋯ + a
0+ a1ε t−1 2 . GARCH models are similar to ARMA models of the
p εt−p
error variance in a time series. Just like ARMA models, GARCH models can be finicky
and unstable: Their results can depend greatly on the sample period and the initial
guesses of the parameters in the GARCH model. Financial analysts who use GARCH
models should be well aware of how delicate these models can be, and they should
examine whether GARCH estimates are robust to changes in the sample and the initial
guesses about the parameters.14
Up to now, we have discussed time-series models only for one time series. Although in
the readings on correlation and regression and on multiple regression we used linear
regression to analyze the relationship among different time series, in those readings we
completely ignored unit roots. A time series that contains a unit root is not covariance
stationary. If any time series in a linear regression contains a unit root, ordinary least
squares estimates of regression test statistics may be invalid.
To determine whether we can use linear regression to model more than one time
series, let us start with a single independent variable; that is, there are two time series,
one corresponding to the dependent variable and one corresponding to the indepen-
dent variable. We will then extend our discussion to multiple independent variables.
We first use a unit root test, such as the Dickey–Fuller test, for each of the two
time series to determine whether either of them has a unit root.15 There are several
possible scenarios related to the outcome of these tests. One possible scenario is that
we find that neither of the time series has a unit root. Then we can safely use linear
regression to test the relations between the two time series. Otherwise, we may have
to use additional tests, as we discuss later in this section.
EXAMPLE 18
14 For more on ARCH, GARCH, and other models of time-series variance, see Hamilton (1994).
15 For theoretical details of unit root tests, see Greene (2018) or Tsay (2010). Unit root tests are available
in some econometric software packages, such as EViews.
© CFA Institute. For candidate use only. Not for distribution.
160 Learning Module 5 Time-Series Analysis
be valid if both time series are covariance stationary; that is, neither of the two
time series has a unit root. So, if they compute the Dickey–Fuller t-test statistic
of the hypothesis of a unit root separately for each time series and find that they
can reject the null hypothesis that the T-bill return series has a unit root and the
null hypothesis that the expected inflation time series has a unit root, then they
can use linear regression to analyze the relation between the two series. In that
case, the results of their analysis of the Fisher effect would be valid.
A second possible scenario is that we reject the hypothesis of a unit root for the
independent variable but fail to reject the hypothesis of a unit root for the dependent
variable. In this case, the error term in the regression would not be covariance station-
ary. Therefore, one or more of the following linear regression assumptions would be
violated: (1) that the expected value of the error term is 0, (2) that the variance of the
error term is constant for all observations, and (3) that the error term is uncorrelated
across observations. Consequently, the estimated regression coefficients and standard
errors would be inconsistent. The regression coefficients might appear significant, but
those results would be spurious.16 Thus we should not use linear regression to analyze
the relation between the two time series in this scenario.
A third possible scenario is the reverse of the second scenario: We reject the
hypothesis of a unit root for the dependent variable but fail to reject the hypothesis
of a unit root for the independent variable. In this case also, like the second scenario,
the error term in the regression would not be covariance stationary, and we cannot
use linear regression to analyze the relation between the two time series.
EXAMPLE 19
(Historical Example)
Unit Roots and Predictability of Stock Market Returns by
Price-to-Earnings Ratio
Johann de Vries is analyzing the performance of the South African stock market.
He examines whether the percentage change in the Johannesburg Stock Exchange
(JSE) All Share Index can be predicted by the price-to-earnings ratio (P/E) for
the index. Using monthly data from January 1994 to December 2013, he runs
a regression using (Pt − Pt−1)/Pt−1 as the dependent variable and Pt−1/Et−2 as
the independent variable, where Pt is the value of the JSE index at time t and
Et is the earnings on the index. De Vries finds that the regression coefficient is
negative and statistically significant and the value of the R2 for the regression
is quite high. What additional analysis should he perform before accepting the
regression as valid?
De Vries needs to perform unit root tests for each of the two time series.
If one of the two time series has a unit root, implying that it is not stationary,
the results of the linear regression are not meaningful and cannot be used to
conclude that stock market returns are predictable by P/E.17
The next possibility is that both time series have a unit root. In this case, we
need to establish whether the two time series are cointegrated before we can rely
on regression analysis.18 Two time series are cointegrated if a long-term financial or
16 The problem of spurious regression for nonstationary time series was first discussed by Granger and
Newbold (1974).
17 Barr and Kantor (1999) contains evidence that the P/E time series is nonstationary.
18 Engle and Granger (1987) first discussed cointegration.
© CFA Institute. For candidate use only. Not for distribution.
Regressions with More Than One Time Series 161
economic relationship exists between them such that they do not diverge from each
other without bound in the long run. For example, two time series are cointegrated
if they share a common trend.
In the fourth scenario, both time series have a unit root but are not cointegrated.
In this scenario, as in the second and third scenarios, the error term in the linear
regression will not be covariance stationary, some regression assumptions will be
violated, the regression coefficients and standard errors will not be consistent, and we
cannot use them for hypothesis tests. Consequently, linear regression of one variable
on the other would be meaningless.
Finally, the fifth possible scenario is that both time series have a unit root but they
are cointegrated. In this case, the error term in the linear regression of one time series
on the other will be covariance stationary. Accordingly, the regression coefficients and
standard errors will be consistent, and we can use them for hypothesis tests. However,
we should be very cautious in interpreting the results of a regression with cointegrated
variables. The cointegrated regression estimates the long-term relation between the
two series but may not be the best model of the short-term relation between the two
series. Short-term models of cointegrated series (error correction models) are dis-
cussed in Engle and Granger (1987) and Tsay (2010), but these are specialist topics.
Now let us look at how we can test for cointegration between two time series
that each have a unit root, as in the fourth and fifth scenarios.19 Engle and Granger
suggested the following test. If yt and xt are both time series with a unit root, we
should do the following:
1. Estimate the regression yt = b0 + b1xt + εt.
2. Test whether the error term from the regression in Step 1 has a unit root
using a Dickey–Fuller test. Because the residuals are based on the estimated
coefficients of the regression, we cannot use the standard critical values for
the Dickey–Fuller test. Instead, we must use the critical values computed by
Engle and Granger, which take into account the effect of uncertainty about
the regression parameters on the distribution of the Dickey–Fuller test.
3. If the (Engle–Granger) Dickey–Fuller test fails to reject the null hypothesis
that the error term has a unit root, then we conclude that the error term in
the regression is not covariance stationary. Therefore, the two time series
are not cointegrated. In this case, any regression relation between the two
series is spurious.
4. If the (Engle–Granger) Dickey–Fuller test rejects the null hypothesis that
the error term has a unit root, then we may assume that the error term
in the regression is covariance stationary and that the two time series are
cointegrated. The parameters and standard errors from linear regression will
be consistent and will let us test hypotheses about the long-term relation
between the two series.
19 Consider a time series, xt, that has a unit root. For many such financial and economic time series, the
first difference of the series, xt − xt−1, is stationary. We say that such a series, whose first difference is sta-
tionary, has a single unit root. However, for some time series, even the first difference may not be stationary
and further differencing may be needed to achieve stationarity. Such a time series is said to have multiple
unit roots. In this section, we consider only the case in which each nonstationary series has a single unit
root (which is quite common).
© CFA Institute. For candidate use only. Not for distribution.
162 Learning Module 5 Time-Series Analysis
EXAMPLE 20
1. Test whether the two series each have a unit root. If we cannot reject
the null hypothesis of a unit root for both series, implying that both
series are nonstationary, we must then test whether the two series are
cointegrated.
2. Having established that each series has a unit root, we estimate the
regression ln Intel salest = b0 + b1(ln GDPt) + εt, then conduct the
(Engle–Granger) Dickey–Fuller test of the hypothesis that there is a
unit root in the error term of this regression using the residuals from
the estimated regression. If we reject the null hypothesis of a unit root
in the error term of the regression, we reject the null hypothesis of
no cointegration. That is, the two series would be cointegrated. If the
two series are cointegrated, we can use linear regression to estimate
the long-term relation between the natural log of Intel sales and the
natural log of GDP.
EXAMPLE 21
If at least one time series (the dependent variable or one of the independent vari-
ables) has a unit root while at least one time series (the dependent variable or one
of the independent variables) does not, the error term in the regression cannot be
covariance stationary. Consequently, we should not use multiple linear regression to
analyze the relation among the time series in this scenario.
© CFA Institute. For candidate use only. Not for distribution.
Other Issues in Time Series 163
Another possibility is that each time series, including the dependent variable
and each of the independent variables, has a unit root. If this is the case, we need
to establish whether the time series are cointegrated. To test for cointegration, the
procedure is similar to that for a model with a single independent variable. First,
estimate the regression yt = b0 + b1x1t + b2x2t + . . . + bkxkt + εt. Then conduct the
(Engle–Granger) Dickey–Fuller test of the hypothesis that there is a unit root in the
errors of this regression using the residuals from the estimated regression.
If we cannot reject the null hypothesis of a unit root in the error term of the regres-
sion, we cannot reject the null hypothesis of no cointegration. In this scenario, the
error term in the multiple regression will not be covariance stationary, so we cannot
use multiple regression to analyze the relationship among the time series.
If we can reject the null hypothesis of a unit root in the error term of the regression,
we can reject the null hypothesis of no cointegration. However, modeling three or more
time series that are cointegrated may be difficult. For example, an analyst may want
to predict a retirement services company’s sales based on the country’s GDP and the
total population over age 65. Although the company’s sales, GDP, and the population
over 65 may each have a unit root and be cointegrated, modeling the cointegration
of the three series may be difficult, and doing so is beyond the scope of this volume.
Analysts who have not mastered all these complex issues should avoid forecasting
models with multiple time series that have unit roots; the regression coefficients may
be inconsistent and may produce incorrect forecasts.
Time-series analysis is an extensive topic and includes many highly complex issues.
Our objective in this reading has been to present those issues in time series that are
the most important for financial analysts and can also be handled with relative ease.
In this section, we briefly discuss some of the issues that we have not covered but
could be useful for analysts.
In this reading, we have shown how to use time-series models to make forecasts.
We have also introduced the RMSE as a criterion for comparing forecasting models.
However, we have not discussed measuring the uncertainty associated with forecasts
made using time-series models. The uncertainty of these forecasts can be very large,
and should be taken into account when making investment decisions. Fortunately, the
same techniques apply to evaluating the uncertainty of time-series forecasts as apply
to evaluating the uncertainty about forecasts from linear regression models. To accu-
rately evaluate forecast uncertainty, we need to consider both the uncertainty about
the error term and the uncertainty about the estimated parameters in the time-series
model. Evaluating this uncertainty is fairly complicated when using regressions with
more than one independent variable.
In this reading, we used the US CPI inflation series to illustrate some of the prac-
tical challenges analysts face in using time-series models. We used information on US
Federal Reserve policy to explore the consequences of splitting the inflation series in
two. In financial time-series work, we may suspect that a time series has more than
one regime but lack the information to attempt to sort the data into different regimes.
© CFA Institute. For candidate use only. Not for distribution.
164 Learning Module 5 Time-Series Analysis
If you face such a problem, you may want to investigate other methods, especially
switching regression models, to identify multiple regimes using only the time series
itself.
If you are interested in these and other advanced time-series topics, you can learn
more from Diebold (2008) and Tsay (2010).
● a linear trend,
● an exponential trend,
● seasonality, or
● a significant shift in the time series during the sample period (for exam-
ple, a change in mean or variance).
3. If you find no significant seasonality or shift in the time series, then perhaps
either a linear trend or an exponential trend will be sufficient to model the
time series. In that case, take the following steps:
4. If you find significant serial correlation in the residuals from the trend
model, use a more complex model, such as an autoregressive model. First,
however, reexamine whether the time series is covariance stationary. The
following is a list of violations of stationarity, along with potential methods
to adjust the time series to make it covariance stationary:
● If the time series has a linear trend, first-difference the time series.
● If the time series has an exponential trend, take the natural log of the
time series and then first-difference it.
● If the time series shifts significantly during the sample period, estimate
different time-series models before and after the shift.
● If the time series has significant seasonality, include seasonal lags (dis-
cussed in Step 7).
© CFA Institute. For candidate use only. Not for distribution.
Other Issues in Time Series 165
5. After you have successfully transformed a raw time series into a covari-
ance-stationary time series, you can usually model the transformed series
with a short autoregression.20 To decide which autoregressive model to use,
take the following steps:
6. If you find significant serial correlation in the residuals, use an AR(2) model
and test for significant serial correlation of the residuals of the AR(2) model.
7. Your next move is to check for seasonality. You can use one of two
approaches:
9. Finally, you may also want to perform tests of the model’s out-of-sample
forecasting performance to see how the model’s out-of-sample performance
compares to its in-sample performance.
20 Most financial time series can be modeled using an autoregressive process. For a few time series, a
moving-average model may fit better. To see whether this is the case, examine the first five or six autocor-
relations of the time series. If the autocorrelations suddenly drop to 0 after the first q autocorrelations, a
moving-average model (of order q) is appropriate. If the autocorrelations start large and decline gradually,
an autoregressive model is appropriate.
© CFA Institute. For candidate use only. Not for distribution.
166 Learning Module 5 Time-Series Analysis
Using these steps in sequence, you can be reasonably sure that your model is
correctly specified.
SUMMARY
■ The predicted trend value of a time series in period t is bˆ0+ bˆ1t in a linear
trend model; the predicted trend value of a time series in a log-linear trend
model is ebˆ0+bˆ1t.
■ Time series that tend to grow by a constant amount from period to period
should be modeled by linear trend models, whereas time series that tend to
grow at a constant rate should be modeled by log-linear trend models.
■ Trend models often do not completely capture the behavior of a time series,
as indicated by serial correlation of the error term. If the Durbin–Watson
statistic from a trend model differs significantly from 2, indicating serial
correlation, we need to build a different kind of model.
■ An autoregressive model of order p, denoted AR(p), uses p lags of a time
series to predict its current value: xt = b0 + b1xt−1 + b2xt−2 + . . . + bpxt–p +
ε t.
■ A time series is covariance stationary if the following three conditions are
satisfied: First, the expected value of the time series must be constant and
finite in all periods. Second, the variance of the time series must be con-
stant and finite in all periods. Third, the covariance of the time series with
itself for a fixed number of periods in the past or future must be constant
and finite in all periods. Inspection of a nonstationary time-series plot may
reveal an upward or downward trend (nonconstant mean) and/or noncon-
stant variance. The use of linear regression to estimate an autoregressive
time-series model is not valid unless the time series is covariance stationary.
■ For a specific autoregressive model to be a good fit to the data, the autocor-
relations of the error term should be 0 at all lags.
■ A time series is mean reverting if it tends to fall when its level is above its
long-run mean and rise when its level is below its long-run mean. If a time
series is covariance stationary, then it will be mean reverting.
■ The one-period-ahead forecast of a variable xt from an AR(1) model made in
period t for period t + 1 is xˆt+1 = bˆ0+ bˆ1xt. This forecast can be used to
create the two-period-ahead forecast from the model made in period t,
xˆt+2 = bˆ0+ bˆ1xt+1. Similar results hold for AR(p) models.
■ In-sample forecasts are the in-sample predicted values from the estimated
time-series model. Out-of-sample forecasts are the forecasts made from the
estimated time-series model for a time period different from the one for
which the model was estimated. Out-of-sample forecasts are usually more
valuable in evaluating the forecasting performance of a time-series model
than are in-sample forecasts. The root mean squared error (RMSE), defined
as the square root of the average squared forecast error, is a criterion for
comparing the forecast accuracy of different time-series models; a smaller
RMSE implies greater forecast accuracy.
© CFA Institute. For candidate use only. Not for distribution.
Other Issues in Time Series 167
● If neither of the time series has a unit root, then we can safely use linear
regression.
© CFA Institute. For candidate use only. Not for distribution.
168 Learning Module 5 Time-Series Analysis
● If one of the two time series has a unit root, then we should not use
linear regression.
● If both time series have a unit root and the time series are cointegrated,
we may safely use linear regression; however, if they are not cointegrated,
we should not use linear regression. The (Engle–Granger) Dickey–Fuller
test can be used to determine whether time series are cointegrated.
© CFA Institute. For candidate use only. Not for distribution.
References 169
REFERENCES
Barr, G. D. I. and B. S. Kantor. 1999. “Price–Earnings Ratios on the Johannesburg Stock
Exchange—Are They a Good Value?” SA Journal of Accounting Research 13 (1): 1–23.
Dickey, David A. and Wayne A. Fuller. 1979. “Distribution of the Estimators for Autoregressive
Time Series with a Unit Root.” Journal of the American Statistical Association 74 (366):
427–31. 10.2307/2286348
Diebold, Francis X. 2008. Elements of Forecasting, 4th ed. Cincinnati: South-Western.
Engle, Robert F. and Clive W. J. Granger. 1987. “Co-Integration and Error Correction:
Representation, Estimation, and Testing.” Econometrica 55 (2): 251–76. 10.2307/1913236
Garbade, Kenneth. 1982. Securities Markets. New York: McGraw-Hill.
Granger, Clive W. J. and Paul Newbold. 1974. “Spurious Regressions in Econometrics.” Journal
of Econometrics 2 (2): 111–20. 10.1016/0304-4076(74)90034-7
Hamilton, James D. 1994. Time Series Analysis. Princeton, NJ: Princeton University Press.
Tsay, Ruey S. 2010. Analysis of Financial Time Series, 3rd ed. New York: Wiley.
© CFA Institute. For candidate use only. Not for distribution.
170 Learning Module 5 Time-Series Analysis
PRACTICE PROBLEMS
Regression Statistics
(t-statistics for coefficients are reported in parentheses)
Coefficients:
Intercept 28.3278 3.3929 1.5948 2.0017
(10.1846) (74.9091) (1.4610) (1.9957)
t (Trend) 0.4086 0.0075
(15.4148) (17.2898)
Oil pricet−1 0.9767 1.3946
(63.9535) (20.2999)
Oil pricet−2 −0.4249
(−6.2064)
© CFA Institute. For candidate use only. Not for distribution.
Practice Problems 171
In Exhibit 1, at the 5% significance level, the lower critical value for the Durbin–
Watson test statistic is 1.75 for both the linear and log-linear regressions.
Note: At the 5% significance level, the critical value for a t-statistic is 1.97.
After reviewing the data and regression results, Martinez draws the following
conclusions.
Conclusion 1 The time series for WTI oil prices is covariance stationary.
1. Based on Exhibit 1, the predicted WTI oil price for October 2015 using the linear
trend model is closest to:
A. $29.15.
B. $74.77.
C. $103.10.
2. Based on Exhibit 1, the predicted WTI oil price for September 2015 using the
log-linear trend model is closest to:
A. $29.75.
B. $29.98.
C. $116.50.
B. both the linear trend model and the log-linear trend model.
C. neither the linear trend model nor the log-linear trend model.
B. incorrect because the mean and variance of WTI oil prices are not constant
over time.
© CFA Institute. For candidate use only. Not for distribution.
172 Learning Module 5 Time-Series Analysis
5. Based on Exhibit 1, the forecasted oil price in September 2015 based on the
AR(2) model is closest to:
A. $38.03.
B. $40.04.
C. $61.77.
6. Based on the data for the AR(1) model in Exhibit 1 and Exhibit 2, Martinez can
conclude that the:
A. residuals are not serially correlated.
7. Based on the mean-reverting level implied by the AR(1) model regression output
in Exhibit 1, the forecasted oil price for September 2015 is most likely to be:
A. less than $42.86.
B. equal to $42.86.
8. You have been assigned to analyze automobile manufacturers, and as a first step
in your analysis, you decide to model monthly sales of lightweight vehicles to
determine sales growth in that part of the industry. Exhibit 1 gives lightweight
vehicle monthly sales (annualized) from January 1992 to December 2000.
Year
Monthly sales in the lightweight vehicle sector, Salest, have been increasing over
time, but you suspect that the growth rate of monthly sales is relatively con-
© CFA Institute. For candidate use only. Not for distribution.
Practice Problems 173
stant. Write the simplest time-series model for Salest that is consistent with your
perception.
Regression Statistics
R2 0.9316
Standard error 0.3227
Observations 80
Durbin–Watson 0.1878
9. Using the regression output in the previous table, what is the model’s prediction
of the unemployment rate for July 2013?
10. How should we interpret the Durbin–Watson (DW) statistic for this regression?
What does the value of the DW statistic say about the validity of a t-test on the
coefficient estimates?
11. Exhibit 1 compares the predicted civilian unemployment rate (PRED) with the
actual civilian unemployment rate (UER) from January 2013 to August 2019. The
predicted results come from estimating the linear time trend model UERt = b0 +
b1t + εt.
What can we conclude about the appropriateness of this model?
© CFA Institute. For candidate use only. Not for distribution.
174 Learning Module 5 Time-Series Analysis
12. Exhibit 1 shows a plot of first differences in the log of monthly lightweight vehicle
sales over the same period as in Problem 11. Has differencing the data made the
resulting series, Δln(Salest) = ln(Salest) − ln(Salest−1), covariance stationary?
0.2
0.1
–0.1
–0.2
–0.3
–0.4
–0.5
–0.6
Jan/13 Jan/14 Jan/15 Jan/16 Jan/17 Jan/18 Jan/19
13. Has differencing the data made the new series, ΔUERt, covariance stationary?
Explain your answer.
14. Given the graph of the change in the unemployment rate shown in the figure,
describe the steps we should take to determine the appropriate autoregressive
time-series model specification for the series ΔUERt.
15. Exhibit 1 gives the regression output of an AR(1) model on first differences in
the unemployment rate. Describe how to interpret the DW statistic for this
regression.
Regression Statistics
R2 0.0546
Standard error 0.1309
Observations 79
Durbin–Watson 2.0756
16. Use the information in the table to assess the appropriateness of the specification
given by the equation.
17. If the residuals from the AR(1) model above violate a regression assumption, how
would you modify the AR(1) specification?
18. Assume that changes in the civilian unemployment rate are covariance stationary
and that an AR(1) model is a good description for the time series of changes in
the unemployment rate. Specifically, we have ΔUERt = −0.0668 − 0.2320ΔUERt−1
(using the coefficient estimates given in the previous problem). Given this equa-
tion, what is the mean-reverting level to which changes in the unemployment
rate converge?
20. What is the prediction of the change following the next change?
22. Exhibit 1 gives the actual sales, log of sales, and changes in the log of sales of
Cisco Systems for the period 1Q 2019 to 4Q 2019.
Exhibit 1
Forecast the first- and second-quarter sales of Cisco Systems for 2020 using the
regression Δln(Salest) = 0.0068 + 0.2633Δln(Salest−1).
Exhibit 1
24. Compare the forecasting performance of the model given with that of another
model having an out-of-sample RMSE of 2%.
© CFA Institute. For candidate use only. Not for distribution.
178 Learning Module 5 Time-Series Analysis
25. The AR(1) model for the civilian unemployment rate, ΔUERt = −0.0405 −
0.4674ΔUERt−1, was developed with five years of data. What would be the draw-
back to using the AR(1) model to predict changes in the civilian unemployment
rate 12 months or more ahead, as compared with 1 month ahead?
26. For purposes of estimating a predictive equation, what would be the drawback to
using 30 years of civilian unemployment data rather than only 5 years?
Regression Statistics
R2 0.0017
Standard error 7.3336
© CFA Institute. For candidate use only. Not for distribution.
Practice Problems 179
Regression Statistics
Observations 118
Durbin–Watson 1.9937
Busse decides that he will need to test the data for nonstationarity using a
Dickey–Fuller test. To do so, he knows he must model a transformed version of
Regression 1.
Busse’s next assignment is to develop a model to predict future quarterly sales for
PoweredUP, Inc., a major electronics retailer. He begins by running the following
regression:
Exhibit 2: Log Differenced Sales AR(1) Model: PoweredUP, Inc., Last 10 Years
of Quarterly Sales
Regression Statistics
R2 0.2011
Standard error 0.0651
Observations 38
Durbin–Watson 1.9677
Because the regression output from Exhibit 2 raises some concerns, Busse runs a
different regression. These regression results, along with quarterly sales data for
the past five quarters, are presented in Exhibit 3 and Exhibit 4, respectively.
Regression Statistics
R2 0.6788
Standard error 0.0424
Observations 35
Durbin–Watson 1.8799
After completing his work on PoweredUP, Busse is asked to analyze the rela-
tionship of oil prices and the stock prices of three transportation companies. His
firm wants to know whether the stock prices can be predicted by the price of oil.
Exhibit 5 shows selected information from the results of his analysis.
© CFA Institute. For candidate use only. Not for distribution.
Practice Problems 181
Exhibit 5: Analysis Summary of Stock Prices for Three Transportation Stocks and the Price of Oil
Serial Correlation of
Unit Linear or Expo- Residuals in Trend
Root? nential Trend? Model? ARCH(1)? Comments
Company 1 Yes Exponential Yes Yes Not cointegrated with oil price
Company 2 Yes Linear Yes No Cointegrated with oil price
Company 3 No Exponential Yes No Not cointegrated with oil price
Oil Price Yes
To assess the relationship between oil prices and stock prices, Busse runs three
regressions using the time series of each company’s stock prices as the dependent
variable and the time series of oil prices as the independent variable.
27. Which of Busse’s conclusions regarding the exchange rate time series is con-
sistent with both the properties of a covariance-stationary time series and the
properties of a random walk?
A. Conclusion 1
B. Conclusion 2
C. Conclusion 3
28. Based on the regression output in Exhibit 1, the first-differenced series used to
run Regression 2 is consistent with:
A. a random walk.
B. covariance stationarity.
29. Based on the regression results in Exhibit 1, the original time series of exchange
rates:
A. has a unit root.
B. exhibits stationarity.
30. In order to perform the nonstationarity test, Busse should transform the Regres-
sion 1 equation by:
A. adding the second lag to the equation.
31. Based on the regression output in Exhibit 2, what should lead Busse to conclude
that the Regression 3 equation is not correctly specified?
A. The Durbin–Watson statistic
32. Based on the regression output in Exhibit 3 and sales data in Exhibit 4, the fore-
casted value of quarterly sales for March 2016 for PoweredUP is closest to:
A. $4.193 billion.
B. $4.205 billion.
C. $4.231 billion.
33. Based on Exhibit 5, Busse should conclude that the variance of the error terms
for Company 1:
A. is constant.
B. can be predicted.
C. is homoskedastic.
34. Based on Exhibit 5, for which company would the regression of stock prices on
oil prices be expected to yield valid coefficients that could be used to estimate the
long-term relationship between stock price and oil price?
A. Company 1
B. Company 2
C. Company 3
35. Based on Exhibit 5, which single time-series model would most likely be appro-
priate for Busse to use in predicting the future stock price of Company 3?
A. Log-linear trend model
36. Using the figure, comment on whether the specification ln(Salest) = b0 + b1[ln(-
Salest−1)] + εt is appropriate.
38. Suppose we want to predict the annualized return of the five-year T-bill using the
annualized return of the three-month T-bill with monthly observations from Jan-
uary 1993 to December 2002. Our analysis produces the data shown in Exhibit 1.
Regression Statistics
R2 0.5829
Standard error 0.6598
Observations 120
Durbin–Watson 0.1130
39. Exhibit 1 shows the quarterly sales of Avon Products from 1Q 1992 to 2Q 2002.
© CFA Institute. For candidate use only. Not for distribution.
184 Learning Module 5 Time-Series Analysis
1700
1500
1300
1100
900
700
1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002
Year
Lag Autocorrelation
1 −0.1106
2 −0.5981
3 −0.1525
4 0.8496
5 −0.1099
Exhibit 2 shows the output from a regression on changes in the GPM for Home
Depot, where we have changed the specification of the AR regression.
Exhibit 2: Change in Gross Profit Margin for Home Depot, 1Q 1992–4Q 2001
Regression Statistics
R2 0.9155
Standard error 0.0057
© CFA Institute. For candidate use only. Not for distribution.
Practice Problems 185
Regression Statistics
Observations 40
Durbin–Watson 2.6464
40. Identify the change that was made to the regression model.
Exhibit 1: Log Differenced Sales: AR(1) Model with Seasonal Lag Johnson &
Johnson Quarterly Observations, January 1985–December 2001
Regression Statistics
R2 0.4220
Standard error 0.0318
Observations 68
Durbin–Watson 1.8784
42. Using the information in Exhibit 1, determine whether the model is correctly
© CFA Institute. For candidate use only. Not for distribution.
186 Learning Module 5 Time-Series Analysis
specified.
43. If sales grew by 1% last quarter and by 2% four quarters ago, use the model to
predict the sales growth for this quarter.
Year
Exhibit 2 gives the regression statistics from estimating the model Δln(Salest) =
b0 + b1Δln(Salest−1) + εt.
Regression Statistics
R2 0.2899
Standard error 0.0408
Observations 38
Durbin–Watson 1.5707
46. Describe the procedures we should use to determine whether the AR(1) specifi-
cation is correct.
47. Assuming the model is correctly specified, what is the long-run change in the log
of sales toward which the series will tend to converge?
© CFA Institute. For candidate use only. Not for distribution.
188 Learning Module 5 Time-Series Analysis
SOLUTIONS
1. C is correct. The predicted value for period t from a linear trend is calculated as
ˆ ˆ0+ b
y t = b ˆ1(t) .
October 2015 is the second month out of sample, or t = 183. So, the predicted
value for October 2015 is calculated as
yˆt = 28.3278 + 0.4086(183) = $103.10.
Therefore, the predicted WTI oil price for October 2015 based on the linear
trend model is $103.10.
2. C is correct. The predicted value for period t from a log-linear trend is calculated
as lnˆ ˆ0+ b
y t = b ˆ1(t) .
September 2015 is the first month out of sample, or t = 182. So, the predicted
value for September 2015 is calculated as follows:
ln yˆt = 4.7579.
3. B is correct. The Durbin–Watson statistic for the linear trend model is 0.10 and
for the log-linear trend model is 0.08. Both of these values are below the critical
value of 1.75. Therefore, we can reject the hypothesis of no positive serial cor-
relation in the regression errors in both the linear trend model and the log-linear
trend model.
4. B is correct. There are three requirements for a time series to be covariance sta-
tionary. First, the expected value of the time series must be constant and finite in
all periods. Second, the variance of the time series must be constant and finite in
all periods. Third, the covariance of the time series with itself for a fixed number
of periods in the past or future must be constant and finite in all periods. Marti-
nez concludes that the mean and variance of the time series of WTI oil prices are
not constant over time. Therefore, the time series is not covariance stationary.
5. B is correct. The last two observations in the WTI time series are July and August
2015, when the WTI oil price was $51.16 and $42.86, respectively. Therefore,
September 2015 represents a one-period-ahead forecast. The one-period-ahead
forecast from an AR(2) model is calculated as
1_ , where
6. C is correct. The standard error of the autocorrelations is calculated as _
√T
T represents the number of observations used in the regression. Therefore, the
1 = 0.0745. Martinez can
standard error for each of the autocorrelations is _
_
√180
conclude that the residuals are serially correlated and are significantly different
© CFA Institute. For candidate use only. Not for distribution.
Solutions 189
from zero because two of the four autocorrelations in Exhibit 2 have a t-statistic
in absolute value that is greater than the critical value of 1.97.
Choices A and B are incorrect because two of the four autocorrelations have a
t-statistic in absolute value that is greater than the critical value of the t-statistic
of 1.97.
Therefore, the mean-reverting WTI oil price from the AR(1) model is $68.45. The
forecasted oil price in September 2015 will likely be greater than $42.86 because
the model predicts that the price will rise in the next period from the August
2015 price of $42.86.
9. The estimated forecasting equation is UERt = 5.5098 − 0.0294(t). The data begin
in January 2013, and July 2013 is Period 7. Thus the linear trend model predicts
the unemployment rate to be UER7 = 7.2237 − 0.0510(7) = 6.8667, or approxi-
mately 6.9%.
10. The DW statistic is designed to detect positive serial correlation of the errors of
a regression equation. Under the null hypothesis of no positive serial correlation,
the DW statistic is 2.0. Positive serial correlation will lead to a DW statistic that is
less than 2.0. From the table in Problem 1, we see that the DW statistic is 0.1878.
To see whether this result is significantly less than 2.0, refer to the Durbin–
Watson table in Appendix E at the end of this volume, in the column marked k =
1 (one independent variable) and the row corresponding to 80 observations. We
see that dl = 1.55. Because our DW statistic is clearly less than dl, we reject the
null hypothesis of no serial correlation at the 0.05 significance level.
The presence of serial correlation in the error term violates one of the regression
assumptions. The standard errors of the estimated coefficients will be biased
downward, so we cannot conduct hypothesis testing on the coefficients.
11. The difference between UER and its forecast value, PRED, is the forecast error. In
an appropriately specified regression model, the forecast errors are randomly dis-
tributed around the regression line and have a constant variance. We can see that
the errors from this model specification are persistent. The errors tend first to be
above the regression line, and then, starting in 2014, they tend to be below the
regression line until 2017, when they again are persistently above the regression
line. This persistence suggests that the errors are positively serially correlated.
Therefore, we conclude that the model is not appropriate for making estimates.
12. The plot of the series Δln(Salest) appears to fluctuate around a constant mean; its
volatility seems constant throughout the period. Differencing the data appears to
have made the time series covariance stationary.
13. The plot of the series ΔUERt seems to fluctuate around a constant mean; its vol-
atility appears to be constant throughout the period. Our initial judgment is that
the differenced series is covariance stationary.
14. The change in the unemployment rate seems covariance stationary, so we should
first estimate an AR(1) model and test to see whether the residuals from this
© CFA Institute. For candidate use only. Not for distribution.
190 Learning Module 5 Time-Series Analysis
model have significant serial correlation. If the residuals do not display signifi-
cant serial correlation, we should use the AR(1) model. If the residuals do display
significant serial correlation, we should try an AR(2) model and test for serial cor-
relation of the residuals of the AR(2) model. We should continue this procedure
until the errors from the final AR(p) model are serially uncorrelated.
15. The DW statistic cannot be appropriately used for a regression that has a lagged
value of the dependent variable as one of the explanatory variables. To test for
serial correlation, we need to examine the autocorrelations.
17. Because the residuals from the AR(1) specification display significant serial cor-
relation, we should estimate an AR(2) model and test for serial correlation of the
residuals of the AR(2) model. If the residuals from the AR(2) model are serially
uncorrelated, we should then test for seasonality and ARCH behavior. If any
serial correlation remains in the residuals, we should estimate an AR(3) process
and test the residuals from that specification for serial correlation. We should
continue this procedure until the errors from the final AR(p) model are serially
uncorrelated. When serial correlation is eliminated, we should test for seasonality
and ARCH behavior.
18. When a covariance-stationary series is at its mean-reverting level, the series will
tend not to change until it receives a shock (εt). So, if the series ΔUERt is at the
mean-reverting level, ΔUERt = ΔUERt−1. This implies that ΔUERt = −0.0668 −
0.2320ΔUERt, so that (1 + 0.2320)ΔUERt = −0.0668 and ΔUERt = −0.0668/(1 +
0.2320) = −0.0542. The mean-reverting level is −0.0542. In an AR(1) model, the
general expression for the mean-reverting level is b0/(1 − b1).
19. The predicted change in the unemployment rate for next period is −7.38%, found
by substituting 0.0300 into the forecasting model: −0.0668 − 0.2320(0.03) =
−0.0738.
20. If we substitute our one-period-ahead forecast of −0.0738 into the model (using
the chain rule of forecasting), we get a two-period-ahead forecast of −0.0497, or
−4.97%.
21. The answer to Part B is quite close to the mean-reverting level of −0.0542. A
stationary time series may need many periods to return to its equilibrium,
mean-reverting level.
22. The forecast of sales is $13,647 million for the first quarter of 2020 and $13,800
million for the second quarter of 2002, as the following table shows.
We find the forecasted change in the log of sales for the first quarter of 2020 by
inputting the value for the change in the log of sales from the previous quarter
into the equation Δln(Salest) = 0.0068 + 0.2633Δln(Salest−1). Specifically, Δln(Sal-
est) = 0.0068 + 0.2633(0.0356) = 0.0162, which means that we forecast the log of
sales in the first quarter of 2020 to be 9.5051 + 0.0162 = 9.5213.
Next, we forecast the change in the log of sales for the second quarter of 2020
as Δln(Salest) = 0.0068 + 0.2633(0.0162) = 0.0111. Note that we have to use our
first-quarter 2020 estimated value of the change in the log of sales as our input
for Δln(Salest−1) because we are forecasting past the period for which we have
actual data.
With a forecasted change of 0.0111, we forecast the log of sales in the second
quarter of 2020 to be 9.5213 + 0.0111 = 9.5324.
We have forecasted the log of sales in the first and second quarters of 2020 to be
9.5213 and 9.5324, respectively. Finally, we take the antilog of our estimates of the
log of sales in the first and second quarters of 2020 to get our estimates of the lev-
el of sales: e9.5213 = 13,647 and e9.5324 = 13,800, respectively, for sales of $13,647
million and $13,800 million.
i. Take the difference between the actual and the forecast values. This is the
error.
ii. Square the error.
iii. Sum the squared errors.
iv. Divide by the number of forecasts.
v. Take the square root of the average.
We show the calculations for RMSE in the following table.
24. The lower the RMSE, the more accurate the forecasts of a model in forecasting.
Therefore, the model with the RMSE of 2% has greater accuracy in forecasting
than the model in Part A, which has an RMSE of 3.6%.
25. Predictions too far ahead can be nonsensical. For example, the AR(1) model we
have been examining, ΔUERt = −0.0405 − 0.4674ΔUERt−1, taken at face value,
predicts declining civilian unemployment into the indefinite future. Because the
civilian unemployment rate will probably not go below 3% frictional unemploy-
ment and cannot go below 0% unemployment, this model’s long-range forecasts
are implausible. The model is designed for short-term forecasting, as are many
time-series models.
26. Using more years of data for estimation may lead to nonstationarity even in the
series of first differences in the civilian unemployment rate. As we go further
back in time, we increase the risk that the underlying civilian unemployment rate
series has more than one regime (or true model). If the series has more than one
regime, fitting one model to the entire period would not be correct. Note that
when we have good reason to believe that a time series is stationary, a longer
series of data is generally desirable.
1. The expected value of the time series must be constant and finite in all
periods.
2. The variance of the time series must be constant and finite in all periods.
3. The covariance of the time series with itself for a fixed number of periods in
the past or future must be constant and finite in all periods.
b0 = 0 does not violate any of these three requirements and is thus consistent
with the properties of a covariance-stationary time series.
29. A is correct. If the exchange rate series is a random walk, then the
first-differenced series will yield b0 = 0 and b1 = 0 and the error terms will not
be serially correlated. The data in Exhibit 1 show that this is the case: Neither
the intercept nor the coefficient on the first lag of the first-differenced exchange
rate in Regression 2 differs significantly from zero because the t-statistics of both
coefficients are less than the critical t-statistic of 1.98. Also, the residual auto-
correlations do not differ significantly from zero because the t-statistics of all
autocorrelations are less than the critical t-statistic of 1.98. Therefore, because all
random walks have unit roots, the exchange rate time series used to run Regres-
sion 1 has a unit root.
30. C is correct. To conduct the Dickey–Fuller test, one must subtract the inde-
pendent variable, xt−1,from both sides of the original AR(1) model. This results
© CFA Institute. For candidate use only. Not for distribution.
Solutions 193
31. C is correct. The regression output in Exhibit 2 suggests there is serial correlation
in the residual errors. The fourth autocorrelation of the residual has a value of
0.6994 and a t-statistic of 4.3111, which is greater than the t-statistic critical value
of 2.02. Therefore, the null hypothesis that the fourth autocorrelation is equal to
zero can be rejected. This indicates strong and significant seasonal autocorrela-
tion, which means the Regression 3 equation is misspecified.
32. C is correct. The quarterly sales for March 2016 are calculated as follows:
ln Salest = 1.44251.
33. B is correct. Exhibit 3 shows that the time series of the stock prices of Compa-
ny 1 exhibits heteroskedasticity, as evidenced by the fact that the time series is
ARCH(1). If a time series is ARCH(1), then the variance of the error in one peri-
od depends on the variance of the error in previous periods. Therefore, the vari-
ance of the errors in period t + 1 can be predicted in period t using the formula
34. B is correct. When two time series have a unit root but are cointegrated, the error
term in the linear regression of one time series on the other will be covariance
stationary. Exhibit 5 shows that the series of stock prices of Company 2 and the
oil prices both contain a unit root and the two time series are cointegrated. As
a result, the regression coefficients and standard errors are consistent and can
be used for hypothesis tests. Although the cointegrated regression estimates the
long-term relation between the two series, it may not be the best model of the
short-term relationship.
35. C is correct. As a result of the exponential trend in the time series of stock prices
for Company 3, Busse would want to take the natural log of the series and then
first-difference it. Because the time series also has serial correlation in the resid-
uals from the trend model, Busse should use a more complex model, such as an
autoregressive (AR) model.
36. The graph of ln(Salest) appears to trend upward over time. A series that trends
upward or downward over time often has a unit root and is thus not covariance
stationary. Therefore, using an AR(1) regression on the undifferenced series is
probably not correct. In practice, we need to examine regression statistics to
confirm such visual impressions.
37. The most common way to transform a time series with a unit root into a
© CFA Institute. For candidate use only. Not for distribution.
194 Learning Module 5 Time-Series Analysis
38. To determine whether we can use linear regression to model more than one time
series, we should first determine whether any of the time series has a unit root. If
none of the time series has a unit root, then we can safely use linear regression to
test the relations between the two time series. Note that if one of the two vari-
ables has a unit root, then our analysis would not provide valid results; if both
of the variables have unit roots, then we would need to evaluate whether the
variables are cointegrated.
39. The quarterly sales of Avon show an upward trend and a clear seasonal pattern,
as indicated by the repeated regular cycle.
40. A second explanatory variable, the change in the gross profit margin lagged four
quarters, ΔGPMt−4, was added.
41. The model was augmented to account for seasonality in the time series (with
quarterly data, significant autocorrelation at the fourth lag indicates seasonali-
ty). The standard error of the autocorrelation coefficient
_ equals 1 divided by the
square root of the number of observations: 1 / √ 40 , or 0.1581. The autocorrelation
at the fourth lag (0.8496) is significant: t = 0.8496/0.1581 = 5.37. This indicates
seasonality, and accordingly we added ΔGPMt−4. Note that in the augment-
ed regression, the coefficient on ΔGPMt−4 is highly significant. (Although the
autocorrelation at second lag is also significant, the fourth lag is more important
because of the rationale of seasonality. Once the fourth lag is introduced as an
independent variable, we might expect that the second lag in the residuals would
not be significant.)
42. In order to determine whether this model is correctly specified, we need to test
for serial correlation among the residuals. We want to test whether we can reject
the null hypothesis that the value of each autocorrelation is 0 against the alterna-
tive hypothesis that each is not equal to 0. At the 0.05 significance level, with 68
observations and three parameters, this model has 65 degrees of freedom. The
critical value of the t-statistic needed to reject the null hypothesis is thus about
2.0. The absolute value of the t-statistic for each autocorrelation is below 0.60
(less than 2.0), so we cannot reject the null hypothesis that each autocorrelation
is not significantly different from 0. We have determined that the model is cor-
rectly specified.
43. If sales grew by 1% last quarter and by 2% four quarters ago, then the mod-
el predicts that sales growth this quarter will be 0.0121 − 0.0839[ln(1.01)] +
0.6292[ln(1.02)] = e0.02372 − 1 = 2.40%.
44. We should estimate the regression ΔUERt = b0 + b1ΔUERt−1 + εt and save the re-
siduals from the regression. Then we should create a new variable, ˆ ε 2t, by squaring
the residuals. Finally, we should estimate ˆ 2
ε t = a0+ a1ˆ 2
ε t−1+ utand test to see
whether a1 is statistically different from 0.
45. The series has a steady upward trend of growth, suggesting an exponential
growth rate. This finding suggests transforming the series by taking the natural
log and differencing the data.
46. First, we should determine whether the residuals from the AR(1) specification
are serially uncorrelated. If the residuals are serially correlated, then we should
try an AR(2) specification and then test the residuals from the AR(2) model for
serial correlation. We should continue in this fashion until the residuals are se-
© CFA Institute. For candidate use only. Not for distribution.
Solutions 195
rially uncorrelated and then look for seasonality in the residuals. If seasonality is
present, we should add a seasonal lag. If no seasonality is present, we should test
for ARCH. If ARCH is not present, we can conclude that the model is correctly
specified.
LEARNING MODULE
6
Machine Learning
by Kathleen DeRose, CFA, Matthew Dixon, PhD, FRM, and Christophe Le
Lannou.
Kathleen DeRose, CFA, is at New York University, Stern School of Business (USA). Matthew
Dixon, PhD, FRM, is at Illinois Institute of Technology, Stuart School of Business (USA).
Christophe Le Lannou is at dataLearning (United Kingdom).
LEARNING OUTCOMES
Mastery The candidate should be able to:
INTRODUCTION
1
describe supervised machine learning, unsupervised machine
learning, and deep learning
Investment firms are increasingly using technology at every step of the investment
management value chain—from improving their understanding of clients to uncov-
ering new sources of alpha and executing trades more efficiently. Machine learning
techniques, a central part of that technology, are the subject of this reading. These
techniques first appeared in finance in the 1990s and have since flourished with the
explosion of data and cheap computing power.
© CFA Institute. For candidate use only. Not for distribution.
198 Learning Module 6 Machine Learning
Supervised Learning
Supervised learning involves ML algorithms that infer patterns between a set of
inputs (the X’s) and the desired output (Y). The inferred pattern is then used to map
a given input set into a predicted output. Supervised learning requires a labeled
dataset, one that contains matched sets of observed inputs and the associated output.
Applying the ML algorithm to this dataset to infer the pattern between the inputs
and output is called “training” the algorithm. Once the algorithm has been trained,
the inferred pattern can be used to predict output values based on new inputs (i.e.,
ones not in the training dataset).
Multiple regression is an example of supervised learning. A regression model
takes matched data (X’s, Y) and uses it to estimate parameters that characterize the
relationship between Y and the X’s. The estimated parameters can then be used to
predict Y on a new, different set of X’s. The difference between the predicted and
actual Y is used to evaluate how well the regression model predicts out-of-sample
(i.e., using new data).
The terminology used with ML algorithms differs from that used in regression.
Exhibit 1 provides a visual of the supervised learning model training process and a
translation between regression and ML terminologies.
© CFA Institute. For candidate use only. Not for distribution.
200 Learning Module 6 Machine Learning
Use ML
Labeled Data Train Supervised ML Algorithm {Y, Xk k≥1, N}
{Y, Xk k≥1, N} Algorithm for Test Data
Prediction
Training dataset:
Target outcomes Prediction Actual
paired with {YPredict} {Y}
feature inputs.
Evaluation of Fit
In supervised machine learning, the dependent variable (Y) is the target and the
independent variables (X’s) are known as features. The labeled data (training dataset)
is used to train the supervised ML algorithm to infer a pattern-based prediction rule.
The fit of the ML model is evaluated using labeled test data in which the predicted
targets (YPredict) are compared to the actual targets (YActual).
An example of supervised learning is the case in which ML algorithms are used
to predict whether credit card transactions are fraudulent or legitimate. In the credit
card example, the target is a binary variable with a value of 1 for “fraudulent” or 0
for “non-fraudulent.” The features are the transaction characteristics. The chosen ML
algorithm uses these data elements to train a model to predict the likelihood of fraud
more accurately in new transactions. The ML program “learns from experience” if the
percentage of correctly predicted credit card transactions increases as the amount of
input from a growing credit card database increases. One possible ML algorithm to
use would be to fit a logistic regression model to the data to provide an estimate of
the probability a transaction is fraudulent.
Supervised learning can be divided into two categories of problems—regression
and classification—with the distinction between them being determined by the nature
of the target (Y) variable. If the target variable is continuous, then the task is one of
regression (even if the ML technique used is not “regression”; note this nuance of ML
terminology). If the target variable is categorical or ordinal (i.e., a ranked category), then
it is a classification problem. Regression and classification use different ML techniques.
Regression focuses on making predictions of continuous target variables. Most
readers are already familiar with multiple linear regression (e.g., ordinary least squares)
models, but other supervised learning techniques exist, including non-linear models.
These non-linear models are useful for problems involving large datasets with large
numbers of features, many of which may be correlated. Some examples of problems
belonging to the regression category are using historical stock market returns to fore-
cast stock price performance or using historical corporate financial ratios to forecast
the probability of bond default.
Classification focuses on sorting observations into distinct categories. In (super-
vised) machine learning, when the dependent variable (target) is categorical, the model
relating the outcome to the independent variables (features) is called a “classifier.”
You should already be familiar with logistic regression as a type of classifier. Many
classification models are binary classifiers, as in the case of fraud detection for credit
card transactions. Multi-category classification is not uncommon, as in the case of
© CFA Institute. For candidate use only. Not for distribution.
What Is Machine Learning 201
classifying firms into multiple credit rating categories. In assigning ratings, the outcome
variable is ordinal, meaning the categories have a distinct order or ranking (e.g., from
low to high creditworthiness). Ordinal variables are intermediate between categorical
variables and continuous variables on a scale of measurement.
Unsupervised Learning
Unsupervised learning is machine learning that does not make use of labeled data.
More formally, in unsupervised learning, we have inputs (X’s) that are used for anal-
ysis without any target (Y) being supplied. In unsupervised learning, because the ML
algorithm is not given labeled training data, the algorithm seeks to discover structure
within the data themselves. As such, unsupervised learning is useful for exploring
new datasets because it can provide human experts with insights into a dataset too
big or too complex to visualize.
Two important types of problems that are well suited to unsupervised machine
learning are reducing the dimension of data and sorting data into clusters, known as
dimension reduction and clustering, respectively.
Dimension reduction focuses on reducing the number of features while retaining
variation across observations to preserve the information contained in that variation.
Dimension reduction may have several purposes. It may be applied to data with a
large number of features to produce a lower dimensional representation (i.e., with
fewer features) that can fit, for example, on a computer screen. Dimension reduction
is also used in many quantitative investment and risk management applications where
it is critical to identify the most predictive factors underlying asset price movements.
Clustering focuses on sorting observations into groups (clusters) such that obser-
vations in the same cluster are more similar to each other than they are to observations
in other clusters. Groups are formed based on a set of criteria that may or may not be
prespecified (such as the number of groups). Clustering has been used by asset man-
agers to sort companies into groupings driven by data (e.g., based on their financial
statement data or corporate characteristics) rather than conventional groupings (e.g.,
based on sectors or countries).
ML Algorithm Type
EXAMPLE 1
new data the algorithm receives and so will negatively impact the model’s ability to
generalize, therefore reducing its overall predictive value. The evaluation of any ML
algorithm thus focuses on its prediction error on new data rather than on its goodness
of fit on the data with which the algorithm was fitted (i.e., trained).
Generalization is an objective in model building, so the problem of overfitting
is a challenge to attaining that objective. These two concepts are the focus of the
discussion below.
Y Y Y
0 0 0
Number of Training Samples Number of Training Samples Number of Training Samples
Exhibit 5: Fitting Curve Shows Trade-Off between Bias and Variance Errors
and Model Complexity
Model Error (Ein, Eout)
Optimal
Complexity
Total
Error
Variance
Error
Bias
Error
Model Complexity
Finding the optimal point (managing overfitting risk)—the point just before the
total error rate starts to rise (due to increasing variance error)—is a core part of the
machine learning process and the key to successful generalization. Data scientists
express the trade-off between overfitting and generalization as a trade-off between
© CFA Institute. For candidate use only. Not for distribution.
Evaluating ML Algorithm Performance 207
cost (the difference between in- and out-of-sample error rates) and complexity. They
use the trade-off between cost and complexity to calibrate and visualize under- and
overfitting and to optimize their models.
EXAMPLE 2
Statement 1 The model retains its explanatory power when predicting using
new data (i.e., out-of-sample).
Statement 2 The model shows low explanatory power after training using
in-sample data (i.e., training data).
Statement 3 The model loses its explanatory power when predicting using
new data (i.e., out-of-sample).
3. By implementing which one of the following actions can Anand address the
problem?
A. Estimate and incorporate into the model a penalty that decreases in
size with the number of included features.
© CFA Institute. For candidate use only. Not for distribution.
Supervised ML Algorithms: Penalized Regression 209
Supervised machine learning models are trained using labeled data, and depending
on the nature of the target (Y) variable, they can be divided into two types: regres-
sion for a continuous target variable and classification for a categorical or ordinal
target variable. As shown in Exhibit 2 under regression, we will now cover penalized
regression and LASSO. Then, as shown under classification, we will introduce support
vector machine (SVM), k-nearest neighbor (KNN), and classification and regression
tree (CART) algorithms. Note that CART, as its name implies, can be used for both
classification and regression problems.
In the following discussion, assume we have a number of observations of a target
variable, Y, and n real valued features, X1, . . . , Xn, that we may use to establish a
relationship (regression or classification) between X (a vector of the Xi) and Y for
each observation in our dataset.
Penalized Regression
Penalized regression is a computationally efficient technique used in prediction prob-
lems. In practice, penalized regression has been useful for reducing a large number
of features to a manageable set and for making good predictions in a variety of large
datasets, especially where features are correlated (i.e., when classical linear regression
breaks down).
In a large dataset context, we may have many features that potentially could be used
to explain Y. When a model is fit to training data, the model may so closely reflect the
characteristics of the specific training data that the model does not perform well on
new data. Features may be included that reflect noise or randomness in the training
dataset that will not be present in new or future data used for making predictions. That
is the problem of overfitting, and penalized regression can be described as a technique
to avoid overfitting. In prediction, out-of-sample performance is key, so relatively
parsimonious models (that is, models in which each variable plays an essential role)
tend to work well because they are less subject to overfitting.
© CFA Institute. For candidate use only. Not for distribution.
210 Learning Module 6 Machine Learning
Let us suppose that we standardize our data so the features have a mean of 0 and
a variance of 1. Standardization of features will allow us to compare the magnitudes
of regression coefficients for the feature variables. In ordinary linear regression (i.e.,
ordinary least squares, or OLS), the regression coefficients bˆ0, bˆ1, . . . , bˆKare chosen
to minimize the sum of the squared residuals (i.e., the sum of the squared difference
ˆi) , or
between the actual values, Yi, and the predicted values, Y
Penalized regression includes a constraint such that the regression coefficients are
chosen to minimize the sum of squared residuals plus a penalty term that increases
in size with the number of included features. So, in a penalized regression, a feature
must make a sufficient contribution to model fit to offset the penalty from including
it. Therefore, only the more important features for explaining Y will remain in the
penalized regression model.
In one popular type of penalized regression, LASSO, or least absolute shrinkage
and selection operator, the penalty term has the following form, with λ > 0:
K
Penalty term = λ∑|bˆk|.
k=1
In addition to minimizing the sum of the squared residuals, LASSO involves mini-
mizing the sum of the absolute values of the regression coefficients (see the following
expression). The greater the number of included features (i.e., variables with non-zero
coefficients), the larger the penalty term. Therefore, penalized regression ensures that
a feature is included only if the sum of squared residuals declines by more than the
penalty term increases. All types of penalized regression involve a trade-off of this
type. Also, since LASSO eliminates the least important features from the model, it
automatically performs a type of feature selection.
∑ ni=1(Yi− Yˆi) + λ∑ K
2
ˆ
k=1|b k|.
portfolios. Asset returns typically exhibit strong multi-collinearity, making the esti-
mation of the covariance matrix highly sensitive to noise and outliers, so the resulting
optimized asset weights are highly unstable. Regularization methods have been used
to address this problem. The relatively parsimonious models produced by applying
penalized regression methods, such as LASSO, tend to work well because they are
less subject to overfitting.
Support vector machine (SVM) is one of the most popular algorithms in machine
learning. It is a powerful supervised algorithm used for classification, regression, and
outlier detection. Despite its complicated-sounding name, the notion is relatively
straightforward and best explained with a few pictures. The left panel in Exhibit 6
presents a simple dataset with two features (x and y coordinates) labeled in two groups
(triangles and diamonds). These binary labeled data are noticeably separated into two
distinct regions, which could represent stocks with positive and negative returns in a
given year. These two regions can be easily separated by an infinite number of straight
lines; three of them are shown in the right panel of Exhibit 6. The data are thus linearly
separable, and any of the straight lines shown would be called a linear classifier—a
binary classifier that makes its classification decision based on a linear combination
of the features of each data point.
Y Y
X X
With two dimensions or features (x and y), linear classifiers can be represented as
straight lines. Observations with n features can be represented in an n-dimension
space, and the dataset would be linearly separable if the observations can be sepa-
rated into two distinct regions by a linear space boundary. The general term for such
a space boundary is an n-dimensional hyperplane, which with n = 1 is called a line
and with n = 2 is called a plane.
© CFA Institute. For candidate use only. Not for distribution.
212 Learning Module 6 Machine Learning
Support vector machine is a linear classifier that determines the hyperplane that
optimally separates the observations into two sets of data points. The intuitive idea
behind the SVM algorithm is maximizing the probability of making a correct prediction
(here, that an observation is a triangle or a diamond) by determining the boundary
that is the furthest away from all the observations. In Exhibit 7, SVM separates the
data by the maximum margin, where the margin is the shaded strip that divides the
observations into two groups. The straight line in the middle of the shaded strip is the
discriminant boundary, or boundary, for short. We can see that the SVM algorithm
produces the widest shaded strip (i.e., the one with the maximum margin on either
side of the boundary). The margin is determined by the observations closest to the
boundary (the circled points) in each set, and these observations are called support
vectors. Adding more training data away from the support vectors will not affect the
boundary. In our training datasets, however, adding data points which are close to the
hyperplane may move the margin by changing the set of support vectors.
Margin
K-NEAREST NEIGHBOR
6
describe supervised machine learning algorithms—including
penalized regression, support vector machine, k-nearest neighbor,
classification and regression tree, ensemble learning, and random
forest—and determine the problems for which they are best suited
K-nearest neighbor (KNN) is a supervised learning technique used most often for
classification and sometimes for regression. The idea is to classify a new observation
by finding similarities (“nearness”) between this new observation and the existing data.
Going back to the scatterplot in Exhibit 6, let us assume we have a new observation:
The diamond in Exhibit 8 needs to be classified as belonging to either the diamond
or the triangle category. If k = 1, the diamond will be classified into the same category
as its nearest neighbor (i.e., the triangle in the left panel). The right panel in Exhibit 8
presents the case where k = 5, so the algorithm will look at the diamond’s five nearest
neighbors, which are three triangles and two diamonds. The decision rule is to choose
the classification with the largest number of nearest neighbors out of the five being
considered. So, the diamond is again classified as belonging to the triangle category.
Y Y
X X
Let us suppose we have a database of corporate bonds classified by credit rating that
also contains detailed information on the characteristics of these bonds. Such fea-
tures would include those of the issuing company (e.g., asset size, industry, leverage
ratios, cash flow ratios) and of the bond issue itself (e.g., tenor, fixed/floating coupon,
embedded options). Now, assume a new bond is about to be issued with no credit
rating. By nature, corporate bonds with similar issuer and issue characteristics should
be given a similar credit rating. So, by using KNN, we can predict the implied credit
rating of the new bond based on the similarities of its characteristics to those of the
bonds in our database.
KNN is a straightforward, intuitive model that is still very powerful because it is
non-parametric; the model makes no assumptions about the distribution of the data.
Moreover, it can be used directly for multi-class classification. A critical challenge of
KNN, however, is defining what it means to be “similar” (or near). Besides the selec-
tion of features, an important decision relates to the distance metric used to model
similarity because an inappropriate measure will generate poorly performing models.
The choice of a correct distance measure may be even more subjective for ordinal
© CFA Institute. For candidate use only. Not for distribution.
214 Learning Module 6 Machine Learning
greater than 20% (No), then CART will predict that that data point belongs to the
no dividend increase (dash) category, which represents a terminal node. Conversely,
if the value of X2 is greater than 20% (Yes), then CART will predict that that data
point belongs to the dividend increase (cross) category, which represents another
terminal node.
It is important to note that the same feature can appear several times in a tree
in combination with other features. Moreover, some features may be relevant only
if other conditions have been met. For example, going back to the initial root node,
if IOG is not greater than 10% (X1 ≤ 10%) and FCFG is greater than 10%, then IOG
appears again as another decision node, but this time it is lower down in the tree and
has a cutoff value of 5%.
© CFA Institute. For candidate use only. Not for distribution.
216 Learning Module 6 Machine Learning
No Yes
FCFG A Cutoff
FCFG Value
X2>10% X2>20%
No Yes
Yes No
No Div.
Incr. Div.
IOG No Div.
(–) Incr.
X1>5% Incr. (+)
(–)
No Yes
A Terminal
Div. No Div. Node
Incr. Incr.
(+) (–)
X1≤10% X1>10%
X1: IOG
We now turn to how the CART algorithm selects features and cutoff values for them.
Initially, the classification model is trained from the labeled data, which in this hypo-
thetical case are 10 instances of companies having a dividend increase (the crosses)
and 10 instances of companies with no dividend increase (the dashes). As shown in
Panel B of Exhibit 9, at the initial root node and at each decision node, the feature
space (i.e., the plane defined by X1 and X2) is split into two rectangles for values
above and below the cutoff value for the particular feature represented at that node.
© CFA Institute. For candidate use only. Not for distribution.
Classification and Regression Tree 217
This can be seen by noting the distinct patterns of the lines that emanate from the
decision nodes in Panel A. These same distinct patterns are used for partitioning the
feature space in Panel B.
The CART algorithm chooses the feature and the cutoff value at each node that
generates the widest separation of the labeled data to minimize classification error
(e.g., by a criterion, such as mean-squared error). After each decision node, the
partition of the feature space becomes smaller and smaller, so observations in each
group have lower within-group error than before. At any level of the tree, when the
classification error does not diminish much more from another split (bifurcation),
the process stops, the node is a terminal node, and the category that is in the major-
ity at that node is assigned to it. If the objective of the model is classification, then
the prediction of the algorithm at each terminal node will be the category with the
majority of data points. For example, in Panel B of Exhibit 9, the top right rectangle of
the feature space, representing IOG (X1) > 10% and FCFG (X2 )> 20%, contains five
crosses, the most data points of any of the partitions. So, CART would predict that a
new data point (i.e., a company) with such features belongs to the dividend increase
(cross) category. However, if instead the new data point had IOG (X1) > 10% and
FCFG (X2) ≤ 20%, then it would be predicted to belong to the no dividend increase
(dash) category—represented by the lower right rectangle, with two crosses but with
three dashes. Finally, if the goal is regression, then the prediction at each terminal
node is the mean of the labeled values.
CART makes no assumptions about the characteristics of the training data, so if
left unconstrained, it potentially can perfectly learn the training data. To avoid such
overfitting, regularization parameters can be added, such as the maximum depth of
the tree, the minimum population at a node, or the maximum number of decision
nodes. The iterative process of building the tree is stopped once the regularization
criterion has been reached. For example, in Panel B of Exhibit 9, the upper left rectan-
gle of the feature space (determined by X1 ≤ 10%, X2 > 10%, and X1 ≤ 5% with three
crosses) might represent a terminal node resulting from a regularization criterion
with minimum population equal to 3. Alternatively, regularization can occur via a
pruning technique that can be used afterward to reduce the size of the tree. Sections
of the tree that provide little classifying power are pruned (i.e., cut back or removed).
By its iterative structure, CART can uncover complex dependencies between fea-
tures that other models cannot reveal. As demonstrated in Exhibit 9, the same feature
can appear several times in combination with other features and some features may
be relevant only if other conditions have been met.
As shown in Exhibit 10, high profitability is a critical feature for predicting whether
a stock is an attractive investment or a value trap (i.e., an investment that, although
apparently priced cheaply, is likely to be unprofitable). This feature is relevant only
if the stock is cheap: For example, in this hypothetical case, if P/E is less than 15,
leverage is high (debt to total capital > 50%) and sales are expanding (sales growth >
15%). Said another way, high profitability is irrelevant in this context if the stock is
not cheap and if leverage is not high and if sales are not expanding. Multiple linear
regression typically fails in such situations where the relationship between the features
and the outcome is non-linear.
© CFA Institute. For candidate use only. Not for distribution.
218 Learning Module 6 Machine Learning
Is Stock Cheap?
(P/E < 15x)
Yes No
Is Leverage High?
(Debt/Tot. Cap > 50%)
Yes No
Yes No
Is Profitability High?
(Net Profit Margin > 20%)
Yes No
Attractive Equity
Value Trap
Investment
CART models are popular supervised machine learning models because the tree
provides a visual explanation for the prediction. This contrasts favorably with other
algorithms that are often considered to be “black boxes” because it may be difficult
to understand the reasoning behind their outcomes and thus to place trust in them.
CART is a powerful tool to build expert systems for decision-making processes. It
can induce robust rules despite noisy data and complex relationships between high
numbers of features. Typical applications of CART in investment management include,
among others, enhancing detection of fraud in financial statements, generating
consistent decision processes in equity and fixed-income selection, and simplifying
communication of investment strategies to clients.
Instead of basing predictions on the results of a single model as in the previous dis-
cussion, why not use the predictions of a group—or an ensemble—of models? Each
single model will have a certain error rate and will make noisy predictions. But by
taking the average result of many predictions from many models, we can expect to
achieve a reduction in noise as the average result converges toward a more accurate
prediction. This technique of combining the predictions from a collection of models
© CFA Institute. For candidate use only. Not for distribution.
Ensemble Learning and Random Forest 219
Voting Classifiers
Suppose you have been working on a machine learning project for some time and
have trained and compared the results of several algorithms, such as SVM, KNN, and
CART. A majority-vote classifier will assign to a new data point the predicted label
with the most votes. For example, if the SVM and KNN models are both predicting
the category “stock outperformance” and the CART model is predicting the category
“stock underperformance,” then the majority-vote classifier will choose stock outper-
formance.” The more individual models you have trained, the higher the accuracy of
the aggregated prediction up to a point. There is an optimal number of models beyond
which performance would be expected to deteriorate from overfitting. The trick is to
look for diversity in the choice of algorithms, modeling techniques, and hypotheses.
The (extreme) assumption here is that if the predictions of the individual models are
independent, then we can use the law of large numbers to achieve a more accurate
prediction.
Random Forest
A random forest classifier is a collection of a large number of decision trees trained
via a bagging method. For example, a CART algorithm would be trained using each
of the n independent datasets (from the bagging process) to generate the multitude
of different decision trees that make up the random forest classifier.
To derive even more individual predictions, added diversity can be generated in
the trees by randomly reducing the number of features available during training. So,
if each observation has n features, one can randomly select a subset of m features
(where m < n) that will then be considered by the CART algorithm for splitting the
dataset at each of the decision nodes. The number of subset features (m), the number
of trees to use, the minimum size (population) of each node (or leaf ), and the maxi-
mum depth of each tree are all hyperparameters that can be tuned to improve overall
model prediction accuracy. For any new observation, we let all the classifier trees (the
“random forest”) undertake classification by majority vote—implementing a machine
learning version of the “wisdom of crowds.” The process involved in random forest
© CFA Institute. For candidate use only. Not for distribution.
220 Learning Module 6 Machine Learning
construction tends to reduce variance and protect against overfitting on the training
data. It also reduces the ratio of noise to signal because errors cancel out across the
collection of slightly different classification trees. However, an important drawback
of random forest is that it lacks the ease of interpretability of individual trees; as a
result, it is considered a relatively black box type of algorithm.
Exhibit 11 presents three scatterplots of actual and predicted defaults by small and
medium-sized businesses with respect to two features, X and Y—for example, firm
profitability and leverage, respectively. The left plot shows the actual cases of default
in light shade and no default in dark shade, while the middle and right plots present
the predicted defaults and no defaults (also in light and dark shades, respectively). It is
clear from the middle plot, which is based on a traditional linear regression model, that
the model fails to predict the complex non-linear relationship between the features.
Conversely, the right plot, which presents the prediction results of a random forest
model, shows that this model performs very well in matching the actual distribution
of the data.
4 4 4
2 2 2
Y
0 0 0
–2 –2 –2
–2 0 2 –2 0 2 –2 0 2
X X X
Despite its relative simplicity, random forest is a powerful algorithm with many
investment applications. These include, for example, use in factor-based investment
strategies for asset allocation and investment selection or use in predicting whether an
IPO will be successful (e.g., percent oversubscribed, first trading day close/IPO price)
given the attributes of the IPO offering and the corporate issuer. Later, in a mini-case
study, Deep Neural Network–Based Equity Factor Model, we present further details
of how supervised machine learning is used for fundamental factor modeling.
EXAMPLE 3
Solution:
Lee is addressing a supervised learning classification problem because she
must determine whether Biotron’s upcoming bond issue would be classified
as investment grade or non-investment grade.
2. State two ML algorithms that Lee could use to explore the implied credit
rating of Biotron Corporation, and then describe how each algorithm could
be applied.
Solution:
One suitable ML algorithm is SVM. The SVM algorithm is a linear classifier
that aims to find the optimal hyperplane—the one that separates observa-
tions into two distinct sets by the maximum margin. So, SVM is well suited
to binary classification problems, such as the one facing Lee (investment
grade versus non-investment grade). In this case, Lee could train the SVM
algorithm on data—characteristics (features) and rating (target)—of low
investment-grade (Baa3/BBB–) and high non-investment-grade (Ba1/BB+)
© CFA Institute. For candidate use only. Not for distribution.
222 Learning Module 6 Machine Learning
bonds. Lee would then note on which side of the margin the new data point
(Biotron’s new bonds) lies.
The KNN algorithm is also well suited for classification problems because
it classifies a new observation by finding similarities (or nearness) between
the new observation and the existing data. Training the algorithm with data
as for SVM, the decision rule for classifying Biotron’s new bonds is which
classification is in the majority among its k-nearest neighbors. Note that k (a
hyperparameter) must be pre-specified by Lee.
Solution:
If the ML algorithms disagreed on the classification, the classification would
be more likely to be sensitive to the algorithm’s approach to classifying data.
Because the classification of Biotron’s new issue appears robust to the choice
of ML algorithm (i.e., both algorithms agree on the rating), the resulting
classification will more likely be correct.
EXAMPLE 4
Solution:
Kim is addressing a classification problem because she must determine
whether bonds that she is considering purchasing in the credit quality range
of B/B2 to CCC/Caa2 will default or not default.
© CFA Institute. For candidate use only. Not for distribution.
Ensemble Learning and Random Forest 223
2. Describe the dimensionality of the model that Kim requests her analytics
team to develop.
Solution:
With 19 fundamental and 5 technical factors (i.e., the features), the dimen-
sionality of the model is 24.
Solution:
The CART model is an algorithm for addressing classification problems. Its
ability to handle complex, non-linear relationships makes it a good choice to
address the modeling problem at hand. An important advantage of CART
is that its results are relatively straightforward to visualize and interpret,
which should help Kim explain her recommendations based on the model to
Hilux’s investment committee and the firm’s clients.
Solution:
At each node in the decision tree, the algorithm will choose the feature and
the cutoff value for the selected feature that generates the widest separation
of the labeled data to minimize classification error.
5. Describe how the team might avoid overfitting and improve the predictive
power of a CART model.
Solution:
The team can avoid overfitting and improve the predictive power of the
CART model by adding regularization parameters. For example, the team
could specify the maximum depth of the tree, the minimum population at a
node, or the maximum number of decision nodes. The iterative process of
building nodes will be stopped once the regularization criterion has been
reached. Alternatively, a pruning technique can be used afterward to remove
parts of the CART model that provide little power to correctly classify in-
stances into default or no default categories.
6. Describe how ensemble learning might be used by the team to develop even
better predictions for Kim’s selection of corporate high-yield bonds.
Solution:
The analytics team might use ensemble learning to combine the predictions
from a collection of models, where the average result of many predictions
leads to a reduction in noise and thus more accurate predictions. Ensemble
learning can be achieved by an aggregation of either heterogeneous learn-
ers—different types of algorithms combined with a voting classifier—or
homogeneous learners—a combination of the same algorithm but using
different training data based on the bootstrap aggregating (i.e., bagging)
technique. The team may also consider developing a random forest classifier
(i.e., a collection of many decision trees) trained via a bagging method.
© CFA Institute. For candidate use only. Not for distribution.
224 Learning Module 6 Machine Learning
The following case study was developed and written by Matthew Dixon, PhD, FRM.
A research analyst for a fund of funds has been tasked with identifying a set of
attractive exchange-traded funds (ETFs) and mutual funds (MFs) in which to invest.
She decides to use machine learning to identify the best (i.e., winners) and worst
(i.e., losers) performing funds and the features which are most important in such an
identification. Her aim is to train a model to correctly classify the winners and losers
and then to use it to predict future outperformers. She is unsure of which type of
machine learning classification model (i.e., classifier) would work best, so she reports
and cross-compares her findings using several different well-known machine learning
algorithms.
The goal of this case is to demonstrate the application of machine learning clas-
sification to fund selection. Therefore, the analyst will use the following classifiers to
identify the best and worst performing funds:
■ classification and regression tree (CART),
■ support vector machine (SVM),
■ k-nearest neighbors (KNN), and
■ random forests.
Data Description
In the following experiments, the performance of each fund is learned by the machine
learning algorithms based on fund type and size, asset class composition, funda-
mentals (i.e., valuation multiples), and sector composition characteristics. To form a
cross-sectional classifier, the sector composition and fund size reported on 15 February
2019 are assumed to be representative of the latest month over which the fund return
is reported. Exhibit 12 presents a description of the dataset.
1. price earnings: The ratio of price per share to earnings per share
2. price book: The ratio of price per share to book value per share
3. price sales: The ratio of price per share to sales per share
4. price cashflow: The ratio of price per share to cash flow per share
Sector weights (for 11 sectors) provided as percentages:
1. basic materials
2. consumer cyclical
3. financial services
4. real estate
5. consumer defensive
6. healthcare
7. utilities
8. communication services
9. energy
10. industrials
11. technology
Labels
Winning and losing ETFs or MFs are determined based on whether their
returns are one standard deviation or more above or below the distribution of
one-month fund returns across all ETFs or across all MFs, respectively. More
precisely, the labels are:
0, otherwise.
*Feature appears in the ETF dataset only.
**Feature appears in the MF dataset only.
Data sources: Kaggle, Yahoo Finance on 15 February 2019.
Methodology
The classification model is trained to determine whether a fund’s performance is one
standard deviation or more above the mean return (Label 1), within one standard
deviation of the mean return (Label 0), or one standard deviation or more below the
© CFA Institute. For candidate use only. Not for distribution.
226 Learning Module 6 Machine Learning
mean return (Label -1), where the mean return and standard deviation are either for
all ETFs or all MFs, depending on the particular fund’s type (ETF or MF). Performance
is based on the one-month return of each fund as of 15 February 2019.
This procedure results in most of the funds being labeled as “0” (or average). After
removing missing values in the dataset, there are 1,594 and 6,085 observations in the
ETF and MF datasets, respectively. The data table is a 7,679 × 22 matrix, with 7,679
rows for each fund observation (1,594 for ETFs and 6,085 for MFs) and 22 columns for
the 21 features plus the return label, and all data are recorded as of 15 February 2019.
The aim of the experiment is to identify not only winning and losing funds but also
the features which are useful for distinguishing winners from losers. An important
caveat, however, is that no claim is made that such features are causal.
A separate multi-classifier, with three classes, is run for each dataset. Four types of
machine learning algorithms are used to build each classifier: (i) CART, (ii) SVM, (iii)
KNN, and (iv) random forest. Random forest is an example of an ensemble method
(based on bagging), whereas the other three algorithms do not use bagging.
A typical experimental design would involve using 70% of the data for training
and holding 15% for tuning model hyperparameters and the remaining 15% of the
data for testing. For simplicity, we shall not tune the hyperparameters but simply use
the default settings without attempting to fine tune each one for best performance.
So, in this case, we do not withhold 15% of the data for validation but instead train
the classifier on a random split of 70% of the dataset, with the remaining 30% of the
dataset used for testing. Crucially, for fairness of evaluation, each algorithm is trained
and tested on identical data: The same 70% of observations are used for training
each algorithm, and the same 30% are used for testing each one. The most important
hyperparameters and settings for the algorithms are shown in Exhibit 13.
Exhibit 13: Parameter Settings for the Four Machine Learning Classifiers
The choices of hyperparameter values for the four machine learning classifiers
are supported by theory, academic research, practice, and experimentation to yield
a satisfactory bias–variance trade-off. For SVM, the cost parameter is a penalty on
the margin of the decision boundary. A large cost parameter forces the SVM to use
a thin margin, whereas a smaller cost parameter widens the margin. For random
forests, recall that this is an ensemble method which uses multiple decision trees to
classify, typically by majority vote. Importantly, no claim is made that these choices
of hyperparameters are universally optimal for any dataset.
Results
The results of each classifier are evaluated separately on the test portion of the ETF
and MF datasets. The evaluation metrics used are based on Type I and Type II classifi-
cation errors, where a Type I error is a false positive (FP) and a Type II error is a false
negative (FN). Correct classifications are true positive (TP) and true negative (TN).
■ The first evaluation metric is accuracy, the percentage of correctly pre-
dicted classes out of total predictions. So, high accuracy implies low Type I
and Type II errors.
© CFA Institute. For candidate use only. Not for distribution.
Case Study: Classification of Winning and Losing Funds 227
Exhibit 14: Comparison of Accuracy and F1 Score for Each Classifier Applied
to the ETF Dataset
Exhibit 15 shows that the random forest model outperforms all the other classifiers
under both metrics when applied to the MF dataset. Overall, the accuracy and F1 score
for the SVM and KNN methods are similar for each dataset, and these algorithms
are dominated by CART and random forest, especially in the larger MF dataset. The
difference in performance between the two datasets for all the algorithms is to be
expected, since the MF dataset is approximately four times larger than the ETF dataset
and a larger sample set generally leads to better model performance. Moreover, the
precise explanation of why random forest and CART outperform SVM and KNN is
beyond the scope of this case. Suffice it to say that random forests are well known to
be more robust to noise than most other classifiers.
Exhibit 15: Comparison of Accuracy and F1 Score for Each Classifier Applied
to the Mutual Fund Dataset
Exhibit 16 presents results on the relative importance of the features in the random
forest model for both the ETF (Panel A) and MF (Panel B) datasets. Relative importance
is determined by information gain, which quantifies the amount of information that
the feature holds about the response. Information gain can be regarded as a form of
© CFA Institute. For candidate use only. Not for distribution.
228 Learning Module 6 Machine Learning
non-linear correlation between Y and X. Note the horizontal scale of Panel B (MF
dataset) is more than twice as large as that of Panel A (ETF dataset), and the bar colors
represent the feature rankings, not the features themselves.
Portfolio Bonds
Cat Investment
Utilities
Real Estate
Energy
Cat Size
Consumer Cyclical
Technology
Consumer Defensive
Financial Services
Basic Materials
Communication Services
Healthcare
Industrials
Portfolio Stocks
Price Book
Net Assets
Price Earnings
Price Cashflow
Price Sales
0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
Relative Importance Based on Information Gain
Net Assets
Basic Materials
Utilities
Portfolio Cash
Consumer Cyclical
Industrials
Price Cashflow
Communication Services
Financial Services
Technology
Healthcare
Price Book
Portfolio Stocks
Energy
Price Earnings
Portfolio Bonds
Consumer Defensive
Real Estate
Price Sales
Cat Size
0 0.025 0.050 0.075 0.100 0.125 0.150 0.175 0.200
Relative Importance Based on Information Gain
dataset (≈ 0.04). Conversely, net assets is a relatively important feature for model
performance using the ETF dataset (0.065), while it is the least important feature
when the random forest model is applied to the MF dataset (0.01).
Conclusion
The research analyst has trained and tested machine learning–based models that
she can use to identify potential winning and losing ETFs and MFs. Her classifica-
tion models use input features based on fund type and size, asset class composition,
fundamentals, and sector composition characteristics. She is more confident in her
assessment of MFs than of ETFs, owing to the substantially larger sample size of the
former. She is also confident that any imbalance in class has not led to misinterpre-
tation of her models’ results, since she uses F1 score as her primary model evaluation
metric. Moreover, she determines that the best performing model using both datasets
is an ensemble-type random forest model. Finally, she concludes that while funda-
mental ratios, asset class ratios, and sector composition are important features for
both models, net assets and category size also figure prominently in discriminating
between winning and losing ETFs and MFs.
EXAMPLE 5
Classification of Funds
The research analyst from the previous case uses CART to generate the decision
tree shown in Exhibit 17, which she will use to predict whether and explain why
a new ETF is likely to be a winner (+1), an average performer (0), or a loser
(-1). This ETF’s fundamental valuation ratios are as follows: Price-to-sales =
2.29, price-to-earnings = 7.20, price-to-book = 1.41, and price-to-cash flow =
2.65. Note that the sample size is 1,067 ETFs and the CART model uses just
valuation ratios, because these are deemed the most important features for ETF
performance classification.
Price Sales ≤ 1.075 Price Book ≤ 1.275 Price Earnings ≤ 13.805 Price Cashflow ≤ 2.855
gini = 0.384 gini = 0.603 gini = 0.408 gini = 0.225
samples = 198 samples = 47 samples = 188 samples = 629
value = [22, 152, 24] value = [20, 21, 6] value = [33, 140, 15] value = [33, 551, 45]
gini = 0.339 gini = 0.511 gini = 0.494 gini = 0.544 gini = 0.198 gini = 0.563 gini = 0.5 gini = 0.216
samples = 160 samples = 38 samples = 26 samples = 21 samples = 102 samples = 86 samples = 4 samples = 625
value = [19, 128, 13] value = [3, 24, 11] value = [7, 12, 2] value = [13, 4, 4] value = [6, 91, 5] value = [27, 49, 10] value = [2, 0, 2] value = [31, 551, 43]
Legend:
Darkest shade, 5th (last) level: Winner (Class = +1)
Light to medium shade: Average Performer (Class = 0); note that the medium
shade indicates more confidence in the classification.
Darkest shade, 2nd level: Loser (Class = -1)
© CFA Institute. For candidate use only. Not for distribution.
230 Learning Module 6 Machine Learning
1. Explain the CART model’s prediction for performance of the new ETF: win-
ner, loser, or average performer.
Solution:
Based on its valuation ratios (P/S = 2.29; P/E = 7.20; P/B = 1.41), the new
ETF is predicted to be a winner because the decision path leads to the dark
shaded, 5th level (“winner”) terminal node. The split criteria and decisions
are as follows:
Initial node: P/S ≤ 7.93 and EFT P/S = 2.29, so True.
2nd-level node: P/E ≤ 12.08 and EFT P/E = 7.20, so True.
3rd-level node: P/S ≤ 1.32 and EFT P/S = 2.29, so False.
4th-level node: P/B ≤ 1.275 and EFT P/B = 1.41, so False.
5th-level (terminal) node: darkest shaded terminal node indicates “winner.”
2. Calculate the probability that the fund will be in the class predicted by the
CART model.
Solution:
The output from the CART model in the darkest shaded, 5th level (winner)
terminal node is [13, 4, 4], which indicates it includes 13 funds of Class +1
(winners), 4 funds of Class 0 (average performers), and 4 funds of Class -1
(losers). Thus, the probability predicted by the CART model that this ETF
will be in the “winner” class is 13/21, or 62%. There are also equal probabili-
ties of it being an average performer (19%) or a loser (19%).
3. Explain why the analyst should be cautious in basing the ETF’s predicted
performance solely on the CART-generated decision tree.
Solution:
There are several reasons why the analyst should be cautious in basing the
ETF’s predicted performance solely on the CART-generated decision tree.
First, this CART model had a maximum depth of just five levels. Truncating
at five levels facilitates visualization, but a more realistic decision path is
likely to be nuanced and so would require greater depth. Second, only some
of the important variables (from Exhibit 16) were used in generating this
tree, again for simplicity of visualization. A CART model using additional
features, including fund asset class ratios, sector composition, and, especial-
ly, net assets would be expected to generate a more accurate (using F1 score)
model. Finally, the number of funds reaching the darkest shaded, 5th level
(“winner”) terminal node (21) is small compared to the total sample size
(1,067), so there may be too few clear winners (13) under this decision path
from which to draw a statistically significant conclusion. Besides increas-
ing the maximum tree depth and adding more features, another approach
the analyst might take in this case for achieving a more accurate model is
random forest; being an ensemble classifier, a random forest model would
generalize out-of-sample better than any single CART model.
© CFA Institute. For candidate use only. Not for distribution.
Case Study: Classification of Winning and Losing Funds 231
ESG DATA AS ALTERNATIVE DATA AND ML/AI FOR INTEGRATING ESG DATA
INTO INVESTMENT DECISIONS
As an investment professional, how might you set about measuring the potential
impact of climate change on a company’s future prospects? Negative climate
outcomes in coming years may include higher temperatures, more intense storms,
melting glaciers, rising sea levels, shifting agricultural patterns, pressure on food
and water, and new threats to human health. Assessing the likely severity of these
future events and then quantifying the impact on companies is no easy task. Big
Data techniques could be pivotal in generating usable information that could
help investment professionals unlock long-term shareholder value.
Some fund managers, influenced by evolving investor preferences and
increasing disclosure by companies on non-financial issues, have already incor-
porated ESG analysis into their investment processes. Governance (“G”) data are
generally objective: Investors are able to observe and measure corporate board
actions, making governance comparable across companies and regions. Data on
Environmental (“E”) and Social (“S”) impacts on listed companies, on the other
hand, are more subjective, less reliable, and less comparable.
ESG data resemble alternative data in the sense that they have generally
been poorly defined, are complex and unstructured, and need considerable due
diligence before being used in investment decision making. Applying Machine
Learning (ML) and Artificial Intelligence (AI) techniques can transform ESG
data into meaningful information that is more useful for investment analysis.
Corporate sustainability reports often suffer from haphazard data collection
and missing values. Equally, when data vendors acquire and combine raw ESG
data into aggregate ESG scores, potential signals may be lost. ESG data and scor-
ing across companies and data vendors can lack consistency and comparability;
as a result, using simple summary scores in investment analysis is potentially
flawed. Data analysts can apply data-science methods, such as data cleansing
and data wrangling, to raw ESG data to create a structured dataset. Then, ML/AI
techniques, such as natural language processing (NLP), can be applied to text-
based, video, or audio ESG data. The foundation of NLP consists of supervised
machine learning algorithms that typically include logistic regression, SVM,
CART, random forests, or neural networks.
NLP can, for instance, search for key ESG words in corporate earnings calls.
An increase in the number of mentions of, say, “human capital,” employee “health
and safety,” or “flexible working” arrangements may indicate an increased focus
on the “S” pillar of ESG. This would potentially raise the overall ESG score of
a particular company. The results of such an application of NLP to corporate
earnings calls are illustrated in the following exhibit:
2500
2000
Num. of companies that have reported
Num. of companies menoning ESG keywords
Num. of companies
1000
500
ML/AI can help fund managers apply only those ESG factors that are rel-
evant to a company and its sector. For example, “E” factors are important for
mining and utility companies but less so for clothing manufacturers. Likewise,
“S” factors are important for the global clothing manufacturing sector but less
so for mining and utility companies.
ML/AI techniques are not used in isolation. ESG scoring systems tend to
rely on cross-functional teams, with data scientists operating in tandem with
economists, fundamental analysts, and portfolio managers to identify strengths
and weaknesses of companies and sectors. Fundamental analysts, for instance,
typically do not need to know the details of ML algorithms to make valuable
contributions to the ESG investment workflow. The industry-specific knowl-
edge of fundamental analysts can provide nuanced viewpoints that help to: 1)
identify relevant raw data; 2) enable data scientists to incorporate ESG data into
appropriate investment models; and 3) interpret model outputs and investment
implications.
Unsupervised learning is machine learning that does not use labeled data (i.e., no
target variable); thus, the algorithms are tasked with finding patterns within the data
themselves. The two main types of unsupervised ML algorithms shown in Exhibit 2
are dimension reduction, using principal components analysis, and clustering, which
includes k-means and hierarchical clustering. These will now be described in turn.
each eigenvector. The PCA algorithm orders the eigenvectors from highest to lowest
according to their eigenvalues—that is, in terms of their usefulness in explaining the
total variance in the initial data (this will be shown shortly using a scree plot). PCA
selects as the first principal component the eigenvector that explains the largest pro-
portion of variation in the dataset (the eigenvector with the largest eigenvalue). The
second principal component explains the next-largest proportion of variation remain-
ing after the first principal component; this process continues for the third, fourth,
and subsequent principal components. Because the principal components are linear
combinations of the initial feature set, only a few principal components are typically
required to explain most of the total variance in the initial feature covariance matrix.
Exhibit 18 shows a hypothetical dataset with three features, so it is plotted in three
dimensions along the x-, y-, and z-axes. Each data point has a measurement (x, y, z),
and the data should be standardized so that the mean of each series (x’s, y’s, and z’s)
is 0 and the standard deviation is 1. Assume PCA has been applied, revealing the first
two principal components, PC1 and PC2. With respect to PC1, a perpendicular line
dropped from each data point to PC1 shows the vertical distance between the data
point and PC1, representing projection error. Moreover, the distance between each
data point in the direction that is parallel to PC1 represents the spread or variation
of the data along PC1. The PCA algorithm operates in such a way that it finds PC1
by selecting the line for which the sum of the projection errors for all data points is
minimized and for which the sum of the spread between all the data is maximized.
As a consequence of these selection criteria, PC1 is the unique vector that accounts
for the largest proportion of the variance in the initial data. The next-largest portion
of the remaining variance is best explained by PC2, which is at right angles to PC1
and thus is uncorrelated with PC1. The data points can now be represented by the
first two principal components. This example demonstrates the effectiveness of the
PCA algorithm in summarizing the variability of the data and the resulting dimension
reduction.
90°
PC1:
Eigenvector that
X explains the largest
% of total variance
in the data.
PC2
Z
© CFA Institute. For candidate use only. Not for distribution.
234 Learning Module 6 Machine Learning
In this illustration, researchers use scree plots and decide that three princi-
pal components are sufficient for explaining the returns to the hypothetical
Diversified Large Cap (DLC) 500 and Very Large Cap (VLC) 30 equity indexes
over the last 10-year period. The DLC 500 can be thought of as a diversified
index of large-cap companies covering all economic sectors, while the VLC 30
is a more concentrated index of the 30 largest publicly traded companies. The
dataset consists of index prices and more than 2,000 fundamental and technical
features. Multi-collinearity among the features is a typical problem because that
many features or combinations of features tend to have overlaps. To mitigate the
problem, PCA can be used to capture the information and variance in the data.
The following scree plots show that of the 20 principal components generated,
the first 3 together explain about 90% and 86% of the variance in the value of
the DLC 500 and VLC 30 indexes, respectively. The scree plots indicate that for
each of these indexes, the incremental contribution to explaining the variance
structure of the data is quite small after about the fifth principal component.
Therefore, these less useful principal components can be ignored without much
loss of information.
© CFA Institute. For candidate use only. Not for distribution.
Clustering 235
0.6
0
0 5 10 15 20
Number of Principal Components
0.6
0
0 5 10 15 20
Number of Principal Components
The main drawback of PCA is that since the principal components are combina-
tions of the dataset’s initial features, they typically cannot be easily labeled or directly
interpreted by the analyst. Compared to modeling data with variables that represent
well-defined concepts, the end user of PCA may perceive PCA as something of a
“black box.”
Reducing the number of features to the most relevant predictors is very useful,
even when working with datasets having as few as 10 or so features. Notably, dimen-
sion reduction facilitates visually representing the data in two or three dimensions.
It is typically performed as part of exploratory data analysis, before training another
supervised or unsupervised learning model. Machine learning models are quicker
to train, tend to reduce overfitting (by avoiding the curse of dimensionality), and are
easier to interpret if provided with lower-dimensional datasets.
CLUSTERING
11
describe unsupervised machine learning algorithms—including
principal components analysis, k-means clustering, and hierarchical
clustering—and determine the problems for which they are best
suited
© CFA Institute. For candidate use only. Not for distribution.
236 Learning Module 6 Machine Learning
Clustering algorithms are particularly useful in the many investment problems and
applications in which the concept of similarity is important. Applied to grouping
companies, for example, clustering may uncover important similarities and differences
among companies that are not captured by standard classifications of companies by
industry and sector. In portfolio management, clustering methods have been used for
improving portfolio diversification.
In practice, expert human judgment has a role in using clustering algorithms. In
the first place, one must establish what it means to be “similar.” Each company can be
considered an observation with multiple features, including such financial statement
items as total revenue and profit to shareholders, a wide array of financial ratios, or
any other potential model inputs. Based on these features, a measure of similarity
or “distance” between two observations (i.e., companies) can be defined. The smaller
the distance, the more similar the observations; the larger the distance, the more
dissimilar the observations.
A commonly used definition of distance is the Euclidian distance, the straight-line
distance between two points. A closely related distance useful in portfolio diversifica-
tion is correlation, which is the average Euclidian distance between a set of standard-
ized points. Roughly a dozen different distance measures are used regularly in ML.
In practice, the choice of the distance measures depends on the nature of the data
(numerical or not) and the business problem being investigated. Once the relevant
distance measure is defined, similar observations can be grouped together. We now
introduce two of the more popular clustering approaches: k-means and hierarchical
clustering.
© CFA Institute. For candidate use only. Not for distribution.
K-Means Clustering 237
K-MEANS CLUSTERING
12
describe unsupervised machine learning algorithms—including
principal components analysis, k-means clustering, and hierarchical
clustering—and determine the problems for which they are best
suited
C1 C1 C1
C3 C3 C3
C2 C2 C2
C1
C1 C3 C1 C3
C3
C2 C2 C2
The k-means algorithm is fast and works well on very large datasets, those with hun-
dreds of millions of observations. However, the final assignment of observations to
clusters can depend on the initial location of the centroids. To address this problem,
the algorithm can be run several times using different sets of initial centroids, and
then one can choose the clustering that is most useful given the business purpose.
One limitation of this technique is that the hyperparameter, k, the number of
clusters in which to partition the data, must be decided before k-means can be run.
So, one needs to have a sense of how many clusters are reasonable for the problem
under investigation and the dataset being analyzed. Alternatively, one can run the
algorithm using a range of values for k to find the optimal number of clusters—the k
that minimizes intra-cluster distance and thereby maximizes intra-cluster similarity
(i.e., cohesion) and that maximizes inter-cluster distance (i.e., separation). However,
note that the final results can be subjective and dependent on the context of the prob-
lem and the particular training set. In practice, it is common to make the final choice
of k based on face validity, such that the clusters feel sensible and are interpretable.
This decision is greatly assisted by using summary information about the centroids
and ranges of values and naming example items in each cluster.
For example, consider the Russell 3000 Index, which tracks the 3,000 highest market
capitalization stocks in the United States. These 3,000 stocks can be grouped in 10,
50, or even more clusters based on their financial characteristics (e.g., total assets,
total revenue, profitability, leverage) and operating characteristics (e.g., employee
headcount, R&D intensity). Because companies in the same standard industry classi-
fication can have very different financial and operating characteristics, using k-means
to derive different clusters can provide insights and understanding into the nature of
“peer” groups. As mentioned, the exact choice of the k, the number of clusters, will
depend on the level of precision or segmentation desired. In a similar vein, clustering
© CFA Institute. For candidate use only. Not for distribution.
Hierarchical Clustering 239
HIERARCHICAL CLUSTERING
13
describe unsupervised machine learning algorithms—including
principal components analysis, k-means clustering, and hierarchical
clustering—and determine the problems for which they are best
suited
I I I I
H H5 H 8 H
G G G G
K 4 K K K
J J6 J J
2
C D C D C D C D
F F F F
B E B 1 E3 B E B E 9
A A A 7 A
I I I5 I
H H H H
G G G G
K 8 K 4 K K
J J J6 J
2
C D C D C D C D
F F F F
B E 9 B 7 E B 1 E3 B E
A A A A
Dendrograms
A type of tree diagram for visualizing a hierarchical cluster analysis is known as a
dendrogram, which highlights the hierarchical relationships among the clusters.
Exhibit 22 shows a dendrogram representation for the clustering shown in Exhibit
21. First, a few technical points on dendrograms bear mentioning—although they
may not all be apparent in Exhibit 22. The x-axis shows the clusters, and the y-axis
indicates some distance measure. Clusters are represented by a horizontal line, the
arch, which connects two vertical lines, called dendrites, where the height of each arch
represents the distance between the two clusters being considered. Shorter dendrites
represent a shorter distance (and greater similarity) between clusters. The horizontal
dashed lines cutting across the dendrites show the number of clusters into which the
data are split at each stage.
The agglomerative algorithm starts at the bottom of the dendrite, where each
observation is its own cluster (A to K). Agglomerative clustering then generates the six
larger clusters (1 to 6). For example, Clusters A and B combine to form Cluster 1, and
Observation G remains its own cluster, now Cluster 4. Moving up the dendrogram,
two larger clusters are formed, where, for example, Cluster 7 includes Clusters 1 to 3.
Finally, at the top of the dendrogram is the single large cluster (9). The dendrogram
readily shows how this largest cluster is composed of the two main sub-clusters (7
and 8), each having three smaller sub-clusters (1 to 3 and 4 to 6, respectively). The
dendrogram also facilitates visualization of divisive clustering by starting at the top
of the largest cluster and then working downward until the bottom is reached, where
all 11 single-observation clusters are shown.
.06 Dendrite
9
.05
.04
7 8
.03
.02
1 3 5 6
.01
2 4
0
A B C D E F G H I J K
Cluster
clusters have maximum inter-cluster separation, diversifying among them helps ensure
that the portfolio reflects a wide diversity of characteristics with well-diversified risk.
In contrast, information that investments are concentrated in a cluster indicates a
high probability of concentrated risk. Finally, it is important to note that while the
results of clustering algorithms are often difficult to evaluate (because the resulting
clusters themselves are not explicitly defined), they are still very useful in practice for
uncovering important underlying structure (namely, similarities among observations)
in complex datasets.
EXAMPLE 6
Solution:
B is correct. A machine learning clustering algorithm could be used to
implement Suggestion 2. A and C are incorrect because Suggestions 1 and 3,
respectively, can be addressed easily using traditional regression analysis.
3. The best justification for Kane’s preference for hierarchical clustering in his
reply to Lund’s second question is that Kane is most likely giving consider-
ation to:
A. the speed of the algorithms.
B. the dimensionality of the dataset.
C. the need to specify the hyperparameter, k, in using a k-means
algorithm.
Solution:
C is correct. The value of the hyperparameter, k, the number of distinct
groups into which the STOXX Europe 600 Index can be segmented, is not
known and needs to be specified in advance by the analyst. Using a hierar-
chical algorithm, the sorting of observations into clusters will occur without
any prior input on the analyst’s part.
The following case study was developed and written by Matthew Dixon, PhD, FRM.
An endowment fund’s Investment Committee is seeking three “buy” recommenda-
tions for the fund’s large-cap equity portfolio. An analyst working for the Investment
Committee is given a subset of eight stocks from the S&P 500 Index and asked to
determine the co-movement similarity (i.e., correlation) of their returns. Specifically,
© CFA Institute. For candidate use only. Not for distribution.
244 Learning Module 6 Machine Learning
for diversification purposes, the Investment Committee wants the correlation of returns
between the recommended stocks to be low, so the analyst decides to use clustering to
identify the most similar stocks and then choose one stock from each cluster. Although
this case study focuses mainly on hierarchical agglomerative clustering, the analyst’s
results using other clustering algorithms (i.e., divisive clustering and k-means) are also
briefly discussed. Exhibit 23 provides a description of the data used by the analyst.
Exhibit 23: Dataset of Eight Stocks from the S&P 500 Index
Stocks (Ticker Symbols): AAPL, F, FB, GM, GS, GOOG, JPM, and UBS
The following steps are taken by the analyst to perform the hierarchical agglom-
erative cluster analysis:
1. Collect panel data on adjusted closing prices for the stocks under
investigation.
2. Calculate the daily log returns for each stock, where each time series of
stock returns is an n-vector (n = 500).
3. Run the agglomerative hierarchical clustering algorithm.
b. The algorithm starts with each stock as its own cluster, finds the pair of
clusters which are closest to each other, and then redefines them as a
new cluster.
c. The algorithm finds the distances from this new cluster to the remain-
ing return clusters. Using a process called average (centroid) linkage,
it determines the distances from the center of the new cluster to the
centers of the remaining clusters. Note that there are several other link-
age methods, but whichever method is selected, the algorithm proceeds
in the same fashion: It combines the pair of clusters which are closest,
redefines them as a new cluster, and recalculates the distances to the
remaining clusters.
4. Repeat Step 3c until the data are aggregated into a single large cluster.
5. Plot the resulting dendrogram to visualize the hierarchical clusters and
draw the highest horizontal line intersecting three (i.e., the desired number
of clusters, since the Investment Committee wants three “buy” recommen-
dations) vertical lines (or dendrites) to determine the appropriate cluster
configuration.
Exhibit 24 shows for illustrative purposes a subset of the panel data on daily returns,
calculated from the adjusted closing prices of the eight stocks collected in Step 1. The
clustering is performed on the daily returns.
© CFA Institute. For candidate use only. Not for distribution.
Case Study: Clustering Stocks Based on Co-Movement Similarity 245
Exhibit 24: Subset of Stock Returns, Calculated from Adjusted Closing Prices, for Clustering
The results of the remaining steps are described using the distance matrix shown in
Exhibit 25.
The distance matrix reveals the closest pair of stocks is JPM and GS, with a distance
of 0.215. Therefore, this pair becomes the first combined cluster as shown in the den-
drogram in Exhibit 26. Note that the vertical distance connecting the various clusters
represents the Euclidean distance between clusters, so the arch between this pair has
a height of 0.215. Now that JPM and GS are paired in a cluster (i.e., GS_JPM), we treat
the mean of their two return vectors as a new point.
.04
.03
.02
.01
0
FB GM F UBS JPM GS AAPL GOOG
Symbols
© CFA Institute. For candidate use only. Not for distribution.
246 Learning Module 6 Machine Learning
From the distance matrix, the average distance of UBS to the new cluster (i.e., GS_JPM)
is the sum of the distance between UBS and JPM, 0.243, and the distance between
UBS and GS, 0.281, divided by two, which is 0.262 (= (0.243 + 0.281)/2). Since this
distance is smaller than the distance between any of the other unpaired stock clusters,
UBS is merged with this cluster to create a new cluster (i.e., GS_JPM_UBS). The height
of the arch in the dendrogram for this new cluster is 0.262, which is now observed
to contain three banking sector stocks. Although not shown in the dendrogram, the
cluster is identified by the return vector averaged over the three stocks.
The next closest pair of points, whether stock to stock or stock to cluster, is AAPL
and GOOG, with a distance of 0.307, so the algorithm merges these two points into a
second cluster (i.e., AAPL_GOOG), with an arch height of 0.307. Next, GM and F are
paired into a third cluster (i.e., F_GM), with an arch height of 0.334. Finally, the first
two clusters are merged to form a five-stock cluster (i.e., GS_JPM_UBS_AAPL_GOOG),
with an arch height of 0.356. Note that this value is determined by taking the average
distance between the three banks and AAPL and GOOG: 0.356 = (0.364 + 0.380 +
0.375 + 0.332 + 0.338 + 0.345)/6. The result is three separate clusters: the five-stock
cluster, F_GM, and FB by itself. Also, note the horizontal dashed line that cuts the
dendrogram into three distinct clusters, with FB as its own cluster.
This agglomerative hierarchical clustering analysis reveals some interesting prelim-
inary results—largely grouping the stocks by their sectors but also uncovering some
anomalies. In particular, FB is found to behave quite differently, in terms of return
co-movement similarity, from the other technology stocks (AAPL and GOOG). Also,
AAPL and GOOG are found to behave more like the bank stocks and less like the
auto stocks (F and GM), which appear in their own cluster.
In contrast to agglomerative clustering, the divisive clustering algorithm starts with
all stocks assigned to one large cluster and then splits the cluster into sub-clusters
recursively, until each stock occupies its own cluster. Determining how to split the
first cluster requires searching over all combinations of possible splits, so it is too
numerically intensive to cover the details here. However, results of the first two splits
for divisive clustering, into three clusters, are shown in Exhibit 27. Results for k-means,
with k = 3, and agglomerative clustering are also presented.
#1 #2 #2
FB F, GM #1 #1 #2
AAPL, FB,
F, GM F, GM, AAPL,
GOOG
GS, JPM, UBS GOOG
#3 #3
AAPL, GOOG, GS, JPM, #3
GS, JPM, UBS UBS FB
Whereas the assignment of the cluster number (1, 2, 3), shown in the upper panel,
can be taken as arbitrary across each algorithm, the useful information is in the
grouping of like stocks. As seen in the stylized clusters in the lower panel, all three
clustering algorithms agree that bank stocks belong in the same cluster. Both hier-
archical agglomerative and k-means algorithms also agree that auto stocks belong in
their own separate cluster. K-means clusters the stocks precisely by industry sector,
whereas hierarchical agglomerative and divisive clustering identify FB as an outlier
and place it in its own cluster. In general, the most agreement is expected between the
two hierarchical clustering algorithms, although their results are not guaranteed to
match, even when using the same linkage process. K-means starts with three clusters
(k = 3) and iteratively swaps points in and out of these clusters using a partitioning
mechanism different from that of hierarchical clustering. Thus, k-means results are
typically not expected to match those of hierarchical clustering.
In conclusion, based on the analyses of the co-movement similarity of returns
among the eight stocks using the agglomerative clustering algorithm and the Investment
Committee’s requirement that the correlation of returns between the recommended
stocks should be low, the analyst’s recommendation should be as follows:
■ buy FB,
■ buy the most attractive of the two auto stocks (F or GM), and
■ buy the most attractive of the three bank stocks (GS, JPM, or UBS).
EXAMPLE 7
Solution:
The panel data on closing prices and daily log returns would include the
same stocks as before but without F and GM—so, AAPL, FB, GOOG, GS,
JPM, and UBS. The distance matrix would also appear the same except
without F, GM, or any of the pairwise distances between them and the
remaining stocks.
© CFA Institute. For candidate use only. Not for distribution.
248 Learning Module 6 Machine Learning
2. Describe the three clusters that would now result from running the hierar-
chical agglomerative clustering algorithm.
Solution:
The three clusters that would now result from running the agglomera-
tive clustering algorithm are GS_JPM_UBS (i.e., one cluster of three bank
stocks), AAPL_GOOG (i.e., one cluster of two technology stocks), and FB
by itself.
3. Explain why these results differ from the previous case, with eight stocks
(including the two auto stocks).
Solution:
The agglomerative clustering algorithm now combines GS and JPM and
then UBS, as before, to form a bank cluster. Next, and as previously, the
algorithm combines AAPL and GOOG into a cluster. However, without
the auto stocks, there is no need to combine AAPL_GOOG with the bank
cluster. There are now three distinct clusters, since (as before) the algorithm
treats FB as its own cluster, given the high degree of return co-movement
dissimilarity between FB and the other clusters (i.e., AAPL_GOOG, and
GS_JPM_UBS).
Solution:
The analyst’s new recommendation to the Investment Committee would be
to buy FB, buy the cheapest of AAPL or GOOG, and buy the most attractive
of the three bank stocks (GS, JPM, or UBS).
The artificial intelligence revolution has been driven in large part by advances in neural
networks, deep learning algorithms, and reinforcement learning. These sophisticated
algorithms can address highly complex machine learning tasks, such as image classi-
fication, face recognition, speech recognition, and natural language processing. These
complicated tasks are characterized by non-linearities and interactions between large
numbers of feature inputs. We now provide an overview of these algorithms and their
investment applications.
Neural Networks
Neural networks (also called artificial neural networks, or ANNs) are a highly flexible
type of ML algorithm that have been successfully applied to a variety of tasks charac-
terized by non-linearities and complex interactions among features. Neural networks
© CFA Institute. For candidate use only. Not for distribution.
Neural Networks, Deep Learning Nets, and Reinforcement Learning 249
are commonly used for classification and regression in supervised learning but are
also important in reinforcement learning, which does not require human-labeled
training data.
Exhibit 28 shows the connection between multiple regression and neural networks.
Panel A represents a hypothetical regression for data using four inputs, the features
x1 to x4, and one output—the predicted value of the target variable y. Panel B shows a
schematic representation of a basic neural network, which consists of nodes (circles)
connected by links (arrows connecting nodes). Neural networks have three types of
layers: an input layer (here with a node for each of the four features); hidden layers,
where learning occurs in training and inputs are processed on trained nets; and an
output layer (here consisting of a single node for the target variable y), which passes
information outside the network.
Besides the network structure, another important difference between multiple
regression and neural networks is that the nodes in the neural network’s hidden layer
transform the inputs in a non-linear fashion into new values that are then combined
into the target value. For example, consider the popular rectified linear unit (ReLU)
function, f(x) = max(0, x), which takes on a value of zero if there is a negative input and
takes on the value of the input if it is positive. In this case, y will be equal to β1 times
z1, where z1 is the maximum of (x1 + x2 + x3) or 0, plus β2 times z2, the maximum of
(x2 + x4) or 0, plus β3 times z3, the maximum of (x2 + x3 + x4) or 0, plus an error term.
x1 x1
z1
x2
x2
z2 y
y x3
x3 z3
x4
x4 y = β1 max(0, x1 + x2 + x3) + β2 max(0, x2 + x4) +
β3 max(0, x2 + x3 + x4) + ε = β1z1 + β2z2 +
y = β1x 1 + β2x2 + β3x3 + β4x4 + ε β3z3 + ε, where z is rectified linear unit function
f(x) = max(0,x)
Note that for neural networks, the feature inputs would be scaled (i.e., standardized)
to account for differences in the units of the data. For example, if the inputs were
positive numbers, each could be scaled by its maximum value so that their values lie
between 0 and 1.
Exhibit 29 shows a more complex neural network, with an input layer consisting
of four nodes (i.e., four features), one hidden layer consisting of five hidden nodes,
and an output node. These three numbers—4, 5, and 1—for the neural network are
hyperparameters that determine the structure of the neural network.
© CFA Institute. For candidate use only. Not for distribution.
250 Learning Module 6 Machine Learning
Exhibit 29: A More Complex Neural Network with One Hidden Layer
Input 1
Input 2
Ouput
Input 3
Input 4
Now consider any of the nodes to the right of the input layer. These nodes are sometimes
called “neurons” because they process information received. Take the topmost hidden
node. Four links connect to that node from the inputs, so the node gets four values
transmitted by the links. Each link has a weight meant to represent its importance
(initially these weights may be assigned randomly). Each node has, conceptually, two
functional parts: a summation operator and an activation function. Once the node
receives the four input values, the summation operator multiplies each value by its
respective weight and then sums the weighted values to form the total net input. The
total net input is then passed to the activation function, which transforms this input
into the final output of the node. Informally, the activation function operates like a light
dimmer switch that decreases or increases the strength of the input. The activation
function, which is chosen by the modeler (i.e., a hyperparameter), is characteristically
non-linear, such as an S-shaped (sigmoidal) function (with output range of 0 to 1) or
the rectified linear unit function shown in Panel B of Exhibit 28. Non-linearity implies
that the rate of change of output differs at different levels of input.
This activation function is shown in Exhibit 30, where in the left graph a negative
total net input is transformed via the S-shaped function into an output close to 0.
This low output implies the node does not trigger, so there is nothing to pass to the
next node. Conversely, in the right graph a positive total net input is transformed into
an output close to 1, so the node does trigger. The output of the activation function
is then transmitted to the next set of nodes if there is a second hidden layer or, as in
this case, to the output layer node as the predicted value. The process of transmis-
sion just described (think of forward pointing arrows in Exhibit 29) is referred to as
forward propagation.
© CFA Institute. For candidate use only. Not for distribution.
Neural Networks, Deep Learning Nets, and Reinforcement Learning 251
Sigmoid Sigmoid
Function Function
0 0
– Summation Operator + – Summation Operator +
Total Net Input Total Net Input
Dimmer Dimmer
Switch Switch
Starting with an initialized set of random network weights (i.e., the weights assigned
to each of the links), training a neural network in a supervised learning context is an
iterative process in which predictions are compared to actual values of labeled data
and evaluated by a specified performance measure (e.g., mean squared error). Then,
the network weights are adjusted to reduce total error of the network. (If the process
of adjustment works backward through the layers of the network, this process is called
backward propagation). Learning takes place through this process of adjustment
to the network weights with the aim of reducing total error. Without proliferating
notation relating to nodes, the gist of the updating can be expressed informally as
New weight
= (Old weight) – (Learning rate) × (Partial derivative of the total error with respect
to the old weight),
where partial derivative is a gradient or rate of change of the total error with respect
to the change in the old weight and learning rate is a hyperparameter that affects
the magnitude of adjustments. When learning is completed, all the network weights
have assigned values; these are the parameters of the network.
The structure of a network in which all the features are interconnected with
non-linear activation functions allows neural networks to uncover and approximate
complex non-linear relationships among features. Broadly speaking, when more nodes
and more hidden layers are specified, a neural network’s ability to handle complexity
tends to increase (but so does the risk of overfitting).
Asset pricing is a noisy, stochastic process with potentially unstable relationships
that challenge modeling processes, so researchers are asking if machine learning can
improve our understanding of how markets work. Research comparing statistical and
machine learning methods’ abilities to explain and predict equity prices so far indicates
that simple neural networks produce models of equity returns at the individual stock
and portfolio level that are superior to models built using traditional statistical methods
due to their ability to capture dynamic and interacting variables. This suggests that
ML-based models, such as neural networks, may simply be better able to cope with
the non-linear relationships inherent in security prices. However, the trade-offs in
using neural networks are their lack of interpretability (i.e., black box nature) and the
large amounts of data and high computation intensity needed to train such models;
thus, neural networks may not be a good choice in many investment applications.
© CFA Institute. For candidate use only. Not for distribution.
252 Learning Module 6 Machine Learning
The previous discussion of neural networks was limited to types of neural networks
referred to as “shallow neural networks”—exhibiting just one hidden layer. Neural
networks with many hidden layers—at least 2 but potentially more than 20—are known
as deep neural networks (DNNs). DNNs are the foundation of deep learning and
have proven to be successful across a wide range of artificial intelligence applications.
Advances in DNNs have driven developments in many complex activities, such as
image, pattern, and speech recognition. To state the operation of DNNs succinctly,
they take a set of inputs x from a feature set (the input layer), which are then passed
to a layer of non-linear mathematical functions (neurons) with weights wij (for neuron
i and input j), each of which usually produces a scaled number in the range (0, 1) or
(–1, 1). These numbers are then passed to another layer of functions and into another
and so on until the final layer produces a set of probabilities of the observation being
in any of the target categories (each represented by a node in the output layer). The
DNN assigns the category based on the category with the highest probability. The
DNN is trained on large datasets; during training, the weights, wi, are determined to
minimize a specified loss function.
In practice, while the number of nodes in the input and the output layers are typ-
ically determined by the characteristics of the features and predicted output, many
model hyperparameters still must be decided, particularly the number of hidden layers,
the number of nodes per hidden layer, and their connectivity and activation architec-
ture. The objective is to choose them to achieve the best out-of-sample performance,
but it is still a challenge with no simple solution. As such, a good starting point is
a “reasonable” guess for hyperparameters based on experience and literature. The
researcher can then observe the result and adjust the hyperparameters incrementally
until the model performance goal is reached. In practice, DNNs require substantial
time to train, and systematically varying the hyperparameters may not be feasible. So,
for many problems with relatively small datasets, one can start with just two or three
hidden layers and a few hundred nodes before tuning the parameters until a model
with acceptable predictive power is achieved.
DNNs have been shown to be useful in general for pattern recognition problems
(e.g., character and image recognition), credit card fraud detection, vision and con-
trol problems in autonomous cars, natural language processing (such as machine
translation), and other applications. DNNs have become hugely successful because
of a confluence of three developments: (1) the availability of large quantities of
machine-readable data to train models, (2) advances in analytical methods for fitting
these models, and (3) fast computers, especially new chips in the graphics processing
unit (GPU) class, tailored for the type of calculations done on DNNs.
Several financial firms are experimenting with DNNs for trading as well as auto-
mating their internal processes. Culkin and Das (2017) described how they trained
DNNs to price options, mimicking the Black–Scholes–Merton model. Their research
used the same six input parameters for the model as input layer features—spot price,
strike, time to maturity, dividend yield, risk-free interest rate, and volatility—with four
hidden layers of 100 neurons each and one output layer. The predicted option prices
out-of-sample were very close to the actual option prices: A regression of predicted
option prices on actual prices had an R2 of 99.8%.
© CFA Institute. For candidate use only. Not for distribution.
Deep Neural Networks 253
Reinforcement Learning
Reinforcement learning (RL) made headlines in 2017 when DeepMind’s AlphaGo pro-
gram beat the reigning world champion at the ancient game of Go. The RL framework
involves an agent that is designed to perform actions that will maximize its rewards
over time, taking into consideration the constraints of its environment. In the case of
AlphaGo, a virtual gamer (the agent) uses his or her console commands (the actions)
with the information on the screen (the environment) to maximize his or her score
(the reward). Unlike supervised learning, reinforcement learning has neither direct
labeled data for each observation nor instantaneous feedback. With RL, the algorithm
needs to observe its environment, learn by testing new actions (some of which may
not be immediately optimal), and reuse its previous experiences. The learning sub-
sequently occurs through millions of trials and errors. Academics and practitioners
are applying RL in a similar way in investment strategies where the agent could be a
virtual trader who follows certain trading rules (the actions) in a specific market (the
environment) to maximize its profits (its reward). The success of RL in dealing with
the complexities of financial markets is still an open question.
EXAMPLE 8
Solution:
A deep neural network is a neural network (NN) with many hidden layers
(at least 2 but often more than 20). NNs and DNNs have been successfully
applied to a wide variety of complex tasks characterized by non-linearities
and interactions among features, particularly pattern recognition problems.
© CFA Institute. For candidate use only. Not for distribution.
254 Learning Module 6 Machine Learning
Solution:
Mitsui wants to detect patterns of potential style drift in the daily trading of
nearly 100 external asset managers in many markets. This task will involve
the processing of huge amounts of complicated data. Monroe is correct that
a DNN is well suited to PEPF’s needs.
Solution:
The input layer, the hidden layers, and the output layer constitute the three
groups of layers of DNNs. The input layer receives the inputs (i.e., features)
and has as many nodes as there are dimensions of the feature set. The hid-
den layers consist of nodes, each comprising a summation operator and an
activation function that are connected by links. These hidden layers are, in
effect, where the model is learned. The final layer, the output layer, produc-
es a set of probabilities of an observation being in any of the target style
categories (each represented by a node in the output layer). For example, if
there are three target style categories, then three nodes in the output layer
are activated to produce outputs that sum to one. So, output (Style Category
I, 0.7; Style Category II, 0.2; Style Category III, 0.1) would indicate that the
model assigns the greatest probability to an observation being in Style Cat-
egory I and the least probability to Style Category III. The DNN assigns the
observation to the style category with the highest probability.
The following case study was developed and written by Matthew Dixon, PhD, FRM.
An investment manager wants to select stocks based on their predicted performance
using a fundamental equity factor model. She seeks to capture superior performance
from stocks with the largest excess return using a non-linear factor model and so
chooses a deep neural network to predict the stock returns. The goal of this mini-case
study is to demonstrate the application of deep neural networks to fundamental equity
factor modeling. We shall focus on using feed-forward (i.e., forward propagation)
network regression in place of ordinary least squares linear regression. Since neural
networks are prone to over-fitting, we shall use LASSO penalization, the same penalty
score–based approach used previously with regression, to mitigate this issue.
© CFA Institute. For candidate use only. Not for distribution.
Case Study: Deep Neural Network–Based Equity Factor Model 255
Introduction
Cross-sectional fundamental factor models are used extensively by investment manag-
ers to capture the effects of company-specific factors on individual securities. A fixed
universe of N assets is first chosen, together with a set of K fundamental factors. Each
asset’s sensitivity (i.e., exposure or loading) to a fundamental factor is represented by
beta, B, and the factors are represented by factor returns (ft). There are two standard
approaches to estimating a factor model: (i) adopt time-series regression (TSR) to
recover loadings if factors are known or (ii) use cross-sectional regression (CSR)
to recover factor returns from known loadings. We shall follow the CSR approach;
the factor exposures are used to predict a stock’s return (rt) by estimating the factor
returns using multivariate linear regression (where εt is the model error at time t):
rt = B ft+ ε t.
However, this CSR model is too simplistic to capture non-linear relationships between
stock returns and fundamental factors. So, instead we use a deep neural network to
learn the non-linear relationships between the betas (B) and asset returns (rt ) at each
time t. The goal of deep learning is to find the network weights which minimize the
out-of-sample mean squared error (MSE) between the predicted stock returns, ˆ r , and
the observed stock returns, r. We shall see that simply increasing the number of neurons
in the network will increase predictive performance using the in-sample data but to
the detriment of out-of-sample performance; this phenomenon is the bias–variance
trade-off. To mitigate this effect, we add a LASSO penalty term to the loss function
to automatically shrink the number of non-zero weights in the network. In doing so,
we shall see that this leads to better out-of-sample predictive performance.
Note that each weight corresponds to a link between a node in the previous and
current layer. Reducing the number of weights generally means that the number of
connections—not the number of nodes—is reduced. The exception is when all weights
from the neurons in the previous layer are set to zero—in which case the number of
nodes in the current layer would be reduced. In the special case when the previous
layer is the input layer, the number of features is also reduced.
We shall illustrate the data preparation and the neural network fitting using six
fundamental equity factors. This choice of number and type of fundamental factor
is arbitrary, and an investment manager may use many more factors in her or his
model, often representing industry sectors and sub-sectors using dummy variables.
Data Description
A description of the stock price and fundamental equity factor data used for training
and evaluating the neural network is shown in Exhibit 31.
Description:
We define the universe as the top 250 stocks from the S&P 500, ranked by market
capitalization as of June 2010. All stock prices and factor loadings are sourced from
Bloomberg. An illustrative extract of the data is given in Exhibit 32. Note that after
removing stocks with missing factor loadings, we are left with 218 stocks.
Exhibit 32: Extract of Six Factor Loadings and Return for Three Selected Stocks
Experimental Design
The method used to train the deep neural network is time-series cross-validation
(i.e., walk-forward optimization), as depicted in Exhibit 33. At each time period, the
investment manager fits a new model; each factor (f1 to f6) is a feature in the network,
and the loadings of the factors for each stock is a feature vector observation (i.e., the
set of observations for each stock for each period), leading to N = 218 observations of
pairs of feature vectors and output (monthly return, rt) in the training set per period.
The network is initially trained at period t, and then it is tested over the next period,
t +1, which also has N = 218 observations of pairs of feature vectors and output. In
the next iteration, the t + 1 data become the new training set and the revised model
is tested on the t + 2 data. The walk-forward optimization of the neural network
continues until the last iteration: model training with t + 99 data (from Period 100)
and testing with t + 100 data (from the last period, 101).
© CFA Institute. For candidate use only. Not for distribution.
Case Study: Deep Neural Network–Based Equity Factor Model 257
f1, t+11 ... f1, t+1218 ... f1, t+21 ... f1, t+2218 ...
... ...
f6, t+11 f6, t+1218 f6, t+21 f6, t+2218
rt+11 rt+1218 rt+21 rt+2218
f1, t1 ... f6, t1 f1, t218 ... f1, t+11 ... f1, t+1218 ...
... ...
rt1 f6, t218 f6, t+11 f6, t+1218
rt218 rt+11 rt+1218
We use a feed-forward neural network with six input nodes (i.e., neurons), two hidden
layers, and one output neuron. There are 50 neurons in each hidden layer to inten-
tionally over-specify the number of parameters needed in the model, meaning bias
(variance) is substantially lower (higher) than optimal. LASSO penalization is then
used to automatically shrink the parameter set. Additionally, it is important for the
number of nodes in each hidden layer not to exceed the number of observations in the
training set (50 nodes per layer versus 218 observations). The model training in period
t involves finding the optimal bias-versus-variance trade-off. Once fitted, we record
the in-sample MSE and the out-of-sample MSE in addition to the optimal regulariza-
tion parameter. This procedure is then repeated sequentially over the horizon of 100
remaining periods, tuning the hyperparameters at each stage using cross-validation.
The end result of this procedure is a fitted model, trained monthly on the current
cross-sectional data and for which hyperparameters have been tuned at each step.
Results
Exhibit 34 presents the results from model evaluation; it compares the in-sample and
out-of-sample MSEs of the deep neural network over all 101 months. Note that the
out-of-sample error (dotted line) is typically significantly larger than the in-sample
error (solid line). However, as the time periods pass and the model is repeatedly
trained and tested, the difference between the out-of-sample and in-sample MSEs
narrows dramatically.
© CFA Institute. For candidate use only. Not for distribution.
258 Learning Module 6 Machine Learning
Exhibit 34: In-Sample and Out-of-Sample MSE for Each Training and Testing
Period
MSE
0.10
0.08
0.06
0.04
0.02
0
0 20 40 60 80 100
Periods
In-Sample Out-of-Sample
Exhibit 35 shows the effect of LASSO regularization on the in-sample MSE (lower
panel, B) and the out-of-sample MSE (upper panel, A) for the first iteration of the
time-series cross-validation (training with data from period t and testing with data from
period t +1). The degree of LASSO regularization needed is found by cross-validation
using 50 neurons in each hidden layer. Increasing the LASSO regularization, which
reduces the number of non-zero weights in the model, introduces more bias and
hence increases the in-sample error. Conversely, increasing the LASSO regularization
reduces the model’s variance and thereby reduces the out-of-sample error. Overall,
the amount of LASSO regularization needed is significant, at 0.10; typically the reg-
ularization hyperparameter is between 0.001 and 1.0. Also, the out-of-sample and
in-sample MSEs have not yet converged. There is still a substantial gap, of roughly
0.0051 (= 0.01025 – 0.0052), and the slope of the curves in each plot suggests the
optimal value of the regularization hyperparameter is significantly more than 0.10.
Note that the value of the regularization hyperparameter is not interpretable and
does not correspond to the number of weights eliminated. Suffice it to say, the larger
the value of the regularization hyperparameter, the more the loss is being penalized.
© CFA Institute. For candidate use only. Not for distribution.
Case Study: Deep Neural Network–Based Equity Factor Model 259
0.0130
0.0125
0.0120
0.0115
0.0110
0.0105
0
0 0.02 0.04 0.06 0.08 0.10
L1 Regularization
B.
MSE In-Sample
0.0052
0.0050
0.0048
0.0046
0.0044
0.0042
0 0.02 0.04 0.06 0.08 0.10
L1 Regularization
It is important to recognize that although the out-of-sample MSE of this deep learn-
ing neural network is key to characterizing its predictive performance, it does not
necessarily follow that a stock selection strategy based on the neural network will be
successful. This is because the neural network predicts the next month’s expected
(i.e., mean) asset returns and not the full distribution of returns. Hence a simple stock
selection strategy—measured by information ratios (recall the information ratio, or
IR, is alpha divided by nonsystematic risk, so it measures the abnormal return per
unit of risk for a well-diversified portfolio) of the portfolio returns—that selects stocks
ranked by predicted returns will not necessarily lead to positive information ratios.
Exhibit 36 presents the information ratios found by back-testing a simple stock
selection strategy that picks the top performing stocks determined by the neural net-
work’s forecasted returns realized in month t +1 using features observed in month t.
Note these IRs do not account for transaction costs, interest rates, or any other fees.
The upper panel (A) shows the best-case scenario; the neural network in-sample
prediction is used to select the n (where n is 10, 15, 20, or 25) top performing stocks.
The IRs are shown for each of the different-sized portfolios; they range from 0.697
© CFA Institute. For candidate use only. Not for distribution.
260 Learning Module 6 Machine Learning
to 0.623. Note that as a rule of thumb, IRs in the range of 0.40–0.60 are considered
quite good. The lower panel (B) shows the IRs from back-test results for the same
strategy applied to the out-of-sample data. The out-of-sample IRs range from 0.260
to 0.315 and so are substantially smaller than in-sample IRs.
0.5
0.4
0.3
0.2
0.1
0
10 15 20 25
Number of Stocks
B.
Information Ratio (Out-of-Sample)
0.40
0.35
0.3108 0.3078 0.3149
0.30
0.2600
0.25
0.20
0.15
0.10
0.05
0
10 15 20 25
Number of Stocks
EXAMPLE 9
1. Describe how Jane would modify the inputs of the neural network architec-
ture for this new dataset.
Solution:
Jane adds four more fundamental factors and 11 dummy variables, to repre-
sent each industrial sector, for a total of 21 (= 4 + 11 + 6) features. Therefore,
the refined neural network will have 21 input neurons. The output layer will
remain the same. Note that concerns of collinearity of the features through
the dummy variables or high correlation, which are problematic for linear
regression, are not an issue for a deep learning–based model.
Solution:
There are now data on 420 stocks, for each of the 101 time periods, consist-
ing of factor loadings for the 21 features and the monthly return for each
stock. Per the time-series cross-validation method, the test dataset in the
current iteration will become the training dataset in the next iteration.
Solution:
Jane should find the new optimal LASSO regularization hyperparameter
using time-series cross-validation. Alternatively, she may find the optimal
bias–variance trade-off by first increasing the number of neurons in the
hidden layers and then performing the cross-validation.
4. Explain how Jane should evaluate whether the new model leads to improved
portfolio performance.
Solution:
Once Jane has found the optimal LASSO hyperparameter and network
architecture, she will use the model to forecast the out-of-sample monthly
asset returns (i.e., the model forecasts from factor loadings which are not in
the training set). She will then rank and select the top predicted perform-
ers and finally measure the realized monthly portfolio return. She will then
repeat the experiment by moving forward one month in the dataset and re-
peating the out-of-sample forecast of the asset returns, until she has gener-
ated forecasts for all time periods. Finally, Jane will calculate the information
ratios from the mean and standard deviation of the monthly portfolio excess
returns.
© CFA Institute. For candidate use only. Not for distribution.
262 Learning Module 6 Machine Learning
EXAMPLE 10
Exhibit 37 presents a simplified decision flowchart for choosing among the machine
learning algorithms which have been discussed. The dark-shaded ovals contain the
supervised ML algorithms, the light-shaded ovals contain the unsupervised ML
algorithms, and the key questions to consider are shown in the unshaded rounded
rectangles.
© CFA Institute. For candidate use only. Not for distribution.
264 Learning Module 6 Machine Learning
Classification
KNN or CART,
Random Forests, Dimension
SVM Start
Neural Nets Reduction
No Yes PCA
Complex Yes
Non-linear Complexity
Data? Reduction?
No
Yes
Labeled Yes No Numerical
Data? Classification? Prediction?
No Yes
Complex
Non-linear Complex
No Data? Non-linear
Yes Data?
No Yes
Number of
Categories Neural
Known? Nets Penalized CART,
No
Yes Regression Random Forests
LASSO Neural Nets
Hierarchical
K-Means
Clustering
Regression
Clustering
First, start by asking, Are the data complex, having many features that are highly
correlated? If yes, then dimension reduction using principal components analysis is
appropriate.
Next, is the problem one of classification or numerical prediction? If numerical
prediction, then depending on whether the data have non-linear characteristics, the
choice of ML algorithms is from a set of regression algorithms—either penalized
regression/LASSO for linear data or CART, random forest, or neural networks for
non-linear data.
If the problem is one of classification, then depending on whether the data are
labeled, the choice is either from a set of classification algorithms using labeled data
or from a set of clustering algorithms using unlabeled data.
If the data are labeled, then depending on whether the data have non-linear char-
acteristics, the choice of classification algorithm would be K-nearest neighbor and
support vector machine for linear data or CART, random forest, or neural networks
(or deep neural networks) for non-linear data.
Finally, if the data are unlabeled, the choice of clustering algorithm depends on
whether the data have non-linear characteristics. The choice of clustering algorithm
would be neural networks (or deep neural networks) for non-linear data or for linear
data, K-means with a known number of categories and hierarchical clustering with
an unknown number of categories.
© CFA Institute. For candidate use only. Not for distribution.
Choosing an Appropriate ML Algorithm 265
SUMMARY
Machine learning methods are gaining usage at many stages in the investment man-
agement value chain. Among the major points made are the following:
■ Machine learning aims at extracting knowledge from large amounts of data
by learning from known examples to determine an underlying structure in
the data. The emphasis is on generating structure or predictions without
human intervention. An elementary way to think of ML algorithms is to
“find the pattern, apply the pattern.”
■ Supervised learning depends on having labeled training data as well as
matched sets of observed inputs (X’s, or features) and the associated out-
put (Y, or target). Supervised learning can be divided into two categories:
regression and classification. If the target variable to be predicted is continu-
ous, then the task is one of regression. If the target variable is categorical or
ordinal (e.g., determining a firm’s rating), then it is a classification problem.
■ With unsupervised learning, algorithms are trained with no labeled data,
so they must infer relations between features, summarize them, or present
underlying structure in their distributions that has not been explicitly pro-
vided. Two important types of problems well suited to unsupervised ML are
dimension reduction and clustering.
■ In deep learning, sophisticated algorithms address complex tasks (e.g.,
image classification, natural language processing). Deep learning is based
on neural networks, highly flexible ML algorithms for solving a variety
of supervised and unsupervised tasks characterized by large datasets,
non-linearities, and interactions among features. In reinforcement learning,
a computer learns from interacting with itself or data generated by the same
algorithm.
■ Generalization describes the degree to which an ML model retains its
explanatory power when predicting out-of-sample. Overfitting, a primary
reason for lack of generalization, is the tendency of ML algorithms to tailor
models to the training data at the expense of generalization to new data
points.
■ Bias error is the degree to which a model fits the training data. Variance
error describes how much a model’s results change in response to new data
from validation and test samples. Base error is due to randomness in the
data. Out-of-sample error equals bias error plus variance error plus base
error.
■ K-fold cross-validation is a technique for mitigating the holdout sample
problem (excessive reduction of the training set size). The data (excluding
test sample and fresh data) are shuffled randomly and then divided into k
equal sub-samples, with k – 1 samples used as training samples and one
sample, the kth, used as a validation sample.
■ Regularization describes methods that reduce statistical variability in
high-dimensional data estimation or prediction problems via reducing
model complexity.
■ LASSO (least absolute shrinkage and selection operator) is a popular type of
penalized regression where the penalty term involves summing the absolute
values of the regression coefficients. The greater the number of included
features, the larger the penalty. So, a feature must make a sufficient contri-
bution to model fit to offset the penalty from including it.
© CFA Institute. For candidate use only. Not for distribution.
266 Learning Module 6 Machine Learning
■ Support vector machine (SVM) is a classifier that aims to seek the optimal
hyperplane—the one that separates the two sets of data points by the maxi-
mum margin (and thus is typically used for classification).
■ K-nearest neighbor (KNN) is a supervised learning technique most often
used for classification. The idea is to classify a new observation by finding
similarities (“nearness”) between it and its k-nearest neighbors in the exist-
ing dataset.
■ Classification and regression tree (CART) can be applied to predict either a
categorical target variable, producing a classification tree, or a continuous
target variable, producing a regression tree.
■ A binary CART is a combination of an initial root node, decision nodes, and
terminal nodes. The root node and each decision node represent a single
feature (f) and a cutoff value (c) for that feature. The CART algorithm iter-
atively partitions the data into sub-groups until terminal nodes are formed
that contain the predicted label.
■ Ensemble learning is a technique of combining the predictions from a
collection of models. It typically produces more accurate and more stable
predictions than any single model.
■ A random forest classifier is a collection of many different decision trees
generated by a bagging method or by randomly reducing the number of
features available during training.
■ Principal components analysis (PCA) is an unsupervised ML algorithm
that reduces highly correlated features into fewer uncorrelated composite
variables by transforming the feature covariance matrix. PCA produces
eigenvectors that define the principal components (i.e., the new uncor-
related composite variables) and eigenvalues, which give the proportion of
total variance in the initial data that is explained by each eigenvector and its
associated principal component.
■ K-means is an unsupervised ML algorithm that partitions observations into
a fixed number (k) of non-overlapping clusters. Each cluster is characterized
by its centroid, and each observation belongs to the cluster with the cen-
troid to which that observation is closest.
■ Hierarchical clustering is an unsupervised iterative algorithm that is used
to build a hierarchy of clusters. Two main strategies are used to define the
intermediary clusters (i.e., those clusters between the initial dataset and the
final set of clustered data).
■ Agglomerative (bottom-up) hierarchical clustering begins with each obser-
vation being its own cluster. Then, the algorithm finds the two closest clus-
ters, defined by some measure of distance, and combines them into a new,
larger cluster. This process is repeated until all observations are clumped
into a single cluster.
■ Divisive (top-down) hierarchical clustering starts with all observations
belonging to a single cluster. The observations are then divided into two
clusters based on some measure of distance. The algorithm then progres-
sively partitions the intermediate clusters into smaller clusters until each
cluster contains only one observation.
■ Neural networks consist of nodes connected by links. They have three types
of layers: an input layer, hidden layers, and an output layer. Learning takes
place in the hidden layer nodes, each of which consists of a summation
© CFA Institute. For candidate use only. Not for distribution.
Choosing an Appropriate ML Algorithm 267
REFERENCES
Bacham, Dinesh and Janet Zhao. 2017. “Machine Learning: Challenges, Lessons, and
Opportunities in Credit Risk Modeling.” Moody’s Analytics Risk Perspectives 9:28–35.
Culkin, Robert and Sanjiv R. Das. 2017. “Machine Learning in Finance: The Case of Deep
Learning for Option Pricing.” Journal of Investment Management 15 (4): 92–100.
© CFA Institute. For candidate use only. Not for distribution.
Practice Problems 269
PRACTICE PROBLEMS
Exhibit 1:
Subject: Investment Process Reorganization
I have been thinking about modernizing the way we select stock investments.
Given that our past success has put Alef Associates in an excellent financial
position, now seems to be a good time to invest in our future. What I propose
is that we continue managing a portfolio of 100 global small-cap stocks but
restructure our process to benefit from machine learning (ML). Importantly, the
new process will still allow a role for human insight, for example, in providing
domain knowledge. In addition, I think we should make a special effort to iden-
tify companies that are likely to be acquired. Specifically, I suggest following the
four steps which would be repeated every quarter.
Step 4 Our five experienced securities analysts are each assigned four of the
groups, and then each analyst selects their one best stock pick from
each of their assigned groups. These 20 “high-conviction” stocks will
be added to our portfolio (in replacement of the 20 relatively under-
performing stocks to be sold in Step 1).
A couple of additional comments related to the above:
1. The machine learning techniques appropriate for executing Step 1 are most likely
to be based on:
A. regression
B. classification
C. clustering
B. 10,000, the eligible universe of small-cap stocks in which Alef can poten-
tially invest.
C. 20, the number of different groups (i.e. clusters) into which the eligible uni-
verse of small-cap stocks will be divided.
5. The target variable for the labelled training data to be used in Step 3 is most likely
which one of the following?
A. A continuous target variable.
© CFA Institute. For candidate use only. Not for distribution.
Practice Problems 271
6. Comparing two ML models that could be used to accomplish Step 3, which state-
ment(s) best describe(s) the advantages of using Classification and Regression
Trees (CART) instead of K-Nearest Neighbor (KNN)?
Statement 3 For CART the output provides a visual explanation for the
prediction.
A. Statement 1 only.
B. Statement 3 only.
C. Statements 1, 2, and 3.
C. Using a fitting curve to select a model with low bias error and high variance
error.
9. Regarding Comment #2, Moresanu has been thinking about the applications
of neural networks (NNs) and deep learning (DL) to investment manage-
ment. Which statement(s) best describe(s) the tasks for which NNs and DL are
well-suited?
Statement 1 NNs and DL are well-suited for image and speech recognition,
and natural language processing.
Statement 2 NNs and DL are well-suited for developing single variable ordi-
nary least squares regression models.
© CFA Institute. For candidate use only. Not for distribution.
272 Learning Module 6 Machine Learning
A. Statement 2 only.
B. Statements 1 and 3.
C. Statements 1, 2 and 3.
10. Regarding neural networks (NNs) that Alef might potentially implement, which
of the following statements is least accurate?
A. NNs must have at least 10 hidden layers to be considered deep learning
nets.
B. The activation function in a node operates like a light dimmer switch since
it decreases or increases the strength of the total net input.
SOLUTIONS
1. A is correct. The target variable (quarterly return) is continuous, hence this calls
for a supervised machine learning based regression model.
B is incorrect, since classification uses categorical or ordinal target variables,
while in Step 1 the target variable (quarterly return) is continuous.
C is incorrect, since clustering involves unsupervised machine learning so does
not have a target variable.
6. C is correct. The advantages of using CART over KNN to classify companies into
two categories (“not acquisition target” and “acquisition target”), include all of
the following: For CART there are no requirements to specify an initial hyper-
parameter (like K) or a similarity (or distance) measure as with KNN, and CART
provides a visual explanation for the prediction (i.e., the feature variables and
their cut-off values at each node).
A is incorrect, because CART provides all of the advantages indicated in State-
ments 1, 2 and 3.
© CFA Institute. For candidate use only. Not for distribution.
274 Learning Module 6 Machine Learning
7. C is correct. A fitting curve shows the trade-off between bias error and variance
error for various potential models. A model with low bias error and high variance
error is, by definition, overfitted.
A is incorrect, because there are two common methods to reduce overfitting, one
of which is proper data sampling and cross-validation. K-fold cross validation is
such a method for estimating out-of-sample error directly by determining the
errorin validation samples.
B is incorrect, because there are two common methods to reduce overfitting, one
of which is preventing the algorithm from getting too complex during selection
and training, which requires estimating an overfitting penalty.
9. B is correct. NNs and DL are well-suited for addressing highly complex machine
learning tasks, such as image classification, face recognition, speech recognition
and natural language processing. These complicated tasks are characterized
by non-linearities and complex interactions between large numbers of feature
inputs.
A is incorrect, because NNs and DL are well-suited for addressing highly com-
plex machine learning tasks, not simple single variable OLS regression models.
C is incorrect, because NNs and DL are well-suited for addressing highly com-
plex machine learning tasks, not simple single variable OLS regression models.
10. A is correct. It is the least accurate answer because neural networks with many
hidden layers—at least 2, but often more than 20 hidden layers—are known as
deep learning nets.
B is incorrect, because the node’s activation function operates like a light dimmer
switch which decreases or increases the strength of the (total net) input.
C is incorrect, because the node’s summation operator multiplies each (input)
value by a weight and sums up the weighted values to form the total net input.
The total net input is then passed to the activation function.
© CFA Institute. For candidate use only. Not for distribution.
LEARNING MODULE
7
Big Data Projects
by Sreekanth Mallikarjun, PhD, and Ahmed Abbasi, PhD.
Sreekanth Mallikarjun, PhD, is at Reorg (USA) and the University of Virginia, School of
Data Science (USA). Ahmed Abbasi, PhD, is at the University of Virginia, McIntire School
of Commerce (USA).
LEARNING OUTCOMES
Mastery The candidate should be able to:
INTRODUCTION
Big data (also referred to as alternative data) encompasses data generated by financial
1
markets (e.g., stock and bond prices), businesses (e.g., company financials, production
volumes), governments (e.g., economic and trade data), individuals (e.g., credit card
purchases, social media posts), sensors (e.g., satellite imagery, traffic patterns), and
the Internet of Things, or IoT, (i.e., the network of interrelated digital devices that can
transfer data among themselves without human interaction). A veritable explosion in
big data has occurred over the past decade or so, especially in unstructured data gen-
erated from social media (e.g., posts, tweets, blogs), email and text communications,
web traffic, online news sites, electronic images, and other electronic information
sources. The prospects are for exponential growth in big data to continue.
Investment managers are increasingly using big data in their investment processes
as they strive to discover signals embedded in such data that can provide them with an
information edge. They seek to augment structured data with a plethora of unstruc-
tured data to develop improved forecasts of trends in asset prices, detect anomalies,
© CFA Institute. For candidate use only. Not for distribution.
276 Learning Module 7 Big Data Projects
etc. A typical example involves a fund manager using financial text data from 10-K
reports for forecasting stock sentiment (i.e., positive or negative), which can then be
used as an input to a more comprehensive forecasting model that includes corporate
financial data.
Unlike structured data (numbers and values) that can be readily organized into
data tables to be read and analyzed by computers, unstructured data typically require
specific methods of preparation and refinement before being usable by machines (i.e.,
computers) and useful to investment professionals. Given the volume, variety, and
velocity of available big data, it is important for portfolio managers and investment
analysts to have a basic understanding of how unstructured data can be transformed
into structured data suitable as inputs to machine learning (ML) methods (in fact, for
any type of modeling methods) that can potentially improve their financial forecasts.
This reading describes the steps in using big data, both structured and unstruc-
tured, in financial forecasting. The concepts and methods are then demonstrated in a
case study of an actual big data project. The project uses text-based data derived from
financial documents to train an ML model to classify text into positive or negative
sentiment classes for the respective stocks and then to predict sentiment.
Section 2 of the reading covers a description of the key characteristics of big data.
Section 3 provides an overview of the steps in executing a financial forecasting project
using big data. We then describe in Sections 4–6 key aspects of data preparation and
wrangling, data exploration, and model training using structured data and unstructured
(textual) data. In Section 7, we bring these pieces together by covering the execution
of an actual big data project. A summary in Section 8 concludes the reading.
When using big data for inference or prediction, there is a “fourth V”: Veracity
relates to the credibility and reliability of different data sources. Determining the credi-
bility and reliability of data sources is an important part of any empirical investigation.
The issue of veracity becomes critically important for big data, however, because of
the varied sources of these large datasets. Big data amplifies the age-old challenge of
disentangling quality from quantity. Social media, including blogs, forums, and social
networking sites, are plagued with spam; by some estimates, as much as 10%–15%
of such content is completely fake. Similarly, according to our research, web spam
accounts for more than 20% of all content on the worldwide web. Clickstreams from
website and mobile traffic are equally susceptible to noise. Furthermore, deriving
deep semantic knowledge from text remains challenging in certain instances despite
significant advances in natural language processing (NLP).
These Vs have numerous implications for financial technology (commonly referred
to as “fintech”) pertaining to investment management. Machine learning assessments
of creditworthiness, which have traditionally relied on structured financial metrics, are
being enhanced by incorporating text derived from financial statements, news articles,
and call transcripts. Customers in the financial industry are being segmented based
not only on their transactional data but also on their views and preferences expressed
on social media (to the degree permissible under applicable privacy agreements). Big
data also affords opportunities for enhanced fraud detection and risk management.
In the era of big data, firms treat data like they do important assets. However, effec-
tive big data analytics are critical to allow appropriate data monetization. Let us take
financial forecasting as an application area. Numerous forecasting tasks in this domain
can benefit from predictive analytics models built using machine learning methods.
One common example is predicting whether stock prices (for an individual stock or a
portfolio) will go up or down in value at some specific point in the future. Traditionally,
financial forecasting relied on various financial and accounting numbers, ratios, and
metrics coupled with statistical or mathematical models. More recently, machine
learning models have been commonly utilized. However, with the proliferation of
textual big data (e.g., online news articles, internet financial forums, social networking
platforms), such unstructured data have been shown to offer insights faster (as they
are real-time) and have enhanced predictive power.
Textual big data provides several valuable types of information, including topics
and sentiment. Topics are what people are talking about (e.g., a firm, an industry, a
particular event). Sentiment is how people feel about what they are discussing. For
instance, they might express positive, negative, or neutral views (i.e., sentiments)
toward a topic of discussion. One study conducted in the United States found that
positive sentiment on Twitter could predict the trend for the Dow Jones Industrial
Average up to three days later with nearly 87% accuracy.
© CFA Institute. For candidate use only. Not for distribution.
278 Learning Module 7 Big Data Projects
Deriving such insights requires supplementing traditional data with textual big
data. As depicted in Exhibit 1, the inclusion of big data has immediate implications for
building the machine learning model as well as downstream implications for financial
forecasting and analysis. We begin with the top half of Exhibit 1, which shows the
traditional (i.e., with structured data) ML Model Building Steps:
1. Conceptualization of the modeling task. This crucial first step entails deter-
mining what the output of the model should be (e.g., whether the price of
a stock will go up/down one week from now), how this model will be used
and by whom, and how it will be embedded in existing or new business
processes.
2. Data collection. The data traditionally used for financial forecasting tasks are
mostly numeric data derived from internal and external sources. Such data
are typically already in a structured tabular format, with columns of fea-
tures, rows of instances, and each cell representing a particular value.
3. Data preparation and wrangling. This step involves cleansing and prepro-
cessing of the raw data. Cleansing may entail resolving missing values, out-
of-range values, and the like. Preprocessing may involve extracting, aggre-
gating, filtering, and selecting relevant data columns.
4. Data exploration. This step encompasses exploratory data analysis, feature
selection, and feature engineering.
5. Model training. This step involves selecting the appropriate ML method
(or methods), evaluating performance of the trained model, and tuning the
model accordingly.
Note that these steps are iterative because model building is an iterative process.
The insights gained from one iteration may inform the next iteration, beginning with
reconceptualization. In contrast with structured data sources, textual big data orig-
inating in online news articles, social media, internal/external documents (such as
public financial statements), and other openly available data sources are unstructured.
The TextML Model Building Steps used for the unstructured data sources of big
data are shown in the bottom half of Exhibit 1. They differ from those used for tra-
ditional data sources and are typically intended to create output information that is
structured. The differences in steps between the text model and traditional model
account for the characteristics of big data: volume, velocity, variety, and veracity. In
this reading, we mostly focus on the variety and veracity dimensions of big data as
they manifest themselves in text. The major differences in the Text ML Model Building
Steps are in the first four steps:
1. Text problem formulation. Analysts begin by determining how to formulate
the text classification problem, identifying the exact inputs and outputs for
the model. Perhaps we are interested in computing sentiment scores (struc-
tured output) from text (unstructured input). Analysts must also decide how
the text ML model’s classification output will be utilized.
2. Data (text) curation. This step involves gathering relevant external text
data via web services or web spidering (scraping or crawling) programs
that extract raw content from a source, typically web pages. Annotation of
the text data with high-quality, reliable target (dependent) variable labels
might also be necessary for supervised learning and performance evaluation
purposes. For instance, experts might need to label whether a given expert
assessment of a stock is bearish or bullish.
© CFA Institute. For candidate use only. Not for distribution.
Executing a Data Analysis Project 279
3. Text preparation and wrangling. This step involves critical cleansing and
preprocessing tasks necessary to convert streams of unstructured data into a
format that is usable by traditional modeling methods designed for struc-
tured inputs.
4. Text exploration. This step encompasses text visualization through tech-
niques, such as word clouds, and text feature selection and engineering.
The resulting output (e.g., sentiment prediction scores) can either be combined
with other structured variables or used directly for forecasting and/or analysis.
Next, we describe two key steps from the ML Model Building Steps depicted in
Exhibit 1 that typically differ for structured data versus textual big data: data/text
preparation and wrangling and data/text exploration. We then discuss model training.
Finally, we focus on applying these steps to a case study related to classifying and
predicting stock sentiment from financial texts.
Structured Data
Structured Data Input Collection
EXAMPLE 1
1. State and explain one decision Wang will need to make related to:
A. conceptualizing the modeling task.
B. data collection.
C. data preparation and wrangling.
D. data exploration.
E. model training.
Solution:
A. In the conceptualization step, Wang will need to decide how the out-
put of the ML model will be specified (e.g., a binary classification of
creditworthiness), how the model will be used and by whom, and how
it will be embedded in LendALot’s business processes.
B. In the data collection phase, Wang must decide on what data—inter-
nal, external, or both—to use for credit scoring.
C. In the data preparation and wrangling step, Wang will need to decide
on data cleansing and preprocessing needs. Cleansing may entail
resolving missing values, extreme values, etc. Preprocessing may
involve extracting, aggregating, filtering, and selecting relevant data
columns.
D. In the data exploration phase, Wang will need to decide which explor-
atory data analysis methods are appropriate, which features to use in
building a credit scoring model, and which features may need to be
engineered.
E. In the model training step, Wang must decide which ML algorithm(s)
to use. Assuming labeled training data are available, the choice will
be among supervised learning algorithms. Decisions will need to be
made on how model fit is measured and how the model is validated
and tuned.
Solution:
Wang’s statement relates to the initial step of text problem formulation.
3. State two potential needs of the LendAlot team in relation to text curation.
Solution:
Related to text curation, the team will be using internal data (from loan
applications). They will need to ensure that the text comment fields on the
loan applications have been correctly implemented and enabled. If these
fields are not required, they need to ensure there is a sufficient response rate
to analyze.
© CFA Institute. For candidate use only. Not for distribution.
Data Preparation and Wrangling 281
4. State two potential needs of the LendAlot team in relation to text prepara-
tion and wrangling.
Solution:
Related to text preparation and wrangling, the team will need to carry out
the critical tasks of text cleansing and text preprocessing. These two tasks
are necessary to convert an unstructured stream of data into structured
values for use by traditional modeling methods.
Data preparation and wrangling involve cleansing and organizing raw data into a
consolidated format. The resulting dataset is suitable to use for further analyses and
training a machine learning (ML) model. This is a critical stage, the foundation, in
big data projects. Most of the project time is spent on this step, and the quality of the
data affects the training of the selected ML model. Domain knowledge—that is, the
involvement of specialists in the particular field in which the data are obtained and
used—is beneficial and often necessary to successfully execute this step. Data prepa-
ration is preceded by data collection, so we discuss the data collection process first.
Before the data collection process even begins, it is important to state the prob-
lem, define objectives, identify useful data points, and conceptualize the model.
Conceptualization is like a blueprint on a drawing board, a modifiable plan that is
necessary to initiate the model building process. A project overview is established
by determining the ML model type—supervised or unsupervised—and data sources/
collection plans with respect to the needs of the project.
Data collection involves searching for and downloading the raw data from one or
multiple sources. Data can be stored in different formats, sources, and locations. As
databases are the most common primary sources, building necessary queries with the
help of database administrators is critical. Database schemas are built with certain
assumptions and exceptions, and it is safest to clarify the database architecture with
an administrator or database architect before downloading the necessary data. Data
also exist in the form of spreadsheets, comma-separated values (csv) files, text files,
and other formats. Care must be taken before using such data, and documentation
(often referred to as “Readme” files) must be referred to, if available. Readme files
are text files provided with the raw data that contain information related to a data file.
They are useful for understanding the data and how they can be interpreted correctly.
Alternatively, third-party data vendors can be sources of clean data. External data
usually can be accessed through an application programming interface (API)—a set
of well-defined methods of communication between various software components—or
the vendors can deliver the required data in the form of csv files or other formats (as
previously mentioned). Using external data can save time and resources that would
otherwise go into data preparation and wrangling; however, vendor contracts come
with a price. Depending on the big data project constraints, a decision must be made
regarding the use of internal or external data based on the trade-offs between time,
financial costs, and accuracy. For projects using internal user data, external data
© CFA Institute. For candidate use only. Not for distribution.
282 Learning Module 7 Big Data Projects
might not be suitable. For example, to understand user traffic on a company website,
internally recorded site visits and click frequency may be captured and stored in the
internal databases. External data are advantageous when a project requires generic data,
such as demographics of a geographic area or traffic data of a public service. Another
consideration in using external vendor provided data is that during the cleansing
process, underlying trends in the data that are important for particular end-uses may
be masked or even lost. This is where “alpha” is often found; so by simply buying a
dataset from a vendor, you may lose your information edge. Of course, application of
the data (e.g., merging and combining, putting through different types of models) will
be different for everyone who uses it; there are always different ways to extract value.
Once the data are collected, the data preparation and wrangling stage begins. This
stage involves two important tasks: cleansing and preprocessing, respectively. Exhibit
2 outlines data preparation and wrangling and defines the two component tasks. These
tasks are explained in detail under the structured and unstructured sub-sections
because the steps vary by the nature of data.
Data Preparation (Cleansing): This is the initial and most common task in data
preparation that is performed on raw data. Data cleansing is the process of exam-
ining, identifying, and mitigating errors in raw data. Normally, the raw data are
neither sufficiently complete nor sufficiently clean to directly train the ML model.
Manually entered data can have incomplete, duplicated, erroneous, or inaccurate
values. Automated data (recorded by systems) can have similar problems due to server
failures and software bugs.
Data Wrangling (Preprocessing): This task performs transformations and critical
processing steps on the cleansed data to make the data ready for ML model training.
Raw data most commonly are not present in the appropriate format for model con-
sumption. After the cleansing step, data need to be processed by dealing with outliers,
extracting useful variables from existing data points, and scaling the data.
Structured Data
Other
1 ID Name Gender Date of Birth Salary Income State Credit Card
2 1 Mr. ABC M 12/5/1970 $50,200 $5,000 VA Y
3 2 Ms. XYZ M 15 Jan, 1975 $60,500 $0 NY Y
4 3 EFG 1/13/1979 $65,000 $1,000 CA N
5 4 Ms. MNO F 1/1/1900 — — FL Don’t Know
6 5 Ms. XYZ F 15/1/1975 $60,500 $0 Y
7 6 Mr. GHI M 9/10/1942 NA $55,000 TX N
8 7 Mr. TUV M 2/27/1956 $300,000 $50,000 CT Y
9 8 Ms. DEF F 4/4/1980 $55,000 $0 British N
Columbia
Other
1 ID Name Gender Date of Birth Salary Income State Credit Card
2 1 Mr. ABC M 12/5/1970 USD 50200 USD 5000 VA Y
3 2 Ms. XYZ F 1/15/1975 USD 60500 USD 0 NY Y
4 3 Mr. EFG M 1/13/1979 USD 65000 USD 1000 CA N
5 6 Mr. GHI M 9/10/1942 USD 0 USD 55000 TX N
6 7 Mr. TUV M 2/27/1956 USD 300000 USD 50000 CT Y
7 8 Ms. DEF F 4/4/1980 CAD 55000 CAD 0 British N
Columbia
Data cleansing can be expensive and cumbersome because it involves the use of
automated, rule-based, and pattern recognition tools coupled with manual human
inspection to sequentially check for the aforementioned types of errors row by row
and column by column. The process involves a detailed data analysis as an initial
step in identifying various errors that are present in the data. In addition to a manual
inspection and verification of the data, analysis software, such as SPSS, can be used
to understand metadata (data that describes and gives information about other data)
about the data properties to use as a starting point to investigate any errors in the data.
The business value of the project determines the necessary quality of data cleansing
and subsequently the amount of resources used in the cleansing process. In case the
errors cannot be resolved due to lack of available resources, the data points with errors
can simply be omitted depending on the size of the dataset. For instance, if a dataset is
large with more than 10,000 rows, removing a few rows (approximately 100) may not
have a significant impact on the project. If a dataset is small with less than 1,000 rows,
every row might be important and deleting many rows thus harmful to the project.
Scaling is a process of adjusting the range of a feature by shifting and changing the scale
of data. Variables, such as age and income, can have a diversity of ranges that result
in a heterogeneous training dataset. For better ML model training when using such
methods as support vector machines (SVMs) and artificial neural networks (ANNs),
© CFA Institute. For candidate use only. Not for distribution.
286 Learning Module 7 Big Data Projects
all variables should have values in the same range to make the dataset homogeneous.
It is important to remove outliers before scaling is performed. Here are two of the
most common ways of scaling:
1. Normalization is the process of rescaling numeric variables in the range
of [0, 1]. To normalize variable X, the minimum value (Xmin) is subtracted
from each observation (Xi), and then this value is divided by the difference
between the maximum and minimum values of X (Xmax − Xmin) as follows:
Xi− X
min
Xi (normalized) = _ − X .
X (1)
max min
Xi− μ
Xi (standardized) = _
σ (2)
EXAMPLE 2
After sharing a concern that the data should be thoroughly cleansed, Wang
makes the following statements:
Statement 1 “Let’s keep the ID column and remove the column for Name
from the dataset.”
Statement 2 “Let’s create a new feature, “Loan Amount as a Percent of
Income,” to use as an additional feature.”
© CFA Institute. For candidate use only. Not for distribution.
Data Preparation and Wrangling 287
1. The data shown for Ms. Beta contain what is best described as an:
A. invalidity error.
B. inaccuracy error.
C. incompleteness error.
Solution:
A is correct. This is an invalidity error because the data are outside of a
meaningful range. Income cannot be negative.
2. The data shown for Mr. Gamma contain what is best described as an:
A. invalidity error.
B. duplication error.
C. incompleteness error.
Solution:
C is correct. This is an incompleteness error as the loan type is missing.
3. The data shown for Ms. Delta contain what is best described as an:
A. invalidity error.
B. inaccuracy error.
C. duplication error.
Solution:
B is correct. This is an inaccuracy error because LendALot must know how
much they have lent to that particular borrower (who eventually repaid the
loan as indicated by the loan outcome of no default).
4. The data shown for Mr. Zeta contain what is best described as an:
A. invalidity error.
B. inaccuracy error.
C. duplication error.
Solution:
C is correct. Row 8 duplicates row 7: This is a duplication error.
B. data extraction.
C. data engineering.
Solution:
B is correct. The proposed feature is a ratio of two existing data. Data
extraction is the process of creating (i.e., extracting) new variables from
existing ones in the data.
Unstructured data are not organized into any systematic format that can be processed
by computers directly. They are available in formats meant for human usage rather
than computer processing. Unstructured data constitute approximately 80% of the
total data available today. They can be in the form of text, images, videos, and audio
files. Unlike in structured data, preparing and wrangling unstructured data are both
more challenging. For analysis and use to train the ML model, the unstructured data
must be transformed into structured data. In this section, text data will be used to
demonstrate unstructured data preparation and wrangling. The cleansing and prepro-
cessing of text data is called text processing. Text processing is essentially cleansing
and transforming the unstructured text data into a structured format. Text processing
can be divided into two tasks: cleansing and preprocessing. The following content is
related to text data in the English language.
Robots Are Us
However, the source text that can be downloaded is not as clean. The raw text con-
tains html tags and formatting elements along with the actual text. Exhibit 7 shows
the raw text from the source.
© CFA Institute. For candidate use only. Not for distribution.
Unstructured (Text) Data 289
The initial step in text processing is cleansing, which involves basic operations to
clean the text by removing unnecessary elements from the raw text. Text operations
often use regular expressions. A regular expression (regex) is a series that contains
characters in a particular order. Regex is used to search for patterns of interest in a
given text. For example, a regex “<.*?>” can be used to find all the html tags that are
present in the form of <…> in text.1 GREP (global regular expression print) is a com-
monly available utility in programming languages for searching patterns using regex.
Once a pattern is found, it can be removed or replaced. Additionally, advanced html
parsers and packages are available in the popular programming languages, such as R
and Python, to deal with this task.
The following steps describe the basic operations in the text cleansing process.
1. Remove html tags: Most of the text data are acquired from web pages, and
the text inherits html markup tags with the actual content. The initial task
is to remove (or strip) the html tags that are not part of the actual text using
programming functions or using regular expressions. In Exhibit 7, </h2> is
an html tag that can be identified by a regex and be removed. Note that it is
not uncommon to keep some generic html tags to maintain certain format-
ting meaning in the text.
2. Remove Punctuations: Most punctuations are not necessary for text analysis
and should be removed. However, some punctuations, such as percentage
signs, currency symbols, and question marks, may be useful for ML model
training. These punctuations should be substituted with such annotations as
/percentSign/, /dollarSign/, and /questionMark/ to preserve their grammat-
ical meaning in the text. Such annotations preserve the semantic meaning
of important characters in the text for further text processing and analysis
stages. It is important to note that periods (dots) in the text need to be pro-
cessed carefully. There are different circumstances for periods to be present
in text—characteristically used for abbreviations, sentence boundaries, and
decimal points. The periods and the context in which they are used need
to be identified and must be appropriately replaced or removed. In general,
periods after abbreviations can be removed, but the periods separating sen-
tences should be replaced by the annotation /endSentence/. Some punctua-
tions, such as hyphens and underscores, can be kept in the text to keep the
consecutive words intact as a single term (e.g., e-mail). Regex are often used
to remove or replace punctuations.
3. Remove Numbers: When numbers (or digits) are present in the text, they
should be removed or substituted with an annotation /number/. This helps
inform the computer that a number is present, but the actual value of the
number itself is not helpful for categorizing/analyzing the text. Such opera-
tions are critical for ML model training. Otherwise, the computers will treat
each number as a separate word, which may complicate the analyses or add
noise. Regex are often used to remove or replace numbers. However, the
number and any decimals must be retained where the outputs of interest
1 A regex of the form “<.*?>” will identify all html tags with anything (*) of any length (?) between the
brackets (< >).
© CFA Institute. For candidate use only. Not for distribution.
290 Learning Module 7 Big Data Projects
are the actual values of the number. One such text application is informa-
tion extraction (IE), where the goal is to extract relevant information from
a given text. An IE task could be extracting monetary values from financial
reports, where the actual number values are critical.
4. Remove white spaces: It is possible to have extra white spaces, tab spaces,
and leading and ending spaces in the text. The extra white spaces may be
introduced after executing the previously mentioned operations. These
should be identified and removed to keep the text intact and clean. Certain
functions in programming languages can be used to remove unnecessary
white spaces from the text. For example, the text mining package in R offers
a stripwhitespace function.
Exhibit 8 uses a sample financial text to show the transformations occurring after
applying each operation of the text cleansing process. The four steps are applied on
a mock financial text after scraping from a source. As noted previously, scraping
(or web scraping) is a technique to extract raw content from a source, typically web
pages. It is important to note that the sequence and choice of cleansing operations
does matter. For instance, after removing punctuation, the “1.2 million” becomes “12
million.” This is acceptable here since a subsequent operation replaces all numbers
with a “/number/” tag. However, if numbers were not replaced with such tags, the
punctuation removal operation could affect the data.
Text 1 The man went to the market today The man went to the market today
Text 4 There is no market for the product There is no market for the product
Similar to structured data, text data also require normalization. The normalization
process in text processing involves the following:
1. Lowercasing the alphabet removes distinctions among the same words due
to upper and lower cases. This action helps the computers to process the
same words appropriately (e.g., “The” and “the”).
2. Stop words are such commonly used words as “the,” “is,” and “a.” Stop words
do not carry a semantic meaning for the purpose of text analyses and ML
training. However, depending on the end-use of text processing, for advance
text applications it may be critical to keep the stop words in the text in order
to understand the context of adjacent words. For ML training purposes, stop
words typically are removed to reduce the number of tokens involved in
the training set. A predefined list of stop words is available in programming
languages to help with this task. In some cases, additional stop words can be
added to the list based on the content. For example, the word “exhibit” may
occur often in financial filings, which in general is not a stop word but in the
context of the filings can be treated as a stop word.
3. Stemming is the process of converting inflected forms of a word into its
base word (known as stem). Stemming is a rule-based approach, and the
results need not necessarily be linguistically sensible. Stems may not be
the same as the morphological root of the word. Porter’s algorithm is the
most popular method for stemming. For example, the stem of the words
“analyzed” and “analyzing” is “analyz.” Similarly, the British English variant
“analysing” would become “analys.” Stemming is available in R and Python.
The text mining package in R provides a stemDocument function that uses
this algorithm.
4. Lemmatization is the process of converting inflected forms of a word into
its morphological root (known as lemma). Lemmatization is an algorithmic
approach and depends on the knowledge of the word and language struc-
ture. For example, the lemma of the words “analyzed” and “analyzing” is
“analyze.” Lemmatization is computationally more expensive and advanced.
© CFA Institute. For candidate use only. Not for distribution.
292 Learning Module 7 Big Data Projects
The last step of text preprocessing is using the final BOW after normalizing to build
a document term matrix (DTM). DTM is a matrix that is similar to a data table for
structured data and is widely used for text data. Each row of the matrix belongs to a
document (or text file), and each column represents a token (or term). The number of
rows of DTM is equal to the number of documents (or text files) in a sample dataset.
The number of columns is equal to the number of tokens from the BOW that is built
using all the documents in a sample dataset. The cells can contain the counts of the
number of times a token is present in each document. The matrix cells can be filled
with other values that will be explained in the financial forecasting project section of
this reading; a large dataset is helpful in understanding the concepts. At this point,
the unstructured text data are converted to structured data that can be processed
further and used to train the ML model. Exhibit 11 shows a DTM constructed from
the resultant BOW of the four texts from Exhibit 10.
© CFA Institute. For candidate use only. Not for distribution.
Unstructured (Text) Data 293
Exhibit 11: DTM of Four Texts and Using Normalized BOW Filled with Counts
of Occurrence
As seen in Exhibit 10, BOW does not represent the word sequences or positions,
which limits its use for some advanced ML training applications. In the example, the
word “no” is treated as a single token and has been removed during the normalization
because it is a stop word. Consequently, this fails to signify the negative meaning (“no
market”) of the text (i.e., Text 4). To overcome such problems, a technique called
n-grams can be employed. N-grams is a representation of word sequences. The
length of a sequence can vary from 1 to n. When one word is used, it is a unigram;
a two-word sequence is a bigram; and a 3-word sequence is a trigram; and so on.
Exhibit 10, for example, shows a unigram (n = 1) BOW. The advantage of n-grams
is that they can be used in the same way as unigrams to build a BOW. In practice,
different n-grams can be combined to form a BOW and eventually be used to build
a DTM. Exhibit 12 shows unigrams, bigrams, and trigrams. Exhibit 12 also shows a
combined unigram-to-trigram BOW for the particular text. Stemming can be applied
on the cleansed text before building n-grams and BOW (not shown in Exhibit 12).
Unigrams
“The” “man” “went” “to” “the” “market” “today”
Bigrams
“The_man” “man_went” “went_to” “to_the” “the_market” “market_today”
Trigrams
“The_man_went” “man_went_to” “went_to_the” “to_the_market” “the_market_today”
The n-grams implementation will vary the impact of normalization on the BOW.
Even after removing isolated stop words, stop words tend to persist when they are
attached to their adjacent words. For instance, “to_the” (Exhibit 12) is a single bigram
token consisting of stop words and will not be removed by the predetermined list of
stop words.
EXAMPLE 3
1. The output produced by preparing and wrangling textual data is best de-
scribed as a:
A. data table.
B. confusion matrix.
C. document term matrix.
Solution:
C is correct. The objective of data preparation and wrangling of textual data
is to transform the unstructured data into structured data. The output of
these processes is a document term matrix that can be read by computers.
The document term matrix is similar to a data table for structured data.
Solution:
B is correct. A cell in a document term matrix contains a count of the num-
ber of tokens of the kind indicated in the column heading.
Data exploration is a crucial part of big data projects. The prepared data are explored
to investigate and comprehend data distributions and relationships. The knowledge
that is gained about the data in this stage is used throughout the project. The outcome
and quality of exploration strongly affects ML model training results. Domain knowl-
edge plays a vital role in exploratory analysis as this stage should involve cooperation
between analysts, model designers, and experts in the particular data domain. Data
exploration without domain knowledge can result in ascertaining spurious relationships
among the variables in the data that can mislead the analyses. The data exploration
stage follows the data preparation stage and leads to the model training stage.
© CFA Institute. For candidate use only. Not for distribution.
296 Learning Module 7 Big Data Projects
Data exploration involves three important tasks: exploratory data analysis, feature
selection, and feature engineering. These three tasks are outlined in Exhibit 13 and are
defined and further explained under the structured and unstructured data subsections.
Data Exploration
Data Data
Collection/ Preparation Exploratory Model
and Feature Feature Results
Curation Data Training
Wrangling Selection Engineering
Analysis
Exploratory data analysis (EDA) is the preliminary step in data exploration. Exploratory
graphs, charts, and other visualizations, such as heat maps and word clouds, are
designed to summarize and observe data. In practice, many exploratory graphs are
made for investigation and can be made swiftly using statistical programming and
generic spreadsheet software tools. Data can also be summarized and examined using
quantitative methods, such as descriptive statistics and central tendency measures. An
important objective of EDA is to serve as a communication medium among project
stakeholders, including business users, domain experts, and analysts. Relatively quick
and easy exploratory visualizations help stakeholders connect and ensure the prepared
data are sensible. Other objectives of EDA include:
■ understanding data properties,
■ finding patterns and relationships in data,
■ inspecting basic questions and hypotheses,
■ documenting data distributions and other characteristics, and
■ planning modeling strategies for the next steps.
Feature selection is a process whereby only pertinent features from the dataset
are selected for ML model training. Selecting fewer features decreases ML model
complexity and training time. Feature engineering is a process of creating new
features by changing or transforming existing features. Model performance heavily
depends on feature selection and engineering.
Structured Data
■ Box plots
■ Density plots
Histograms represent equal bins of data and their respective frequencies. They can
be used to understand the high-level distribution of the data. Bar charts summarize
the frequencies of categorical variables. Box plots show the distribution of continuous
data by highlighting the median, quartiles, and outliers of a feature that is normally
distributed. Density plots are another effective way to understand the distribution
of continuous data. Density plots are smoothed histograms and are commonly laid
on top of histograms, as shown in Exhibit 14. This histogram shows a hypothetical
annual salary distribution (in ₤) of entry-level analyst positions at UK banks. The data
represent a normal distribution with an approximate mean of ₤68,500.
.20
.15
.10
.05
0
64 66 68 70 72
Annual Salary (£, thousands)
For data with two or more dimensions, summary statistics of relationships, such as a
correlation matrix, can be calculated. Two- or more-dimensional visualization explores
interactions between different features in the dataset. Common methods include scat-
terplots and line graphs. In multi-dimensional visualization, one-dimensional plots
are overlaid to summarize each feature, thus enabling comparison between features.
Additionally, attributes (e.g., color, shape, and size) and legends can be used creatively
to pack more information about the data into fewer graphs.
For multivariate data, commonly utilized exploratory visualization designs include
stacked bar and line charts, multiple box plots, and scatterplots showing multivariate
data that use different colors or shapes for each feature. Multiple box plots can be
arranged in a single chart, where each individual box plot represents a feature. Such
a multi-box plot chart assesses the relationship between each feature (x-axis) in the
dataset and the target variable of interest (y-axis). The multi-box plot chart in Exhibit
15 represents units of shares purchased versus stock price for a hypothetical stock.
The x-axis shows the stock price in increments of $0.125, and the y-axis shows units
of shares purchased. The individual box plots indicate the distribution of shares pur-
chased at the different stock prices. When the stock price is $0.25, the median number
of shares purchased is the highest; when the stock price is $0.625, the median number
of shares purchased is the lowest. However, visually it appears that the number of
shares purchased at different stock prices is not significantly different.
© CFA Institute. For candidate use only. Not for distribution.
298 Learning Module 7 Big Data Projects
700
Maximum
600
500
400
200
100 Median
First Quartile
0 Minimum
0 0.125 0.250 0.375 0.500 0.625 0.750 0.875 1.00
Stock Price ($)
800
600
400
200
15 20 25 30 35 40 45
Age (Years)
Feature Selection
Structured data consist of features, represented by different columns of data in a table
or matrix. After using EDA to discover relevant patterns in the data, it is essential to
identify and remove unneeded, irrelevant, and redundant features. Basic diagnostic
testing should also be performed on features to identify redundancy, heteroscedas-
ticity, and multi-collinearity. The objective of the feature selection process is to assist
in identifying significant features that when used in a model retain the important
patterns and complexities of the larger dataset while requiring fewer data overall.
This last point is important since computing power is not free (i.e., explicit costs and
processing time).
Typically, structured data even after the data preparation step can contain features
that do not contribute to the accuracy of an ML model or that negatively affect the
quality of ML training. The most desirable outcome is a parsimonious model with
fewer features that provides the maximum predictive power out-of-sample.
Feature selection must not be confused with the data preprocessing steps during
data preparation. Good feature selection requires an understanding of the data and
statistics, and comprehensive EDA must be performed to assist with this step. Data
preprocessing needs clarification only from data administrators and basic intuition
(e.g., salary vs. income) during data preparation.
© CFA Institute. For candidate use only. Not for distribution.
300 Learning Module 7 Big Data Projects
Feature Engineering
After the appropriate features are selected, feature engineering helps further optimize
and improve the features. The success of ML model training depends on how well the
data are presented to the model. The feature engineering process attempts to pro-
duce good features that describe the structures inherent in the dataset. This process
depends on the context of the project, domain of the data, and nature of the problem.
Structured data are likely to contain quantities, which can be engineered to better
present relevant patterns in the dataset. This action involves engineering an existing
feature into a new feature or decomposing it into multiple features.
For continuous data, a new feature may be created—for example, by taking the
logarithm of the product of two or more features. As another example, when con-
sidering a salary or income feature, it may be important to recognize that different
salary brackets impose a different taxation rate. Domain knowledge can be used to
decompose an income feature into different tax brackets, resulting in a new feature:
“income_above_100k,” with possible values 0 and 1. The value 1 under the new feature
captures the fact that a subject has an annual salary of more than $100,000. By group-
ing subjects into income categories, assumptions about income tax can be made and
utilized in a model that uses the income tax implications of higher and lower salaries
to make financial predictions.
For categorical data, for example, a new feature can be a combination (e.g., sum
or product) of two features or a decomposition of one feature into many. If a single
categorical feature represents education level with five possible values—high school,
associates, bachelor’s, master’s, and doctorate—then these values can be decomposed
into five new features, one for each possible value (e.g., is_highSchool, is_doctorate)
filled with 0s (for false) and 1s (for true). The process in which categorical variables are
converted into binary form (0 or 1) for machine reading is called one hot encoding.
It is one of the most common methods for handling categorical features in text data.
When date-time is present in the data, such features as “second of the hour,” “hour
of the day,” and “day of the date” can be engineered to capture critical information
about temporal data attributes—which are important, for example, in modeling
trading algorithms.
© CFA Institute. For candidate use only. Not for distribution.
Unstructured Data: Text Exploration 301
of generic financial news wires after text processing. Word cloud building functions
and packages are available in several popular programming languages. A detailed
demonstration of text data EDA will be presented in Section 7, where we work with
actual text data in a financial forecasting project.
Feature Selection
For text data, feature selection involves selecting a subset of the terms or tokens
occurring in the dataset. The tokens serve as features for ML model training. Feature
selection in text data effectively decreases the size of the vocabulary or BOW. This
helps the ML model be more efficient and less complex. Another benefit is to eliminate
noisy features from the dataset. Noisy features are tokens that do not contribute to
ML model training and actually might detract from the ML model accuracy.
Noisy features are both the most frequent and most sparse (or rare) tokens in
the dataset. On one end, noisy features can be stop words that are typically present
frequently in all the texts across the dataset. On the other end, noisy features can
be sparse terms that are present in only a few text cases. Text classification involves
dividing text documents into assigned classes (a class is a category; examples include
“relevant” and “irrelevant” text documents or “bearish” and “bullish” sentences). The
frequent tokens strain the ML model to choose a decision boundary among the texts
as the terms are present across all the texts, an example of model underfitting. The
rare tokens mislead the ML model into classifying texts containing the rare terms
into a specific class, an example of model overfitting. Identifying and removing noise
features is very critical for text classification applications. The general feature selection
methods in text data are as follows:
1. Frequency measures can be used for vocabulary pruning to remove noise
features by filtering the tokens with very high and low TF values across all
the texts. Document frequency (DF) is another frequency measure that
helps to discard the noise features that carry no specific information about
the text class and are present across all texts. The DF of a token is defined
© CFA Institute. For candidate use only. Not for distribution.
Unstructured Data: Text Exploration 303
Feature Engineering
As with structured data, feature engineering can greatly improve ML model training
and remains a combination of art and science. The following are some techniques for
feature engineering, which may overlap with text processing techniques.
1. Numbers: In text processing, numbers are converted into a token, such as
“/number/.” However, numbers can be of different lengths of digits repre-
senting different kinds of numbers, so it may be useful to convert different
numbers into different tokens. For example, numbers with four digits may
indicate years, and numbers with many digits could be an identification
number. Four-digit numbers can be replaced with “/number4/,” 10-digit
numbers with “/number10/,” and so forth.
© CFA Institute. For candidate use only. Not for distribution.
304 Learning Module 7 Big Data Projects
Exhibit 19: Name Entity Recognition and Parts of Speech (POS) on Example
Text
EXAMPLE 4
Data Exploration
Paul Wang’s analytics team at LendALot Corporation has completed its initial
data preparation and wrangling related to their creditworthiness classification
ML model building efforts. As a next step, Wang has asked one of the team
members, Eric Kim, to examine the available structured data sources to see what
types of exploratory data analysis might make sense. Kim has been tasked with
reporting to the team on high-level patterns and trends in the data and which
variables seem interesting. Greater situational awareness about the data can
inform the team’s decisions regarding model training and whether (and how) to
incorporate textual big data in conjunction with the structured data inputs. Use
the following sample of columns and rows Kim pulled for manual examination
to answer the next questions.
Loan
Loan Income Amount Credit Free Responses to “Explain Credit Score”
1 ID Outcome (USD) (USD) Score Loan Type (excerpts from full text)
2 1 No Default 34,000 10,000 685 Mortgage I am embarrassed that my score is below 700, but it
was due to mitigating circumstances. I have developed
a plan to improve my score.
3 2 No Default 63,050 49,000 770 Student I have a good credit score and am constantly looking
Loan to further improve it…
4 3 Defaulted 20,565 35,000 730 Student I think I have great credit. I don’t think there are any
Loan issues. Having to provide a written response to these
questions is kind of annoying…
5 4 No Default 50,021 10,000 664 Mortgage I have a decent credit score. I regret not being as
responsible in the past but feel I have worked hard to
improve my score recently…
6 5 Defaulted 100,350 129,000 705 Car Loan Honestly, my score probably would have been higher
if I had worked harder. But it is probably good
enough…
7 6 No Default 800,000 300,000 800 Boat Loan I have worked hard to maintain a good credit rating.
I am very responsible. I maintain a payment schedule
and always stick to the payment plan…
Solution:
The data provided include structured features (ID, Loan Outcome, Income,
Loan Amount, Credit Score) and unstructured data. Histograms, box plots,
and scatterplots are relevant visualization methods for structured data fea-
tures. Histograms and box plots could be used by Kim to see how income,
© CFA Institute. For candidate use only. Not for distribution.
306 Learning Module 7 Big Data Projects
loan amount, and credit score are distributed. Moreover, these visualizations
can be performed across all historical borrowing instances in the dataset
as well as within the sets of defaulted loans versus non-defaulted loans.
Scatterplots of income versus loan amount, income versus credit score,
and loan amount versus credit score, both overall and within defaulted and
non-defaulted datasets, can shed light on relationships between potentially
important continuous variables.
2. State one visualization technique that could be used in relation to the free
responses.
Solution:
For the text in the free response field, word clouds offer an appropriate start-
ing point for exploratory analysis. A word cloud can enable a quick glimpse
into the most frequently occurring words (i.e., term frequency). While some
obvious words (e.g., “credit” and “score”) may be valuable, other frequently
occurring words (e.g., “worked,” “hard,” “probably,” “embarrassed,” “regret,”
“good,” “decent,” and “great”) might have potential use for creditworthiness
prediction.
Solution:
Kim can use feature selection methods to rank all features. Since the target
variable of interest (loan outcome) is discrete in this case, such techniques
as chi-square and information gain would be well suited. These are univar-
iate techniques that can score feature variables individually. In addition to
the structured features, these univariate ranking methods can also be ap-
plied to word count-related features, such as term frequency and document
frequency, that are derived from the text using frequently occurring words.
Such frequently occurring words (e.g., “worked” and “hard”) can be identi-
fied from the word cloud.
4. State an example of a bigram from the free response texts that could be used
to discriminate among loan outcomes.
Solution:
The bigrams “credit_score” and “worked_hard” from the text in the free
response section may have potential to discriminate among loan outcomes.
EXAMPLE 5
Loan
Loan Income Amount Credit Free Responses to “Explain Credit Score”
1 ID Outcome (USD) (USD) Score Loan Type (excerpts from full text)
2 1 No Default 34,000 10,000 685 Mortgage I am embarrassed that my score is below 700, but
it was due to mitigating circumstances. I have
developed a plan to improve my score.
3 2 No Default 63,050 49,000 770 Student I have a good credit score and am constantly look-
Loan ing to further improve it…
4 3 Defaulted 20,565 35,000 730 Student I think I have great credit. I don’t think there are
Loan any issues. Having to provide a written response
to these questions is kind of annoying…
5 4 No Default 50,021 10,000 664 Mortgage I have a decent credit score. I regret not being as
responsible in the past but feel I have worked hard
to improve my score recently…
6 5 Defaulted 100,350 129,000 705 Car Loan Honestly, my score probably would have been
higher if I had worked harder. But it is probably
good enough…
7 6 No Default 800,000 300,000 800 Boat Loan I have worked hard to maintain a good credit rat-
ing. I am very responsible. I maintain a payment
schedule and always stick to the payment plan…
1. Describe three textual feature representations that Lee and Kim should
consider for their text data.
Solution:
Lee and Kim should consider bag-of-words (BOW), n-grams, and parts-
of-speech (POS) as key textual feature representations for their text data.
Conversely, name entity recognition (NER) might not be as applicable in
this context because the data on prospective borrowers does not include any
explicit references to people, locations, dates, or organizations.
2. Describe a rationale for adopting each of the three textual feature represen-
tations identified in Question 1.
Solution:
All three textual feature representations have the potential to add value.
Bag-of-words (BOW) is typically applicable in most contexts involving
text features derived from languages where token boundaries are explicitly
present (e.g., English) or can be inferred through processing (e.g., a differ-
ent language, such as Spanish). BOW is generally the best starting point for
most projects exploring text feature representations.
N-grams, representations of word or token sequences, are also applicable.
N-grams can offer invaluable contextual information that can complement
and enrich a BOW. In this specific credit-worthiness context, we examine
the BOW token “worked.” It appears three times (rows 5–7), twice in no-de-
fault loan texts and once in a defaulted loan text. This finding suggests that
“worked” is being used to refer to the borrower’s work ethic and may be a
good predictor of credit worthiness. Digging deeper and looking at several
trigrams (i.e., three-token sequences) involving “worked,” we see that “have_
worked_hard” appears in the two no-default loan related texts (referring to
borrower accomplishments and plans) and “had_worked_harder” appears in
© CFA Institute. For candidate use only. Not for distribution.
308 Learning Module 7 Big Data Projects
the defaulted loan text (referring to what could have been done). This exam-
ple illustrates how n-grams can provide richer contextualization capabilities
for the creditworthiness prediction ML models.
Parts-of-speech tags can add value because they identify the composition of
the texts. For example, POS provides information on whether the prospec-
tive borrowers are including many action words (verbs) or descriptors (ad-
jectives) and whether this is being done differently in instances of no-default
versus instances of defaulted loans.
Machine learning model training is a systematic, iterative, and recursive process. The
number of iterations required to reach optimum results depends on:
■ the nature of the problem and input data and
■ the level of model performance needed for practical application.
Machine learning models combine multiple principles and operations to provide
predictions. As seen in the last two sections, typical ML model building requires
data preparation and wrangling (cleansing and preprocessing) and data exploration
(exploratory data analysis as well as feature selection and engineering). In addition,
domain knowledge related to the nature of the data is required for good model build-
ing and training. For instance, knowledge of investment management and securities
trading is important when using financial data to train a model for predicting costs
of trading stocks. It is crucial for ML engineers and domain experts to work together
in building and training robust ML models.
The three tasks of ML model training are method selection, performance evaluation,
and tuning. Exhibit 20 outlines model training and its three component tasks. Method
selection is the art and science of deciding which ML method(s) to incorporate and
is guided by such considerations as the classification task, type of data, and size of
data. Performance evaluation entails using an array of complementary techniques and
measures to quantify and understand a model’s performance. Tuning is the process of
undertaking decisions and actions to improve model performance. These steps may be
repeated multiple times until the desired level of ML model performance is attained.
Although no standard rulebook for training an ML model exists, having a fundamental
understanding of domain-specific training data and ML algorithm principles plays a
vital role in good model training.
© CFA Institute. For candidate use only. Not for distribution.
Model Training, Structured vs. Unstructured Data, and Method Selection 309
Model Training
Data Data
Collection/ Preparation Data
and Method Performance Results
Curation Exploration Tuning
Wrangling Selection Evaluation
Before training a model, it is important to state the problem, define objectives, identify
useful data points, and conceptualize the model. Conceptualization is like a blueprint
on a drawing board, a modifiable plan that is necessary to initiate the model training
process. Because modeling is an iterative process, many changes and refinements will
be made to the model plan as the process evolves.
Exhibit 21: Model Fitting Scenarios: Underfit, Overfit, and Good Fit
Y Y Y
Model fitting errors are caused by several factors—the main ones being dataset size
and number of features in the dataset.
■ Dataset Size: Small datasets can lead to underfitting of the model since small
datasets often are not sufficient to expose patterns in the data. Restricted by
a small dataset, an ML model may not recognize important patterns.
■ Number of Features: A dataset with a small number of features can lead to
underfitting, and a dataset with a large number of features can lead to over-
fitting. As with small dataset size, a small number of features may not carry
all the characteristics that explain relationships between the target variable
and the features. Conversely, a large number of features can complicate the
model and potentially distort patterns in the data due to low degrees of free-
dom, causing overfitting. Therefore, appropriate feature selection using the
types of techniques described earlier (e.g., chi-square, mutual information)
is a key factor in minimizing such model overfitting.
Feature engineering tends to prevent underfitting in the training of the model.
New features, when engineered properly, can elevate the underlying data points that
better explain the interactions of features. Thus, feature engineering can be critical to
overcome underfitting. Method-related factors that affect model fitting are explained
shortly under tuning.
Method Selection
ML model training is a craft (part art and part science); it has no strict guidelines.
Selecting and applying a method or an algorithm is the first step of the training pro-
cess. Method selection is governed by the following factors:
1. Supervised or unsupervised learning. The data for training and testing super-
vised ML models contain ground truth, the known outcome (i.e., target
variable) of each observation in these datasets. Unsupervised ML modeling
is relatively challenging because of the absence of ground truth (i.e., no
target variable). Supervised models bring a structure that may or may not
be supported by the data. Unsupervised models bring no structure beyond
that which arises from the given data. For supervised learning (with labeled
training data), typical methods of choice are regression, ensemble trees,
support vector machines (SVMs), and neural networks (NNs). Supervised
learning would be used, for example, for default prediction based on high-
yield corporate bond issuer data. For unsupervised learning, common
methods are dimensionality reduction, clustering, and anomaly detection.
Unsupervised learning, for example, would be used for clustering financial
institutions into different groups based on their financial attributes.
2. Type of data. For numerical data (e.g., predicting stock prices using histori-
cal stock market values), classification and regression tree (CART) methods
may be suitable. For text data (for example, predicting the topic of a finan-
cial news article by reading the headline of the article), such methods as
generalized linear models (GLMs) and SVMs are commonly used. For image
data (e.g., identifying objects in a satellite image, such as tanker ships mov-
ing in and out of port), NNs and deep learning methods tend to perform
better than others. For speech data (e.g., predicting financial sentiment from
quarterly earnings’ conference call recordings), deep learning methods can
offer promising results.
3. Size of data. A typical dataset has two basic characteristics: number of
instances (i.e., observations) and number of features. The combination
of these two characteristics can govern which method is most suitable
for model training. For instance, SVMs have been found to work well on
© CFA Institute. For candidate use only. Not for distribution.
Model Training, Structured vs. Unstructured Data, and Method Selection 311
“wider” datasets with 10,000 to 100,000 features and with fewer instances.
Conversely, NNs often work better on “longer” datasets, where the number
of instances is much larger than the number of features.
Once a method is selected, certain method-related decisions (e.g., on hyperpa-
rameters) need to be made. These decisions include the number of hidden layers in a
neural network and the number of trees in ensemble methods (discussed later in the
sub-section on tuning). In practice, datasets can be a combination of numerical and
text data. To deal with mixed data, the results from more than one method can be
combined. Sometimes, the predictions from one method can be used as predictors
(features) by another. For example, unstructured financial text data can be used with
logistic regression to classify stock sentiment as either positive or negative. Then, this
sentiment classification cam be used as a predictor in a larger model, say CART, that
also uses structured financial data as predictors for the purpose of stock selection.
Finally, more than one method can be used and the results combined with quantitative
or subjective weighing to exploit the advantages of each method.
Before model training begins, in the case of supervised learning the master data-
set is split into three subsets used for model training and testing purposes. The first
subset, a training set used to train the model, should constitute approximately 60% of
the master dataset. The second subset, a cross-validation set (or validation set) used
to tune and validate the model, should constitute approximately 20% of the master
dataset. The third subset is a test set for testing the model and uses the remaining data.
The data are split using a random sampling technique, such as the k-fold method. A
commonly recommended split ratio is 60:20:20, as detailed above; however, the split
percentages can vary. For unsupervised learning, no splitting is needed due to the
absence of labeled training data.
Class imbalance, where the number of instances for a particular class is signifi-
cantly larger than for other classes, may be a problem for data used in supervised
learning because the ML classification method’s objective is to train a high-accuracy
model. In a high-yield bond default prediction example, say for corporate issuers in
the BB+/Ba1 to B+/B1 credit quality range, issuers who defaulted (positive or “1” class)
would be very few compared to issuers who did not default (negative or “0” class).
Hence, on such training data, a naive model that simply assumes no corporate issuer
will default may achieve good accuracy—albeit with all default cases misclassified.
Balancing the training data can help alleviate such problems. In cases of unbalanced
data, the “0” class (majority class) can be randomly undersampled or the “1” class
(minority class) randomly oversampled. The random sampling can be done with or
without replacement because they both work the same in general probability theory.
Exhibit 22 depicts the idea of undersampling of the majority class and oversampling
of the minority class. In practice, the choice of whether to undersample or oversample
depends on the specific problem context. Advanced techniques can also reproduce
synthetic observations from the existing data, and the new observations can be added
to the dataset to balance the minority class.
© CFA Institute. For candidate use only. Not for distribution.
312 Learning Module 7 Big Data Projects
8 PERFORMANCE EVALUATION
It is important to measure the model training performance or goodness of fit for vali-
dation of the model. We shall cover several techniques to measure model performance
that are well suited specifically for binary classification models.
1. Error analysis. For classification problems, error analysis involves comput-
ing four basic evaluation metrics: true positive (TP), false positive (FP), true
negative (TN), and false negative (FN) metrics. FP is also called a Type I
error, and FN is also called a Type II error. Exhibit 23 shows a confusion
matrix, a grid that is used to summarize values of these four metrics.
© CFA Institute. For candidate use only. Not for distribution.
Performance Evaluation 313
Predicted Results
Trading off precision and recall is subject to business decisions and model
application. Therefore, additional evaluation metrics that provide the overall
performance of the model are generally used. The two overall performance
metrics are accuracy and F1 score. Accuracy is the percentage of correctly
predicted classes out of total predictions. F1 score is the harmonic mean
of precision and recall. F1 score is more appropriate (than accuracy) when
unequal class distribution is in the dataset and it is necessary to measure
the equilibrium of precision and recall. High scores on both of these metrics
suggest good model performance. The formulas for accuracy and F1 score
are as follows:
Confusion Matrix
Performance Metrics
TP = 3, FP = 1, FN = 2, TN = 4
P = 3 / (3+1) = 0.75
R = 3 / (3+2) = 0.60
F1 Score = (2 × 0.75 × 0.60) / (0.75 + 0.60) = 0.67
Accuracy = (3 + 4) / (3 + 1 + 4 + 2) = 0.70
In Exhibit 24, if all “1” classes were predicted correctly (no FPs), the preci-
sion would have been equal to 1. If all “0” classes were predicted correctly
(no FNs), the recall would have been equal to 1. Thus, the resulting F1 score
would have been equal to 1. The precision of 0.75 and recall of 0.60 indicate
that the model is better at minimizing FPs than FNs. To find the equilibrium
between precision and recall, F1 score is calculated, which is equal to 0.67.
The F1 score is closer to the smaller value among both precision and recall,
giving the model a more appropriate score rather than just an arithmetic
mean. Accuracy, the percentage of correct predictions (for both classes)
made by the model, is equal to 0.70. Accuracy would be equal to 1 if all pre-
dictions were correct. As the number of “1” and “0” classes is equal in the
dataset (i.e., a balanced dataset), accuracy can be considered an appropriate
performance measure in this case. If the number of classes in a dataset is
unequal; however, then F1 score should be used as the overall performance
measure for the model.
2. Receiver Operating Characteristic (ROC). This technique for assessing model
performance involves the plot of a curve showing the trade-off between the
false positive rate (x-axis) and true positive rate (y-axis) for various cutoff
points—for example, for the predicted probability (p) in a logistic regres-
sion. The formulas for false positive rate and true positive rate (note that
true positive rate is the same as recall) are:
AUC = 0.75
Model C
0
1
False Positive Rate (FPR)
3. Root Mean Squared Error (RMSE). This measure is appropriate for continu-
ous data prediction and is mostly used for regression methods. It is a single
metric that captures all the prediction errors in the data (n). The root mean
squared error is computed by finding the square root of the mean of the
squared differences between the actual values and the model’s predicted val-
ues (error). A small RMSE indicates potentially better model performance.
The formula for RMSE is:
____________________
√
n Predicted− Actual 2
(
_________________ i)
RMSE = ∑
i
n . (9)
i=1
© CFA Institute. For candidate use only. Not for distribution.
316 Learning Module 7 Big Data Projects
9 TUNING
Once the model is evaluated, certain decisions and actions must be taken based
on the findings to improve the performance of the model. If the prediction error
on the training set is high, the model is underfitting. If the prediction error on the
cross-validation (CV) set is significantly higher than on the training set, the model
is overfitting. Model fitting has two types of error: bias and variance. Bias error is
associated with underfitting, and variance error is associated with overfitting. Bias
error is high when a model is overly simplified and does not sufficiently learn from the
patterns in the training data. Variance error is high when the model is overly compli-
cated and memorizes the training data so much that it will likely perform poorly on
new data. It is not possible to completely eliminate both types of errors. However, both
errors can be minimized so the total aggregate error (bias error + variance error) is
at a minimum. The bias–variance trade-off is critical to finding an optimum balance
where a model neither underfits nor overfits.
1. Parameters are critical for a model and are dependent on the training data.
Parameters are learned from the training data as part of the training process
by an optimization technique. Examples of parameters include coefficients
in regression, weights in NN, and support vectors in SVM.
2. Hyperparameters are used for estimating model parameters and are not
dependent on the training data. Examples of hyperparameters include
the regularization term (λ) in supervised models, activation function and
number of hidden layers in NN, number of trees and tree depth in ensemble
methods, k in k-nearest neighbor classification and k-means clustering, and
p-threshold in logistic regression. Hyperparameters are manually set and
tuned.
For example, if a researcher is using a logistic regression model to classify sentences
from financial statements into positive or negative stock sentiment, the initial cutoff
point for the trained model might be a p-threshold of 0.50 (50%). Therefore, any sen-
tence for which the model produces a probability >50% is classified as having positive
sentiment. The researcher can create a confusion matrix from the classification results
(of running the CV dataset) to determine such model performance metrics as accuracy
and F1 score. Next, the researcher can vary the logistic regression’s p-threshold—say
to 0.55 (55%), 0.60 (60%), or even 0.65 (65%)—and then re-run the CV set, create new
confusion matrixes from the new classification results, and compare accuracy and F1
scores. Ultimately, the researcher would select the logistic regression model with a
p-threshold value that produces classification results generating the highest accuracy
and F1 scores. Note that the process just outlined will be demonstrated in Section 7.
There is no general formula to estimate hyperparameters. Thus, tuning heuristics
and such techniques as grid search are used to obtain the optimum values of hyper-
parameters. Grid search is a method of systematically training an ML model by using
various combinations of hyperparameter values, cross validating each model, and
determining which combination of hyperparameter values ensures the best model
performance. The model is trained using different combinations of hyperparameter
values until the optimum set of values are found. Optimum values must result in sim-
ilar performance of the model on training and CV datasets, meaning that the training
error and CV error are close. This ensures that the model can be generalized to test
data or to new data and thus is less likely to overfit. The plot of training errors for
© CFA Institute. For candidate use only. Not for distribution.
Tuning 317
Errorcv
Errortrain
Errorcv >>Errortrain
Error
Overfitting
Underfitting
Optimum Regularization
Small Error
Slight Regularization Large Regularization
Lambda (λ)
Slight regularization lightly penalizes model complexity, thereby allowing most or all
of the features to be included in the model and thus potentially enabling the model to
“memorize” the data. Typically with no or slight regularization, the prediction error on
the training dataset is small while the prediction error on the CV dataset is significantly
larger. This difference in error is variance. High variance error, which typically results
from too many features and model complexity, results in model overfitting. When
high variance error and low bias error exist, the model performs well on the training
dataset but generates many FP and FN errors on the CV dataset; in other words, the
model is overfitted and does not generalize to new data well.
Large regularization excessively penalizes model complexity, thereby allowing too
few of the features to be included in the model and causing the model to learn less
from the data. The model may lack the necessary predictor variables and complexity
needed to discern underlying patterns in the data. Typically with large regularization,
the prediction errors on the training and CV datasets are both large. Large prediction
errors on the training dataset indicate high bias, and high bias error results from model
underfitting. When high bias error exists, the model does not perform well on either
training or CV datasets because it is typically lacking important predictor variables.
Optimum regularization minimizes both variance and bias errors in a balanced
fashion. It penalizes model complexity just enough so that only the most important
features are included in the model. This process prevents the model from memoriz-
ing the data while enabling the model to learn enough from the data to distinguish
© CFA Institute. For candidate use only. Not for distribution.
318 Learning Module 7 Big Data Projects
important patterns. This results in prediction errors in both training and CV datasets
that are similar and also minimal. The range of optimum regularization values can be
found heuristically using such techniques as grid search.
If high bias or variance exists after the tuning of hyperparameters, either a larger
number of training examples (instances) may be needed or the number of features
included in the model may need to be decreased (in the case of high variance) or
increased (in the case of high bias). The model then needs to be re-trained and re-tuned
using the new training dataset. In the case of a complex model, where a large model
is comprised of sub-model(s), ceiling analysis can be performed. Ceiling analysis
is a systematic process of evaluating different components in the pipeline of model
building. It helps to understand what part of the pipeline can potentially improve in
performance by further tuning. For example, a stock market prediction model needs
historical data from the stock market and perhaps news articles related to the stocks.
The sub-model will extract relevant information from the news articles or classify the
sentiment of the news articles. The results of the sub-model will feed into the larger
model as features. Thus, the performance of the larger model depends on performance
of the sub-model(s). Ceiling analysis can help determine which sub-model needs to
be tuned to improve the overall accuracy of the larger model.
Robo-readers are automated programs used to analyze large quantities of text, including
news articles and social media. In the financial services space, robo-readers are being
used by investors to examine how views expressed in text relate to future company
performance. One important dimension that robo-readers look to analyze is sentiment
polarity—which means how positive, negative, or neutral a particular phrase or state-
ment is regarding a “target.” For example, in the statement “XYZ Corporation is doing
terrific things with its new product innovation,” positive sentiment (i.e., the polarity)
is being expressed regarding XYZ Corporation (i.e., the target of the sentiment). Such
sentiment can provide invaluable predictive power, both alone and when coupled with
structured financial data, for predicting stock price movements for individual firms
and for portfolios of companies.
To provide a practical application, we use a financial forecasting project to exam-
ine how effectively sentiment—expressed in English news articles on LexisNexis (a
searchable database of news articles) related to all companies listed on the NASDAQ
OMX Helsinki (Finland)—can be classified. To accomplish this task, we followed the
text ML model building steps presented in Sections 3 to 6 of this reading.
Text Curation
The text data used in this financial forecasting project are a collection of English lan-
guage sentences from financial and economic news sources. The text data are acquired
from the Financial Phrase Bank located on the website Researchgate.net.2 The com-
2 https://www.researchgate.net/publication/251231364_FinancialPhraseBank-v10.
© CFA Institute. For candidate use only. Not for distribution.
Financial Forecasting Project 319
pressed folder contains six text files. The first two files are license and readme files.
The other four files contain the text data. The data are presented in a text document
format (.txt), which can be opened and viewed using any text editor. Note that this is
cross-sectional data (not time series data).
A total of 14,780 sentences are in the four files. The sentiment of each sentence
has already been labeled with one of three sentiment classes: positive, neutral, or neg-
ative. The sentiment classes are provided from an investor’s perspective and may be
useful for predicting whether a sentence may have a corresponding positive, neutral,
or negative influence on the respective company’s stock price.
This project uses sentences from two of the text files (Sentences_AllAgree and
Sentences_75Agree), labeled as either in the positive or negative sentiment class,
for a total of 2,180 sentences. There are 1,457 positive sentiment class sentences and
723 negative sentiment class sentences. A supervised ML model is trained, validated,
and tested using these data. The final ML model can be used to predict the sentiment
classes of sentences present in similar financial news statements. Exhibit 27 shows a
sample of 10 rows of raw text from the Sentences_AllAgree text file. Note the senti-
ment annotations at the end of each sentence with prefix character “@.”
Exhibit 27: Ten Sample Sentences and Sentiment from Raw Text File (Sentences_AllAgree.txt)
Profit before taxes amounted to EUR 56.5 mn , down from EUR 232.9 mn a year ago .@negative
Profit before taxes decreased by 9 % to EUR 187.8 mn in the first nine months of 2008 , compared to EUR 207.1 mn a year earlier .@negative
Profit before taxes decreased to EUR 31.6 mn from EUR 50.0 mn the year before .@negative
Profit before taxes was EUR 4.0 mn , down from EUR 4.9 mn .@negative
The company ‘s profit before taxes fell to EUR 21.1 mn in the third quarter of 2008 , compared to EUR 35.8 mn in the corresponding period in 2007 .@negative
In August-October 2010 , the company ’s result before taxes totalled EUR 9.6 mn , up from EUR 0.5 mn in the corresponding period in 2009 .@positive
Finnish Bore that is owned by the Rettig family has grown recently through the acquisition of smaller shipping companies .@positive
The plan is estimated to generate some EUR 5 million ( USD 6.5 m ) in cost savings on an annual basis .@positive
Finnish pharmaceuticals company Orion reports profit before taxes of EUR 70.0 mn in the third quarter of 2010 , up from EUR 54.9 mn in the corresponding period in 2009 .@positive
Finnish Sampo Bank , of Danish Danske Bank group , reports profit before taxes of EUR 152.3 mn in 2010 , up from EUR 32.7 mn in 2009 .@positive
Sentence Sentiment
Profit before taxes amounted to EUR 56.5 mn , down from EUR 232.9 mn a year ago . negative
Profit before taxes decreased by 9 % to EUR 187.8 mn in the first nine months of 2008 , compared to EUR negative
207.1 mn a year earlier .
Profit before taxes decreased to EUR 31.6 mn from EUR 50.0 mn the year before . negative
Profit before taxes was EUR 4.0 mn , down from EUR 4.9 mn . negative
The company ’s profit before taxes fell to EUR 21.1 mn in the third quarter of 2008 , compared to EUR negative
35.8 mn in the corresponding period in 2007 .
In August-October 2010 , the company ’s result before taxes totalled EUR 9.6 mn , up from EUR 0.5 mn in positive
the corresponding period in 2009 .
© CFA Institute. For candidate use only. Not for distribution.
320 Learning Module 7 Big Data Projects
Sentence Sentiment
Finnish Bore that is owned by the Rettig family has grown recently through the acquisition of smaller positive
shipping companies .
The plan is estimated to generate some EUR 5 million ( USD 6.5 m ) in cost savings on an annual basis . positive
Finnish pharmaceuticals company Orion reports profit before taxes of EUR 70.0 mn in the third quarter positive
of 2010 , up from EUR 54.9 mn in the corresponding period in 2009 .
Finnish Sampo Bank , of Danish Danske Bank group , reports profit before taxes of EUR 152.3 mn in 2010 positive
, up from EUR 32.7 mn in 2009 .
The raw text contains punctuations, numbers, and white spaces that may not be
necessary for model training. Text cleansing involves removing, or incorporating
appropriate substitutions for, potentially extraneous information present in the text.
Operations to remove html tags are unnecessary because none are present in the text
Punctuations: Before stripping out punctuations, percentage and dollar symbols are
substituted with word annotations to retain their essence in the financial texts. Such
word annotation substitutions convey that percentage and currency-related tokens were
involved in the text. As the sentences have already been identified within and extracted
from the source text, punctuation helpful for identifying discrete sentences—such as
periods, semi-colons, and commas—are removed. Some special characters, such as
“+” and “©,” are also removed. It is a good practice to implement word annotation
substitutions before removing the rest of the punctuations.
Numbers: Numerical values of numbers in the text have no significant utility for
sentiment prediction in this project because sentiment primarily depends on the words
in a sentence. Here is an example sentence: “Ragutis, which is based in Lithuania's
second-largest city, Kaunas, boosted its sales last year 22.3 percent to 36.4 million
litas.” The word “boosted” implies that there was growth in sales, so analysis of this
sentiment does not need to rely on interpretation of numerical text data. Sentiment
analysis typically does not involve extracting, interpreting, and calculating relevant
numbers but instead seeks to understand the context in which the numbers are used.
Other commonly occurring numbers are dates and years, which are also not required
to predict sentence sentiment. Thus, all numbers present in the text are removed for
this financial sentiment project. However, prior to removing numbers, abbreviations
representing orders of magnitude, such as million (commonly represented by “m,”
“mln,” or “mn”), billion, or trillion, are replaced with the complete word. Retaining
these orders of magnitude-identifying words in the text preserves the original text
meaning and can be useful in predicting sentence sentiment.
Whitespaces: White spaces are present in the raw text. Additional white spaces
occur after performing the above operations to remove extraneous characters. The
white spaces must be removed to keep the text intact. Exhibit 29 shows the sample
text after cleansing. The cleansed text is free of punctuations and numbers, with
useful substitutions.
Sentence Sentiment
Profit before taxes amounted to EUR million down from EUR million a year ago negative
Profit before taxes decreased by percentSign to EUR million in the first nine months of compared to EUR negative
million a year earlier
Profit before taxes decreased to EUR million from EUR million the year before negative
Profit before taxes was EUR million down from EUR million negative
© CFA Institute. For candidate use only. Not for distribution.
Financial Forecasting Project 321
Sentence Sentiment
The companys profit before taxes fell to EUR million in the third quarter of compared to EUR million in negative
the corresponding period in
In August October the companys result before taxes totalled EUR million up from EUR million in the positive
corresponding period in
Finnish Bore that is owned by the Rettig family has grown recently through the acquisition of smaller positive
shipping companies
The plan is estimated to generate some EUR million USD million in cost savings on an annual basis positive
Finnish pharmaceuticals company Orion reports profit before taxes of EUR million in the third quarter of positive
up from EUR million in the corresponding period in
Finnish Sampo Bank of Danish Danske Bank group reports profit before taxes of EUR million in up from positive
EUR million in
Sentence Sentiment
profit befor tax amount to currencysign million down from currencysign million a year ago negative
profit befor tax decreas by percentsign to currencysign million in the first nine month of compar to cur- negative
rencysign million a year earlier
profit before tax decreas to currencysign million from currencysign million the year befor negative
profit befor tax was currencysign million down from currencysign million negative
the compani profit befor tax fell to currencysign million in the third quarter of compar to currencysign negative
million in the correspond period in
in august octob the compani result befor tax total currencysign million up from currencysign million in positive
the correspond period in
© CFA Institute. For candidate use only. Not for distribution.
322 Learning Module 7 Big Data Projects
Sentence Sentiment
finnish bore that is own by the rettig famili has grown recent through the acquisit of smaller shipping positive
company
the plan is estim to generat some currencysign million currencysign million in cost save on an annual basi positive
finnish pharmaceut compani orion report profit befor tax of currencysign million in the third quarter of positive
up from currencysign million in the correspond period in
finnish sampo bank of danish danske bank group report profit befor tax of currencysign million in up positive
from currencysign million in
The normalized text is tokenized, resulting in 2,673 unique tokens. Altogether, these
unique tokens comprise the bag-of-words (BOW) of the text corpus. Exhibit 31 shows
a sample of 100 tokens from the BOW. This preliminary unigram BOW can be used
to construct a document term matrix (DTM) for ML training.
Exhibit 31: One Hundred Sample Tokens from Preliminary Unigram BOW
The final DTM for ML model training will be prepared after the data exploration
stage. Data exploration may reveal unnecessary tokens or anomalies in the data. Any
unnecessary tokens that are not informative must be removed, which will also impact
the creation of n-grams. Thus, the final DTM must be made after further analyses and
operations, such as exploratory data analysis and feature selection.
11 DATA EXPLORATION
and least commonly present in the texts. The most frequent word occurrences in all
sentences from the dataset are shown in Exhibit 32. These common words will be
removed during the feature selection step. Notably, the tokens “million” and “curren-
cysign” occur frequently due to the financial nature of the data.
the
million
currencysign
in
to
of
from
a
and
profit
for
it
net
year
oper
sale
percentsign
The most frequent word occurrences in the sentences in the negative sentiment and
the positive sentiment classes are shown in Exhibit 33. The most commonly occur-
ring words are similar for both sentiment classes, meaning that they are not useful
in discriminating between the two sentiment classes. This finding demonstrates the
utility of removing the most commonly used tokens from the BOW.
© CFA Institute. For candidate use only. Not for distribution.
324 Learning Module 7 Big Data Projects
Exhibit 33: Most Frequently Used Tokens in Two Sentiment Classes of the
Corpus
Negative Positive
the the
million million
currencysign currencysign
in in
to to
of of
from from
a a
and it
profit and
for profit
net for
year net
oper year
percentsign oper
300
200
100
0
0 50 100 150 200 250 300
Number of Characters in a Sentence
Word clouds are a convenient method of visualizing the text data because they enable
rapid comprehension of a large number of tokens and their corresponding weights.
Exhibit 35 shows a word cloud for all the sentences in the corpus. The font sizes
© CFA Institute. For candidate use only. Not for distribution.
Data Exploration 325
of the words are proportionate to the number of occurrences of each word in the
corpus. Similarly, Exhibit 36 shows the word cloud divided into two halves: one half
representing negative sentiment class sentences (upper half ); one half representing
positive sentiment class sentences (lower half ). Notably, some highly discriminative
stems and words, such as “decreas” and “down” in the negative half and “increas” and
“rose” in the positive half, are present. The feature selection process will eliminate
common words and highlight useful words for better model training.
Feature Selection
Exploratory data analysis revealed the most frequent tokens in the texts that could
potentially add noise to this ML model training process. In addition to common tokens,
many rarely occurring tokens, often proper nouns (i.e., names), are not informative
for understanding the sentiment of the sentence. Further analyses must be conducted
to decide which words to eliminate. Feature selection for text data involves keeping
the useful tokens in the BOW that are informative and help to discriminate different
classes of texts—those with positive sentiment and those with negative sentiment. At
this point, a total of 44,151 non-unique tokens are in the 2,180 sentences.
Frequency analysis on the processed text data helps in filtering unnecessary
tokens (or features) by quantifying how important tokens are in a sentence and in the
corpus as a whole. Term frequency (TF) at the corpus level—also known as collection
frequency (CF)—is the number of times a given word appears in the whole corpus
(i.e., collection of sentences) divided by the total number of words in the corpus.
Term frequency can be calculated and examined to identify outlier words. Exhibit
37 shows the descriptive statistics of term frequency for the words at the collection
level. The statistics of TF range between 0 and 1 because TF values are ratios of total
occurrences of a particular word to total number of words in the collection. A sample
of words with the highest TF and lowest TF values is also shown to gain insight into
what kinds of words occur at these extreme frequencies.
word TF word TF
<chr> <dbl> <chr> <dbl>
the 0.05429096 yet 2.264954e-05
million 0.04722430 yihn 2.264954e-05
currencysign 0.04627302 young 2.264954e-05
in 0.03870807 zahariev 2.264954e-05
to 0.03476705 zone 2.264954e-05
of 0.03377047 zoo 2.264954e-05
Frequency
700
600
500
400
0
0 .0002 .0004 .0006 .0008 .0010 .0012
TF
© CFA Institute. For candidate use only. Not for distribution.
Data Exploration 327
Calculating highest and lowest TFs at the collection level is a general strategy to
identify noisy terms. The histogram in Exhibit 37 shows a long tail to the right, which
represents common terms that must be removed. The high frequency bars on the
left show that there are also many rare terms (e.g., ones appearing only once or twice
across the data). Such rare terms do not appear enough to be used as meaningful
features and are often removed. The words with the highest TF are mostly stop words
that are not useful because they are present in most of the sentences and thus do not
contribute to differentiating the sentiment embedded in the text. The words with the
lowest TF values are mostly proper nouns or sparse terms that are also not important
to the meaning of the text. In this example, after careful examination of words with
extreme frequencies, the words with high TF values (>99.5th percentile, 14 words)
and low TF values (<30th percentile, 714 words) are removed before forming the final
document term matrix (DTM). Exhibit 38 shows the 14 words with the highest TF
values (>99.5th percentile) that are the custom stop words for this project.
TF (Collection Level)
=
TotalWordCount/Total number of words in collection.
(10)
TF (Sentence Level)
=
WordCountInSentence/TotalWordsInSentence.
(11)
For example, TF at the sentence level for the word “the” in sentences num-
ber 701 and 223 is calculated as 6/39 = 0.1538462 and 5/37 = 0.1351351,
respectively.
8. DF (Document Frequency): Defined as the number of documents (i.e., sen-
tences) that contain a given word divided by the total number of sentences
(here, 2,180). Document frequency is important since words frequently
occurring across sentences provide no differentiating information in each
sentence. The following equation can be used to compute DF:
TF or TF–IDF values are placed at the intersection of sentences (rows) and terms
(columns) of the document term matrix. For this project, TF values are used for the
DTM as the texts are sentences rather than paragraphs or other larger bodies of
text. TF–IDF values vary by the number of documents in the dataset; therefore, the
model performance can vary when applied to a dataset with just a few documents.
In addition to removing custom stop words and sparse terms, single character letters
are also eliminated because they do not add any value to the sentiment significance.
Feature Engineering
N-grams are used as a feature engineering process in this project. Use of n-grams
helps to understand the sentiment of a sentence as a whole. As mentioned previously,
the objective of this project is to predict sentiment class (positive and negative) from
financial texts. Both unigram and bigrams are implemented, and the BOW is created
from them. Bigram tokens are helpful for keeping negations intact in the text, which
is vital for sentiment prediction. For example, the tokens “not” and “good” or “no”
and “longer” can be formed into single tokens, now bigrams, such as “not_good”
and “no_longer.” These and similar tokens can be useful during ML model training
and can improve model performance. Exhibit 41 shows a sample of 100 words from
the BOW containing both unigram and bigram tokens after removal of custom stop
words, sparse terms, and single characters. Note that the BOW contains such tokens
as increas, loss, loss_prior, oper_rose, tax_loss, and sale_increas. Such tokens are
informative about the embedded sentiment in the texts and are useful for training
an ML model. The corresponding word frequency measures for the document term
matrix are computed based on this new BOW.
© CFA Institute. For candidate use only. Not for distribution.
330 Learning Module 7 Big Data Projects
Exhibit 41: One-Hundred Sample Tokens from Final BOW of Entire Corpus
EXAMPLE 6
1. Determine and interpret term frequency (TF) at the collection level and
at the sentence level for the word (i.e., token) “a” in sentence 1,826 in term
frequency measures Table 1 and then for the token “great” in sentence 1,368
in term frequency measures Table 2.
Solution:
TF at the collection level is calculated using Equation 10:
© CFA Institute. For candidate use only. Not for distribution.
Data Exploration 331
Solution:
To calculate TF–IDF, besides TF at the sentence level, document frequency
(DF) and inverse document frequency (IDF) are also required.
DF is the number of documents (i.e., sentences) that contain a given word
divided by the total number of sentences in the corpus (here, 2,180). DF is
calculated using Equation 12:
DF = SentenceCountWithWord/Total number of sentences.
For token “a” in sentence 1,826, DF is 687/2,180 = 0.315138 or 31.514%.
For token “great” in sentence 1,368, DF is 4/2,180 = 0.001835 or 0.184%.
Document frequency is important since tokens occurring frequently across
sentences (such as “a”) provide no differentiating information in each sen-
tence. Tokens occurring less frequently across sentences (such as “great”),
however, may provide useful differentiating information.
IDF is a relative measure of how important a term is across the entire corpus
(i.e., collection of texts/sentences). IDF is calculated using Equation 13:
IDF = log(1/DF).
For token “a” in sentence 1,826, IDF is log(1/0.315138) = 1.154746.
For token “great” in sentence 1,368, IDF is log(1/0.001835) = 6.300786.
Using TF and IDF, TF–IDF can now be calculated using Equation 14:
© CFA Institute. For candidate use only. Not for distribution.
332 Learning Module 7 Big Data Projects
TF–IDF = TF × IDF.
For token “a” in sentence 1,826, TF–IDF = 0.176471 × 1.154746 = 0.203779,
or 20.378%.
For token “great” in sentence 1,368, TF–IDF = 0.111111 × 6.300786 =
0.700087, or 70.009%.
As TF–IDF combines TF at the sentence level with IDF across the entire
corpus, it provides a complete representation of the value of each word. A
high TF–IDF value indicates the word appears many times within a small
number of documents, signifying an important yet unique term within a
sentence (such as “great”). A low TF–IDF value indicates tokens that appear
in most of the sentences and are not discriminative (such as “a”). TF–IDF
values are useful in extracting the key terms in a document for use as fea-
tures for training an ML model.
12 MODEL TRAINING
The sentiment class labels (positive and negative) constitute the target variable (y) for
model training. They are relabeled as 1 (for positive) and 0 (for negative) to enable
calculating the performance metrics, such as receiver operating characteristic (ROC)
curve and area under the curve (AUC) from the trained model results. The master
dataset that has been cleansed and preprocessed is partitioned into three separate
sets: 1) training set; 2) cross-validation (CV) set; and 3) test set. These are in the ratio
of 60:20:20, respectively (following common practice). For splitting, simple random
sampling is applied within levels of the target variable to balance the class distribu-
tions within the splits. The final DTM is built using the sentences (rows), which are
the instances, and resulting tokens (columns), which are the feature variables, from
the BOW of the training dataset. The final BOW consists of unigram and bigram
tokens from the sentences in the training corpus only. The DTM is then filled in with
resultant TF values of the tokens from the training corpus.
Similarly, the DTMs for the CV set and the test set are built using tokens from the
final training BOW for tuning, validating, and testing of the model. To be clear, the
final BOW from the training corpus is used for building DTMs across all the splits
because the model has been trained on that final BOW. Thus, the columns (think,
features) of all three DTMs are the same, but the number of rows varies because a
different number of sentences are in each split. The DTMs are filled with resultant
term frequency values calculated using sentences in the corpuses of the respective
splits—sentences from the CV set corpus and sentences from the test set corpus.
Exhibit 44 tabulates the summary of dimensions of the data splits and their uses in
the model training process. As mentioned, the columns of DTMs for the splits are
the same, equal to the number of unique tokens (i.e., features) from the final training
corpus BOW, which is 9,188. Note that this number of unique tokens (9,188) differs
from that in the master corpus (11,501) based on the sentences that are included in
the training corpus after the random sampling.
© CFA Institute. For candidate use only. Not for distribution.
Model Training 333
Number of
Corpus Split % Sentences DTM Dimensions Purpose
Master 100% 2180 2180 × 11501 Used for data exploration
Training 60% 1309 1309 × 9188 Used for ML model training
CV 20% 435 435 × 9188 Used for tuning and validating the trained model
Test 20% 436 436 × 9188 Used for testing the trained, tuned, and validated
model
Method Selection
Alternative ML methods, including SVM, decision trees, and logistic regression, were
examined because these techniques are all considered potentially suitable for this
particular task (i.e., supervised learning), type of data (i.e., text), and size of data (i.e.,
wider data with many potential variables). The SVM and logistic regression methods
appeared to offer better performance than decision trees. For brevity, we discuss
logistic regression in the remainder of the chapter. Logistic regression was used to
train the model, using the training corpus DTM containing 1,309 sentences. As a
reminder, in this project texts are the sentences and the classifications are positive
and negative sentiment classes (labeled 1 and 0, respectively). The tokens are feature
variables, and the sentiment class is the target variable. Text data typically contain
thousands of tokens. These result in sparse DTMs because each column represents
a token feature and the values are mostly zeros (i.e., not all the tokens are present
in every text). Logistic regression can deal with such sparse training data because
the regression coefficients will be close to zero for tokens that are not present in a
significant number of sentences. This allows the model to ignore a large number of
minimally useful features. Regularization further helps lower the coefficients when
the features rarely occur and do not contribute to the model training.
Logistic regression is applied on the final training DTM for model training. As
this method uses maximum likelihood estimation, the output of the logistic model is
a probability value ranging from 0 to 1. However, because the target variable is binary,
coefficients from the logistic regression model are not directly used to predict the
value of the target variable. Rather, a mathematical function uses the logistic regression
coefficient (β) to calculate probability (p) of sentences having positive sentiment (y =
1).3 If p for a sentence is 0.90, there is a 90% likelihood that the sentence has positive
sentiment. Theoretically, the sentences with p > 0.50 likely have positive sentiment.
Because this is not always true in practice, however, it is important to find an ideal
threshold value of p. We elaborate on this point in a subsequent example. The thresh-
old value is a cutoff point for p values, and the ideal threshold p value is influenced
by the dataset and model training. When the p values (i.e., probability of sentences
having positive sentiment) of sentences are above this ideal threshold p value, then
the sentences are highly likely to have positive sentiment (y = 1). The ideal threshold
p value is estimated heuristically using performance metrics and ROC curves, as will
be demonstrated shortly.
Exhibit 45: ROC Curves of Model Results for Training and CV Data Before
Regularization
A. ROC Curve for Training Data B. ROC Curve for CV Data
True Positive Rate True Positive Rate
1.0 1.0
0.8 0.8
0.6 0.6
AUC = AUC =
96.5% 86.2%
0.4 0.4
0.2 0.2
0 0
0 0.2 0.4 0.6 0.8 1.0 0 0.2 0.4 0.6 0.8 1.0
False Positive Rate False Positive Rate
As the model is overfitted, least absolute shrinkage and selection operator (LASSO)
regularization is applied to the logistic regression. LASSO regularization penalizes
the coefficients of the logistic regression to prevent overfitting of the model. The
penalized regression will select the tokens (features) that have statistically significant
(i.e., non-zero) coefficients and that contribute to the model fit; LASSO does this
while disregarding the other tokens. Exhibit 46 shows the ROC curves for the new
model that uses regularized logistic regression. The ROC curves look similar for model
performance on both datasets, with an AUC of 95.7% on the training dataset (Panel
A) and 94.8% on the CV dataset (Panel B). These findings suggest that the model per-
forms similarly on both training and CV data and thus indicate a good fitting model
(one that is not overfitted).
© CFA Institute. For candidate use only. Not for distribution.
Model Training 335
Exhibit 46: ROC Curves of Model Results for Training and CV Data After
Regularization
A. ROC Curve for Training Data B. ROC Curve for CV Data
True Positive Rate True Positive Rate
1.0 1.0
0.8 0.8
0.6 0.6
AUC = AUC =
95.7% 94.8%
0.4 0.4
0.2 0.2
0 0
0 0.2 0.4 0.6 0.8 1.0 0 0.2 0.4 0.6 0.8 1.0
False Positive Rate False Positive Rate
Regularization along with careful feature selection help to prevent overfitting in logis-
tic regression models. Another model was trained using all token features, including
stop words, sparse terms, and single characters, with no regularization. That model
showed an AUC of 99.1% when applied on the training dataset and an AUC of 89.4%
when applied on the CV dataset, suggesting that the model is overfitting. As the AUC
values in all of the models discussed are not far from 100%, these models are clearly
not underfitting. In sum, the final ML model for this project uses logistic regression
with LASSO regularization.
To further evaluate the model, error analysis is conducted by calculating a confusion
matrix using the ML model results from the cross-validation dataset. The threshold
p value of 0.5 is used as a cutoff point. When target value p > 0.5, the prediction is
assumed to be y = 1 (meaning, positive sentiment). Otherwise, the prediction is assumed
to be y = 0 (negative sentiment). A confusion matrix, with performance metrics and
overall scores for the model results using the CV data, is shown in Exhibit 47.
Exhibit 47: Confusion Matrix of Model Results for CV Data with Threshold p
Value = 0.50
Confusion Matrix for CV Data with Threshold = 0.5
Performance Metrics
The model accuracy is 90% with a theoretically suggested (default) threshold p value
of 0.5. The CV data are used to tune the threshold value for best model performance.
Various p values from 0.01 to 0.99 are systematically evaluated individually, and con-
fusion matrixes and performance metrics are calculated using each of these p values.
Based on these metrics, the p value resulting in the highest model accuracy is selected
as the ideal threshold p value. However, there are often trade-offs: Minimizing false
positives (FPs) comes at a cost of increasing false negatives (FNs), and vice versa.
Prioritizing various performance statistics (e.g., precision versus recall) depends on
the context and relative consequences of FP and FN on the project applications. In
this project, the values of negative sentiment and positive sentiment sentences are
assumed to be equal, thus the impacts of FP and FN are also equal. It is common
practice to simulate many model results using different threshold p values and to
search for maximized accuracy and F1 statistics that minimize these trade-offs. As
noted earlier, accuracy and F1 scores are overall performance measures that give
equal weight to FP and FN.
Exhibit 48 shows the overall performance measures (i.e., F1 score and accuracy) for
various threshold p values. The threshold p value that results in the highest accuracy
and F1 score can now be identified. From the charts in Exhibit 47, the ideal threshold p
value appears to be around 0.60. To investigate further, a table of performance measures
(i.e., precision, recall, F1 score, and accuracy) is generated for a series of threshold p
values ranging from 0.45 to 0.75. The table in Exhibit 49 demonstrates that threshold
p values between 0.60 and 0.63 result in the highest accuracy and F1 score for the
CV dataset. As a result of this analysis, a final threshold p value of 0.60 is selected.
0.9
0.8
0.8
0.6 0.7
0.4 0.6
0.5
0.2
0.4
0 0
0 0.2 0.4 0.6 0.8 1.0 0 0.2 0.4 0.6 0.8 1.0
Threshold Value Threshold Value
* The shaded row shows the selected threshold p value (0.60) and the performance metrics for the selected
model.
Finally, the confusion matrix using the ideal threshold p value of 0.60 is constructed
to observe the performance of the final model. When target value p > 0.60, the predic-
tion is assumed to be y = 1 (indicating positive sentiment); otherwise, the prediction
is assumed to be y = 0 (negative sentiment). The confusion matrix for the CV data is
shown in Exhibit 50. It is clear that the model performance metrics have improved
in the final model compared to the earliest case when the threshold p value was 0.50.
Now, accuracy and F1 score have both increased by one percentage point to 91% and
94%, respectively, while precision has increased by two percentage points to 90%.
© CFA Institute. For candidate use only. Not for distribution.
338 Learning Module 7 Big Data Projects
Exhibit 50: Confusion Matrix of Model Results for CV Data with Threshold p
Value = 0.60
Confusion Matrix for CV Data with Threshold = 0.6
Performance Metrics
The final ML model with the appropriate threshold p value has been validated and is
now ready for use. The model can be used to predict the sentiment of new sentences
from the test data corpus as well as new sentences from similar financial text data
sources, such as news wires, earnings call transcripts, and quarterly financial reports.
The final model is a collection of penalized regression coefficients for unigram and
bigram tokens from the BOW of the training corpus. To use the model to predict the
sentiment of new sentences, tokenization and identical cleansing and preprocessing
operations must be performed on the new sentences. All the processes performed
on the training data must be performed on the new data to which the model will be
applied (as was done for the test dataset). The model will use the trained penalized
regression coefficients on the term frequency (TF) values of the tokens in the document
term matrix (DTM) of the new sentences and will determine the target value (p). The
columns of the DTM of the new sentences are the same as those of the training DTM,
but the TF values are calculated based on the test corpus. Using the threshold p value
of 0.60, the sentiment class for each sentence in the test corpus will be predicted.
The model is now applied on the test data that contains 436 sentences. Note that
the test data were not used to train or validate/tune the model and are new to the
model. The test data were preprocessed identically to the training and CV data while a
part of the master corpus. The model is then applied to the test DTM, and the results
are obtained. Exhibit 51 displays 30 sample results from the test corpus. The results
table contains cleansed and preprocessed sentences, actual sentiment, target p values
from the model, and predicted sentiment. Note that this sample contains three cases
of misclassification: the 10th sentence (text), where p = 0.46; the 26th text, where p
= 0.77; and the 30th text, where p = 0.71. Therefore, accuracy of this 30-text sample
is 27/30 = 90%.
© CFA Institute. For candidate use only. Not for distribution.
Results and Interpretation 339
Predicted
Sentence Sentiment p Sentiment
exclude non recur item pre tax surg percentsign 1 0.81 1
adp news feb finnish retail kesko oyj hel kesbv said today total sale exclud 0 0.12 0
valu ad tax vat stood at januari down percentsign on yea
india trade with russia current stand at four billion dollar grow per cent 1 0.83 1
fiscal
refin margin was bbl combar bbl prior 1 0.81 1
scania morgan Stanley lift share target on swedish heavi duti truck bus 1 0.83 1
maker scania ab crown euro crown euro
deal is like bring save 1 0.83 1
will also strengthen ruukki offshore busi 1 0.83 1
last week finnish metl technolog group announc plan sell more than per- 1 0.83 1
cent technolog unit further compani strategy goal becom world largest
stainless steel maker
nest oil board propos dividend full compar with ago 1 0.81 1
pre tax loss total compar loss first quarter 1 0.46 0
pretax total compar loss fourth quarter 1 0.74 1
re use back into pet bottle has also steadili increas rate use strap tape has 1 0.95 1
pick up again after dip pector said previous
satama sale would be higher than befor 1 0.83 1
octob finnish wood product technolog supplier raut oyj hel rutav said 1 0.79 1
today swung first nine month versus loss same period earlier
ebit total compar loss correspond period 1 0.74 1
finnish consum packag manufactur huhtamaki oyj said swung euro first 1 0.77 1
nine month loss euro same period
finnish dental care group oral hammaslaakarit oyj post total euro first 1 0.79 1
nine month versus loss euro same period
finnish silicon water manufactur okmet oyj said swung euro first nine 1 0.77 1
month loss euro earlier
adp news feb finnish print circuit board pcb maker aspocomp group oyj 1 0.79 1
hel acg said today swung versus loss
mn pretax third quarter 1 0.83 1
oper total compar correspond period 1 0.81 1
raut post euro third quarter compar loss euro correspond period 1 0.74 1
russian export duti will active harvest finland sale russia will increas also 1 0.91 1
compani expect sale signific increas 1 0.91 1
compani amount ee which was percentsign more than 1 0.81 1
third quarter fiscal efor swung loss versus correspond period fiscal 0 0.77 1
acando ab acanb ss fell percent kronor lowest close sinc dec 0 0.20 0
compani oper loss total compar 0 0.27 0
last paseng flew airlin down percent 0 0.12 0
loss after financi item total compar correspond period 0 0.71 1
Exhibit 52 shows the confusion matrix for the test data. Accuracy and F1 score are
90% and 93%, respectively, while precision and recall are 89% and 98%, respectively.
Therefore, it is apparent that the model performs similarly on the training, CV, and
© CFA Institute. For candidate use only. Not for distribution.
340 Learning Module 7 Big Data Projects
test datasets. These findings suggest that the model is robust and is not overfitting.
They also suggest that the model should generalize well out-of-sample and can thus
be used to predict the sentiment classes for new sentences from similar financial
text data sources. Of course, these new text data must first be subjected to identical
tokenization, cleansing, and preprocessing as done for the training dataset.
Exhibit 52: Confusion Matrix of Model Results for Test Data with Threshold
p Value = 0.60
Confusion Matrix for Test Data
Performance Metrics
To recap, this project involves converting unstructured data (i.e., text data from finan-
cial data sources) into structured data (i.e., tokens, sentences, and term frequency
values) in a document term matrix that is used as input for training, validating, and
testing machine learning-based models (here, logistic regression) for predicting clas-
sification (here, sentiment classes). Similar models can be built and used in different
contexts to understand the sentiment embedded in larger texts. The derived sentiment
classification can be useful as a visualization tool to provide insight about the text
without reading large documents. These sentiment classifications can also be used
as structured input data for larger ML models that have a specific purpose, such as
to predict future stock price movements.
EXAMPLE 7
Solution:
Since confusion matrix A has fewer true positives (TPs) and fewer true neg-
atives (TNs) than the confusion matrix in Exhibit 48 (281 vs. 284 and 110
vs. 114, respectively), confusion matrix A has lower accuracy and a lower
F1 score compared to the one in Exhibit 48 (0.90 vs. 0.91 and 0.93 vs. 0.94,
respectively). Also, although confusion matrix A has slightly better preci-
sion, 0.91 vs. 0.90, due to a few less false positives (FPs), it has significantly
lower recall, 0.94 vs. 0.98, due to having many more false negatives (FNs),
17 vs. 7, than the confusion matrix in Exhibit 48. On balance, the ML model
using the threshold p value of 0.60 is the superior model for this sentiment
classification problem.
Solution:
Confusion matrix B has the same number of TPs (281) and TNs (110) as
confusion matrix A. Therefore, confusion matrix B also has lower accu-
racy (0.90) and a lower F1 score (0.93) compared to the one in Exhibit 48.
Although confusion matrix B has slightly better recall, 0.99 vs. 0.98, due
to fewer FNs, it has somewhat lower precision, 0.87 vs. 0.90, due to having
many more FPs, 41 vs. 30, than the confusion matrix in Exhibit 48. Again,
it is apparent that the ML model using the threshold p value of 0.60 is the
better model in this sentiment classification context.
Solution:
The main differences in performance metrics between confusion matrixes
A and B are in precision and recall. Confusion matrix A has higher preci-
sion, at 0.91 vs. 0.87, but confusion matrix B has higher recall, at 0.99 vs.
0.94. These differences highlight the trade-off between FP (Type I error) and
FN (Type II error). Precision is useful when the cost of FP is high, such as
when an expensive product that is fine mistakenly fails quality inspection
and is scrapped; in this case, FP should be minimized. Recall is useful when
the cost of FN is high, such as when an expensive product is defective but
mistakenly passes quality inspection and is sent to the customer; in this
© CFA Institute. For candidate use only. Not for distribution.
342 Learning Module 7 Big Data Projects
SUMMARY
In this reading, we have discussed the major steps in big data projects involving the
development of machine learning (ML) models—namely, those combining textual big
data with structured inputs.
■ Big data—defined as data with volume, velocity, variety, and potentially
lower veracity—has tremendous potential for various fintech applications,
including several related to investment management.
■ The main steps for traditional ML model building are conceptualization of
the problem, data collection, data preparation and wrangling, data explora-
tion, and model training.
■ For textual ML model building, the first four steps differ somewhat from
those used in the traditional model: Text problem formulation, text curation,
text preparation and wrangling, and text exploration are typically necessary.
■ For structured data, data preparation and wrangling entail data cleansing
and data preprocessing. Data cleansing typically involves resolving incom-
pleteness errors, invalidity errors, inaccuracy errors, inconsistency errors,
non-uniformity errors, and duplication errors.
■ Preprocessing for structured data typically involves performing the fol-
lowing transformations: extraction, aggregation, filtration, selection, and
conversion.
■ Preparation and wrangling text (unstructured) data involves a set of
text-specific cleansing and preprocessing tasks. Text cleansing typically
involves removing the following: html tags, punctuations, most numbers,
and white spaces.
■ Text preprocessing requires performing normalization that involves the
following: lowercasing, removing stop words, stemming, lemmatization,
creating bag-of-words (BOW) and n-grams, and organizing the BOW and
n-grams into a document term matrix (DTM).
■ Data exploration encompasses exploratory data analysis, feature selection,
and feature engineering. Whereas histograms, box plots, and scatterplots
are common techniques for exploring structured data, word clouds are
an effective way to gain a high-level picture of the composition of textual
content. These visualization tools help share knowledge among the team
(business subject matter experts, quants, technologists, etc.) to help derive
optimal solutions.
■ Feature selection methods used for text data include term frequency, docu-
ment frequency, chi-square test, and a mutual information measure. Feature
engineering for text data includes converting numbers into tokens, creating
n-grams, and using name entity recognition and parts of speech to engineer
new feature variables.
© CFA Institute. For candidate use only. Not for distribution.
Results and Interpretation 343
PRACTICE PROBLEMS
Industry Interest
ID Ticker IPO Date (NAICS) EBIT Expense Total Debt
1 ABC 4/6/17 44 9.4 0.6 10.1
2 BCD November 15, 2004 52 5.5 0.4 6.2
3 HIJ 26-Jun-74 54 8.9 1.2 15.8
4 KLM 14-Mar-15 72 5.7 1.5 0.0
After cleansing the data, Steele then preprocesses the dataset. She creates two
new variables: an “Age” variable based on the firm’s IPO date and an “Interest
Coverage Ratio” variable equal to EBIT divided by interest expense. She also de-
letes the “IPO Date” variable from the dataset. After applying these transforma-
tions, Steele scales the financial data using normalization. She notes that over the
full sample dataset, the “Interest Expense” variable ranges from a minimum of 0.2
© CFA Institute. For candidate use only. Not for distribution.
Practice Problems 345
and a maximum of 12.2, with a mean of 1.1 and a standard deviation of 0.4.
Steele and Schultz then discuss how to preprocess the raw text data. Steele tells
Schultz that the process can be completed in the following three steps:
Step 2 Split the cleansed data into a collection of words for them to be
normalized.
Step 3 Normalize the collection of words from Step 2 and create a distinct
set of tokens from the normalized words.
With respect to Step 1, Steele tells Schultz:
“I believe I should remove all html tags, punctuations, numbers, and extra white
spaces from the data before normalizing them.”
After properly cleansing the raw text data, Steele completes Steps 2 and 3. She
then performs exploratory data analysis. To assist in feature selection, she wants
to create a visualization that shows the most informative words in the dataset
based on their term frequency (TF) values. After creating and analyzing the visu-
alization, Steele is concerned that some tokens are likely to be noise features for
ML model training; therefore, she wants to remove them.
Steele and Schultz discuss the importance of feature selection and feature engi-
neering in ML model training. Steele tells Schultz:
“Appropriate feature selection is a key factor in minimizing model overfitting,
whereas feature engineering tends to prevent model underfitting.”
Once satisfied with the final set of features, Steele selects and runs a model on
the training set that classifies the text as having positive sentiment (Class “1” or
negative sentiment (Class “0”). She then evaluates its performance using error
analysis. The resulting confusion matrix is presented in Exhibit 2.
2. Steele’s concern about using Twitter data in the model best relates to:
A. volume.
B. velocity.
C. veracity.
© CFA Institute. For candidate use only. Not for distribution.
346 Learning Module 7 Big Data Projects
3. What type of error appears to be present in the IPO Date column of Exhibit 1?
A. invalidity error.
B. inconsistency error.
C. non-uniformity error.
4. What type of error is most likely present in the last row of data (ID #4) in Exhibit
1?
A. Inconsistency error
B. Incompleteness error
C. Non-uniformity error
5. During the preprocessing of the data in Exhibit 1, what type of data transforma-
tion did Steele perform during the data preprocessing step?
A. Extraction
B. Conversion
C. Aggregation
6. Based on Exhibit 1, for the firm with ID #3, Steele should compute the scaled
value for the “Interest Expense” variable as:
A. 0.008.
B. 0.083.
C. 0.250.
B. lemmatization.
C. standardization.
B. set of n-grams.
10. Given her objective, the visualization that Steele should create in the exploratory
© CFA Institute. For candidate use only. Not for distribution.
Practice Problems 347
B. word cloud.
11. To address her concern in her exploratory data analysis, Steele should focus on
those tokens that have:
A. low chi-square statistics.
B. 81%.
C. 85%.
B. 81%.
C. 85%.
B. 81%.
C. 85%.
Statement 1 Some of the methods used in the exploration step are different
for structured and unstructured data, but for both types of data,
the step involves feature selection and feature engineering.
The dataset is now ready for the text exploration step. At this point in the pro-
cess, Rivera wants to better comprehend the collection of unique words. Achler
recommends an exploratory data analysis technique that visualizes words by
varying their font size proportionately to the number of occurrences of each
word in the corpus.
As an additional part of the text exploration step, Achler conducts a term fre-
quency analysis to identify outliers. Achler summarizes the analysis in Exhibit 2.
Group 1 Group 2
Group 1 Group 2
Achler has the data ready for the model training process. Rivera asks Achler
to include start-up failure rates as a feature. Achler notices that the number of
start-ups that fail (majority class) is significantly larger than the number of the
start-ups that are successful (minority class). Achler is concerned that because of
class imbalance, the model will not be able to discriminate between start-ups that
fail and start-ups that are successful.
Achler splits the DTM into training, cross-validation, and test datasets. Achler
uses a supervised learning approach to train the logistic regression model in
predicting sentiment. Applying the receiver operating characteristics (ROC)
technique and area under the curve (AUC) metrics, Achler evaluates model
performance on both the training and the cross-validation datasets. The trained
model performance for three different logistic regressions’ threshold p-values is
presented in Exhibit 3.
B. Only Statement 2
17. Based on the source of the data, as part of the data cleansing and wrangling pro-
cess, Achler most likely needs to remove:
A. html tags and perform scaling.
18. Based on Exhibit 1, which token group has most likely undergone the text prepa-
ration and wrangling process?
A. Token Group 1
B. Token Group 2
C. Token Group 3
19. The visual text representation technique that Achler recommends to Rivera is a:
A. word cloud.
B. bag of words.
C. collection frequency.
20. Based on Exhibit 2, Achler should exclude from further analysis words in:
A. only Group 1.
B. only Group 2.
21. Achler’s model training concern related to the model’s ability to discriminate
could be addressed by randomly:
A. oversampling the failed start-up data.
22. Based on Exhibit 3, which threshold p-value indicates the best fitting model?
A. 0.57
B. 0.79
C. 0.84
23. Based on Exhibit 3, if Achler wants to improve model performance at the thresh-
old p-value of 0.84, he should:
A. tune the model to lower the AUC.
24. Based on Achler’s grid search analysis, the current model can be characterized as:
A. underfitted.
Azarov and Bector evaluate the Dataset XYZ performance metrics for Confusion
Matrices A, B, and C in Exhibit 1. Azarov says, “For Ganymede’s purposes, we
should be most concerned with the cost of Type I errors.”
Azarov requests that Bector apply the ML model to the test dataset for Dataset
XYZ, assuming a threshold p-value of 0.65. Exhibit 2 contains a sample of results
from the test dataset corpus.
© CFA Institute. For candidate use only. Not for distribution.
352 Learning Module 7 Big Data Projects
25. Based on the text exploration method used for Dataset ABC, tokens that poten-
tially carry important information useful for differentiating the sentiment embed-
ded in the text are most likely to have values that are:
A. low.
B. intermediate.
C. high.
26. Which of Bector’s statements regarding TF, IDF, and TF–IDF is correct?
A. Statement 1
B. Statement 2
C. Statement 3
B. 20%
C. 60%
28. Based only on Dataset XYZ’s composition and Bector’s view regarding false pos-
itive and false negative evaluation metrics, which performance measure is most
appropriate?
A. Recall
B. F1 score
© CFA Institute. For candidate use only. Not for distribution.
Practice Problems 353
C. Precision
29. Based on Exhibit 1, which confusion matrix demonstrates the most favorable
value of the performance metric that best addresses Azarov’s concern?
A. Confusion Matrix A
B. Confusion Matrix B
C. Confusion Matrix C
30. Based on Exhibit 2, the accuracy metric for Dataset XYZ’s test set sample is
closest to:
A. 0.67.
B. 0.70.
C. 0.75.
B. Only Remark 2
SOLUTIONS
1. B is correct. The five steps in building structured data-based ML models are:
1) conceptualization of the modeling task, 2) data collection, 3) data prepara-
tion and wrangling, 4) data exploration, and 5) model training. The five steps in
building text-based ML models are: 1) text problem formulation, 2) data (text)
curation, 3) text preparation and wrangling, 4) text exploration, and 5) model
training. Statement 1 is incorrect: Text preparation and wrangling is the third
step in building text ML models and occurs after the second data (text) curation
step. Statement 2 is correct: The fourth step in building both types of models
encompasses data/text exploration.
3. C is correct. A non-uniformity error occurs when the data are not presented in
an identical format. The data in the “IPO Date” column represent the IPO date of
each firm. While all rows are populated with valid dates in the IPO Date column,
the dates are presented in different formats (e.g., mm/dd/yyyy, dd/mm/yyyy).
4. A is correct. There appears to be an inconsistency error in the last row (ID #4).
An inconsistency error occurs when a data point conflicts with corresponding
data points or reality. In the last row, the interest expense data item has a value of
1.5, and the total debt item has a value of 0.0. This appears to be an error: Firms
that have interest expense are likely to have debt in their capital structure, so
either the interest expense is incorrect or the total debt value is incorrect. Steele
should investigate this issue by using alternative data sources to confirm the cor-
rect values for these variables.
5. A is correct. During the data preprocessing step, Steele created a new “Age”
variable based on the firm’s IPO date and then deleted the “IPO Date” variable
from the dataset. She also created a new “Interest Coverage Ratio” variable equal
to EBIT divided by interest expense. Extraction refers to a data transformation
where a new variable is extracted from a current variable for ease of analyzing
and using for training an ML model, such as creating an age variable from a date
variable or a ratio variable. Steele also performed a selection transformation by
deleting the IPO Date variable, which refers to deleting the data columns that are
not needed for the project.
The firm with ID #3 has an interest expense of 1.2. So, its normalized value is
calculated as:
1.2 − 0.2
Xi (normalized) = _
12.2 − 0.2 = 0.083.
7. B is correct. Although most punctuations are not necessary for text analysis and
© CFA Institute. For candidate use only. Not for distribution.
Solutions 355
8. A is correct. Tokenization is the process of splitting a given text into separate to-
kens. This step takes place after cleansing the raw text data (removing html tags,
numbers, extra white spaces, etc.). The tokens are then normalized to create the
bag-of-words (BOW).
10. B is correct. Steele wants to create a visualization for Schultz that shows the most
informative words in the dataset based on their term frequency (TF, the ratio
of the number of times a given token occurs in the dataset to the total number
of tokens in the dataset) values. A word cloud is a common visualization when
working with text data as it can be made to visualize the most informative words
and their TF values. The most commonly occurring words in the dataset can be
shown by varying font size, and color is used to add more dimensions, such as
frequency and length of words.
11. C is correct. Frequency measures can be used for vocabulary pruning to remove
noise features by filtering the tokens with very high and low TF values across all
the texts. Noise features are both the most frequent and most sparse (or rare)
tokens in the dataset. On one end, noise features can be stop words that are typi-
cally present frequently in all the texts across the dataset. On the other end, noise
features can be sparse terms that are present in only a few text files. Text clas-
sification involves dividing text documents into assigned classes. The frequent
tokens strain the ML model to choose a decision boundary among the texts as
the terms are present across all the texts (an example of underfitting). The rare
tokens mislead the ML model into classifying texts containing the rare terms into
a specific class (an example of overfitting). Thus, identifying and removing noise
features are critical steps for text classification applications.
12. A is correct. A dataset with a small number of features may not carry all the char-
acteristics that explain relationships between the target variable and the features.
Conversely, a large number of features can complicate the model and potentially
distort patterns in the data due to low degrees of freedom, causing overfitting.
Therefore, appropriate feature selection is a key factor in minimizing such model
overfitting. Feature engineering tends to prevent underfitting in the training of
the model. New features, when engineered properly, can elevate the underlying
data points that better explain the interactions of features. Thus, feature engi-
neering can be critical to overcome underfitting.
13. A is correct. Precision, the ratio of correctly predicted positive classes (true posi-
tives) to all predicted positive classes, is calculated as:
Precision (P) = TP/(TP + FP) = 182/(182 + 52) = 0.7778 (78%).
14. B is correct. The model’s F1 score, which is the harmonic mean of precision and
recall, is calculated as:
F1 score = (2 × P × R)/(P + R).
© CFA Institute. For candidate use only. Not for distribution.
356 Learning Module 7 Big Data Projects
15. A is correct. The model’s accuracy, which is the percentage of correctly predicted
classes out of total predictions, is calculated as:
Accuracy = (TP + TN)/(TP + FP + TN + FN).
16. A is correct. Statement 1 is correct because some of the methods used in the
fourth step of ML model building (data/text exploration) are different for struc-
tured and unstructured data, and for both structured and unstructured data, the
exploration step encompasses feature selection and feature engineering. State-
ment 2 is incorrect because Rivera described the text preparation and wrangling
step, not the text curation step. The data (text) curation step involves gathering
relevant external text data via web services or programs that extract raw content
from a source.
B and C are incorrect because Statement 2 is incorrect. Rivera described the
text preparation and wrangling step, not the text curation step. The data (text)
curation step involves gathering relevant external text data via web services or
programs that extract raw content from a source.
17. B is correct. Achler uses a web spidering program that extracts unstructured raw
content from social media webpages. Raw text data are a sequence of characters
and contain other non-useful elements including html tags, punctuation, and
white spaces (including tabs, line breaks, and new lines). Removing numbers is
one of the basic operations in the text cleansing/preparation process for un-
structured data. When numbers (or digits) are present in the text, they should be
removed or substituted with the annotation “/number/.” Lemmatization, which
takes places during the text wrangling/preprocessing process for unstructured
data, is the process of converting inflected forms of a word into its morphological
root (known as lemma). Lemmatization reduces the repetition of words occur-
ring in various forms while maintaining the semantic structure of the text data,
thereby aiding in training less complex ML models.
A is incorrect because although html tag removal is part of text cleansing/prepa-
ration for unstructured data, scaling is a data wrangling/preprocessing process
applied to structured data. Scaling adjusts the range of a feature by shifting and
changing the scale of data; it is performed on numeric variables, not on text data.
C is incorrect because although raw text contains white spaces (including tabs,
line breaks, and new lines) that need to be removed as part of the data cleansing/
preparation process for unstructured data, winsorization is a data wrangling/pre-
processing task performed on values of data points, not on text data. Winsoriza-
tion is used for structured numerical data and replaces extreme values and out-
liers with the maximum (for large-value outliers) and minimum (for small-value
outliers) values of data points that are not outliers.
18. A is correct. Data preparation and wrangling involve cleansing and organizing
raw data into a consolidated format. Token Group 1 includes n-grams (“not_in-
creas_market,” “sale_decreas”) and the words that have been converted from
their inflected forms into their base word (“increas,” “decreas”), and the currency
symbol has been replaced with a “currencysign” token. N-gram tokens are helpful
for keeping negations intact in the text, which is vital for sentiment prediction.
The process of converting inflected forms of a word into its base word is called
stemming and helps decrease data sparseness, thereby aiding in training less
© CFA Institute. For candidate use only. Not for distribution.
Solutions 357
complex ML models.
B is incorrect because Token Group 2 includes inflected forms of words (“in-
creased,” “decreased”) before conversion into their base words (known as stems).
Stemming (along with lemmatization) decreases data sparseness by aggregating
many sparsely occurring words in relatively less sparse stems or lemmas, thereby
aiding in training less complex ML models.
C is incorrect because Token Group 3 includes inflected forms of words (“in-
creased,” “decreased”) before conversion into their base words (known as stems).
In addition, the “EUR” currency symbol has not been replaced with the “curren-
cysign” token and the word “Sales” has not been lowercased.
19. A is correct. Achler recommends creating a word cloud, which is a common text
visualization technique at the data exploration phase in ML model building. The
most commonly occurring words in the dataset can be visualized by varying font
size, and color is used to add more dimensions, such as frequency and length of
words.
B is incorrect because Achler recommends creating a word cloud and not a
bag of words (BOW). A BOW is a collection of a distinct set of tokens from all
the texts in a sample dataset. A BOW representation is a basic procedure used
primarily to analyze text during Step 3 (text wrangling/preprocessing), although
it may also be used in Step 4 during the feature engineering process. In contrast
to a word cloud, which visually varies font size and color, BOW is simply a set of
words (typically displayed in table).
C is incorrect because Achler recommends creating a word cloud and not a
collection frequency. Collection frequency (or term frequency) is the ratio of the
number of times a given token occurs in all the texts in the dataset to the total
number of tokens in the dataset. Collection frequency can be calculated and
examined to identify outlier words, but it is not a visual text representation tool.
20. C is correct. Achler should remove words that are in both Group 1 and Group
2. Term frequency values range between 0 and 1. Group 1 consists of the high-
est frequency values (e.g., “the” = 0.04935), and Group 2 consists of the lowest
frequency values (e.g., “naval” = 1.0123e–05). Frequency analysis on the pro-
cessed text data helps in filtering unnecessary tokens (or features) by quantify-
ing how important tokens are in a sentence and in the corpus as a whole. The
most frequent tokens (Group 1) strain the machine-learning model to choose a
decision boundary among the texts as the terms are present across all the texts,
which leads to model underfitting. The least frequent tokens (Group 2) mislead
the machine-learning model into classifying texts containing the rare terms into
a specific class, which leads to model overfitting. Identifying and removing noise
features is critical for text classification applications.
A is incorrect because words in both Group 1 and Group 2 should be removed.
The words with high term frequency value are mostly stop words, present in
most sentences. Stop words do not carry a semantic meaning for the purpose
of text analyses and ML training, so they do not contribute to differentiating
sentiment.
B is incorrect because words in both Group 1 and Group 2 should be removed.
Terms with low term frequency value are mostly rare terms, ones appearing only
once or twice in the data. They do not contribute to differentiating sentiment.
21. B is correct. Achler is concerned about class imbalance, which can be resolved
by balancing the training data. The majority class (the failed start-up data) can be
randomly undersampled, or the minority class (the successful start-up data) can
be randomly oversampled.
© CFA Institute. For candidate use only. Not for distribution.
358 Learning Module 7 Big Data Projects
22. B is correct. The higher the AUC, the better the model performance. For the
threshold p-value of 0.79, the AUC is 91.3% on the training dataset and 89.7% on
the cross-validation dataset, and the ROC curves are similar for model perfor-
mance on both datasets. These findings suggest that the model performs similarly
on both training and CV data and thus indicate a good fitting model.
A is incorrect because for the threshold p-value of 0.57, the AUC is 56.7% on the
training dataset and 57.3% on the cross-validation dataset. The AUC close to 50%
signifies random guessing on both the training dataset and the cross-validation
dataset. The implication is that for the threshold p-value of 0.57, the model is
randomly guessing and is not performing well.
C is incorrect because for the threshold p-value of 0.84, there is a substantial
difference between the AUC on the training dataset (98.4%) and the AUC on
the cross-validation dataset (87.1%). This suggests that the model performs
comparatively poorly (with a higher rate of error or misclassification) on the
cross-validation dataset when compared with training data. Thus, the implication
is that the model is overfitted.
23. C is correct. At the threshold p-value of 0.84, the AUC is 98.4% for the training
dataset and 87.1% for the cross-validation dataset, which suggests that the model
is currently overfitted. Least absolute shrinkage and selection operator (LASSO)
regularization can be applied to the logistic regression to prevent overfitting of
logistic regression models.
A is incorrect because the higher the AUC, the better the model performance.
B is incorrect because the more convex the ROC curve and the higher the AUC,
the better the model performance. Adjusting model parameters with the aim of
achieving lower ROC convexity would result in worse model performance on the
cross-validation dataset.
24. C is correct. Slight regularization occurs when the prediction error on the train-
ing dataset is small, while the prediction error on the cross-validation data set is
significantly larger. This difference in error is variance. High variance error, which
typically is due to too many features and model complexity, results in model
overfitting.
A is incorrect. The current model has high variance which results in model over-
fitting, not underfitting.
B is incorrect. The difference between the prediction error on the training dataset
and the prediction error on the cross-validation dataset is high, which means that
the current model has high variance, not low.
25. B is correct. When analyzing term frequency at the corpus level, also known
as collection frequency, tokens with intermediate term frequency (TF) values
potentially carry important information useful for differentiating the sentiment
embedded in the text. Tokens with the highest TF values are mostly stop words
that do not contribute to differentiating the sentiment embedded in the text, and
tokens with the lowest TF values are mostly proper nouns or sparse terms that
are also not important to the meaning of the text.
A is incorrect because tokens with the lowest TF values are mostly proper nouns
or sparse terms (noisy terms) that are not important to the meaning of the text.
C is incorrect because tokens with the highest TF values are mostly stop words
(noisy terms) that do not contribute to differentiating the sentiment embedded in
the text.
28. B is correct. F1 score is the most appropriate performance measure for Dataset
XYZ. Bector gives equal weight to false positives and false negatives. Accuracy
and F1 score are overall performance measures that give equal weight to false
positives and false negatives. Accuracy is considered an appropriate performance
measure for balanced datasets, where the number of “1” and “0” classes are equal.
F1 score is considered more appropriate than accuracy when there is unequal
class distribution in the dataset and it is necessary to measure the equilibrium of
precision and recall. Since Dataset XYZ contains an unequal class distribution
between positive and negative sentiment sentences, F1 score is the most appro-
priate performance measure.
Precision is the ratio of correctly predicted positive classes to all predicted pos-
itive classes and is useful in situations where the cost of false positives or Type
I errors is high. Recall is the ratio of correctly predicted positive classes to all
actual positive classes and is useful in situations where the cost of false negatives
or Type II errors is high.
A is incorrect because Bector gives equal weight to false positives and false
negatives. Accuracy and F1 score are overall performance measures that give
equal weight to false positives and false negatives. Recall is the ratio of correctly
predicted positive classes to all actual positive classes and is useful in situations
where the cost of false negatives or Type II errors is high.
C is incorrect because Bector gives equal weight to false positive and false neg-
atives. Accuracy and F1 score are overall performance measures that give equal
weight to false positives and false negatives. Precision is the ratio of correctly
predicted positive classes to all predicted positive classes and is useful in situa-
© CFA Institute. For candidate use only. Not for distribution.
360 Learning Module 7 Big Data Projects
29. A is correct. Precision is the ratio of correctly predicted positive classes to all pre-
dicted positive classes and is useful in situations where the cost of false positives
or Type I errors is high. Confusion Matrix A has the highest precision and there-
fore demonstrates the most favorable value of the performance metric that best
addresses Azarov’s concern about the cost of Type I errors. Confusion Matrix A
has a precision score of 0.95, which is higher than the precision scores of Confu-
sion Matrix B (0.93) and Confusion Matrix C (0.86).
B is incorrect because precision, not accuracy, is the performance measure that
best addresses Azarov’s concern about the cost of Type I errors. Confusion Ma-
trix B demonstrates the most favorable value for the accuracy score (0.92), which
is higher than the accuracy scores of Confusion Matrix A (0.91) and Confusion
Matrix C (0.91). Accuracy is a performance measure that gives equal weight to
false positives and false negatives and is considered an appropriate performance
measure when the class distribution in the dataset is equal (a balanced dataset).
However, Azarov is most concerned with the cost of false positives, or Type I
errors, and not with finding the equilibrium between precision and recall. Fur-
thermore, Dataset XYZ has an unequal (unbalanced) class distribution between
positive sentiment and negative sentiment sentences.
C is incorrect because precision, not recall or F1 score, is the performance
measure that best addresses Azarov’s concern about the cost of Type I errors.
Confusion Matrix C demonstrates the most favorable value for the recall score
(0.97), which is higher than the recall scores of Confusion Matrix A (0.87) and
Confusion Matrix B (0.90). Recall is the ratio of correctly predicted positive class-
es to all actual positive classes and is useful in situations where the cost of false
negatives, or Type II errors, is high. However, Azarov is most concerned with the
cost of Type I errors, not Type II errors.
F1 score is more appropriate (than accuracy) when there is unequal class distri-
bution in the dataset and it is necessary to measure the equilibrium of precision
and recall. Confusion Matrix C demonstrates the most favorable value for the F1
score (0.92), which is higher than the F1 scores of Confusion Matrix A (0.91) and
Confusion Matrix B (0.91). Although Dataset XYZ has an unequal class distri-
bution between positive sentiment and negative sentiment sentences, Azarov is
most concerned with the cost of false positives, or Type I errors, and not with
finding the equilibrium between precision and recall.
30. B is correct. Accuracy is the percentage of correctly predicted classes out of total
predictions and is calculated as (TP + TN)/(TP + FP + TN + FN).
In order to obtain the values for true positive (TP), true negative (TN), false
positive (FP), and false negative (FN), predicted sentiment for the positive (Class
“1”) and the negative (Class “0”) classes are determined based on whether each
individual target p-value is greater than or less than the threshold p-value of 0.65.
If an individual target p-value is greater than the threshold p-value of 0.65, the
predicted sentiment for that instance is positive (Class “1”). If an individual target
p-value is less than the threshold p-value of 0.65, the predicted sentiment for that
instance is negative (Class “0”). Actual sentiment and predicted sentiment are
then classified as follows:
Based on the classification data obtained from Exhibit 2, a confusion matrix can
be generated:
Confusion Matrix for Dataset XYZ Sample Test Data with Threshold p-Value
= 0.65
Using the data in the confusion matrix above, the accuracy metric is computed as
follows:
Accuracy = (TP + TN)/(TP + FP + TN + FN).
= 0.667, or 0.67.
C is incorrect because 0.75 is the precision ratio, not the accuracy metric, for the
sample of the test set for Dataset XYZ, based on Exhibit 2. The precision score is
calculated as follows:
Precision (P) = TP/(TP + FP) = 3/(3 + 1) = 0.75.
31. A is correct. Only Remark 1 is correct. Method selection is the first task of
ML model training and is governed by the following factors: (1) supervised or
unsupervised learning, (2) the type of data, and (3) the size of data. The second
and third tasks of model training, respectively, are performance evaluation and
tuning.
Remark 2 is incorrect because model fitting errors (bias error and variance error)
are used in tuning, not performance evaluation. The techniques used in perfor-
mance evaluation, which measure the goodness of fit for validation of the model,
include (1) error analysis, (2) receiver operating characteristic (ROC) plots, and
(3) root mean squared error (RMSE) calculations.
B and C are incorrect because Remark 2 is incorrect. Model fitting errors (bias
error and variance error) are used in tuning, not performance evaluation. The
techniques used in performance evaluation, which measure the goodness of fit
for validation of the model, include (1) error analysis, (2) receiver operating char-
acteristic plots, and (3) root mean squared error calculations.
© CFA Institute. For candidate use only. Not for distribution.
LEARNING MODULE
8
Appendices A-E
APPENDICES A-E
1
Appendix A Cumulative Probabilities for a Standard Normal Distribution
Appendix B Table of the Student’s t-Distribution (One-Tailed Probabilities)
Appendix C Values of X2 (Degrees of Freedom, Level of Significance)
Appendix D Table of the F-Distribution
Appendix E Critical Values for the Durbin-Watson Statistic (α = .05)
© CFA Institute. For candidate use only. Not for distribution.
364 Learning Module 8 Appendices A-E
Appendix A
Cumulative Probabilities for a Standard Normal Distribution
P(Z ≤ x) = N(x) for x ≥ 0 or P(Z ≤ z) = N(z) for z ≥ 0
x or z 0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09
0.00 0.5000 0.5040 0.5080 0.5120 0.5160 0.5199 0.5239 0.5279 0.5319 0.5359
0.10 0.5398 0.5438 0.5478 0.5517 0.5557 0.5596 0.5636 0.5675 0.5714 0.5753
0.20 0.5793 0.5832 0.5871 0.5910 0.5948 0.5987 0.6026 0.6064 0.6103 0.6141
0.30 0.6179 0.6217 0.6255 0.6293 0.6331 0.6368 0.6406 0.6443 0.6480 0.6517
0.40 0.6554 0.6591 0.6628 0.6664 0.6700 0.6736 0.6772 0.6808 0.6844 0.6879
0.50 0.6915 0.6950 0.6985 0.7019 0.7054 0.7088 0.7123 0.7157 0.7190 0.7224
0.60 0.7257 0.7291 0.7324 0.7357 0.7389 0.7422 0.7454 0.7486 0.7517 0.7549
0.70 0.7580 0.7611 0.7642 0.7673 0.7704 0.7734 0.7764 0.7794 0.7823 0.7852
0.80 0.7881 0.7910 0.7939 0.7967 0.7995 0.8023 0.8051 0.8078 0.8106 0.8133
0.90 0.8159 0.8186 0.8212 0.8238 0.8264 0.8289 0.8315 0.8340 0.8365 0.8389
1.00 0.8413 0.8438 0.8461 0.8485 0.8508 0.8531 0.8554 0.8577 0.8599 0.8621
1.10 0.8643 0.8665 0.8686 0.8708 0.8729 0.8749 0.8770 0.8790 0.8810 0.8830
1.20 0.8849 0.8869 0.8888 0.8907 0.8925 0.8944 0.8962 0.8980 0.8997 0.9015
1.30 0.9032 0.9049 0.9066 0.9082 0.9099 0.9115 0.9131 0.9147 0.9162 0.9177
1.40 0.9192 0.9207 0.9222 0.9236 0.9251 0.9265 0.9279 0.9292 0.9306 0.9319
1.50 0.9332 0.9345 0.9357 0.9370 0.9382 0.9394 0.9406 0.9418 0.9429 0.9441
1.60 0.9452 0.9463 0.9474 0.9484 0.9495 0.9505 0.9515 0.9525 0.9535 0.9545
1.70 0.9554 0.9564 0.9573 0.9582 0.9591 0.9599 0.9608 0.9616 0.9625 0.9633
1.80 0.9641 0.9649 0.9656 0.9664 0.9671 0.9678 0.9686 0.9693 0.9699 0.9706
1.90 0.9713 0.9719 0.9726 0.9732 0.9738 0.9744 0.9750 0.9756 0.9761 0.9767
2.00 0.9772 0.9778 0.9783 0.9788 0.9793 0.9798 0.9803 0.9808 0.9812 0.9817
2.10 0.9821 0.9826 0.9830 0.9834 0.9838 0.9842 0.9846 0.9850 0.9854 0.9857
2.20 0.9861 0.9864 0.9868 0.9871 0.9875 0.9878 0.9881 0.9884 0.9887 0.9890
2.30 0.9893 0.9896 0.9898 0.9901 0.9904 0.9906 0.9909 0.9911 0.9913 0.9916
2.40 0.9918 0.9920 0.9922 0.9925 0.9927 0.9929 0.9931 0.9932 0.9934 0.9936
2.50 0.9938 0.9940 0.9941 0.9943 0.9945 0.9946 0.9948 0.9949 0.9951 0.9952
2.60 0.9953 0.9955 0.9956 0.9957 0.9959 0.9960 0.9961 0.9962 0.9963 0.9964
2.70 0.9965 0.9966 0.9967 0.9968 0.9969 0.9970 0.9971 0.9972 0.9973 0.9974
2.80 0.9974 0.9975 0.9976 0.9977 0.9977 0.9978 0.9979 0.9979 0.9980 0.9981
2.90 0.9981 0.9982 0.9982 0.9983 0.9984 0.9984 0.9985 0.9985 0.9986 0.9986
3.00 0.9987 0.9987 0.9987 0.9988 0.9988 0.9989 0.9989 0.9989 0.9990 0.9990
3.10 0.9990 0.9991 0.9991 0.9991 0.9992 0.9992 0.9992 0.9992 0.9993 0.9993
3.20 0.9993 0.9993 0.9994 0.9994 0.9994 0.9994 0.9994 0.9995 0.9995 0.9995
3.30 0.9995 0.9995 0.9995 0.9996 0.9996 0.9996 0.9996 0.9996 0.9996 0.9997
3.40 0.9997 0.9997 0.9997 0.9997 0.9997 0.9997 0.9997 0.9997 0.9997 0.9998
3.50 0.9998 0.9998 0.9998 0.9998 0.9998 0.9998 0.9998 0.9998 0.9998 0.9998
3.60 0.9998 0.9998 0.9999 0.9999 0.9999 0.9999 0.9999 0.9999 0.9999 0.9999
3.70 0.9999 0.9999 0.9999 0.9999 0.9999 0.9999 0.9999 0.9999 0.9999 0.9999
3.80 0.9999 0.9999 0.9999 0.9999 0.9999 0.9999 0.9999 0.9999 0.9999 0.9999
3.90 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
4.00 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
For example, to find the z-value leaving 2.5 percent of the area/probability in the upper tail, find the element 0.9750 in the body of the table. Read
1.90 at the left end of the element’s row and 0.06 at the top of the element’s column, to give 1.90 + 0.06 = 1.96. Table generated with Excel.
Quantitative Methods for Investment Analysis, Second Edition, by Richard A. DeFusco, CFA, Dennis W. McLeavey, CFA, Jerald E. Pinto, CFA, and
David E. Runkle, CFA. Copyright © 2004 by CFA Institute.
© CFA Institute. For candidate use only. Not for distribution.
Appendices A-E 365
Appendix A (continued)
Cumulative Probabilities for a Standard Normal Distribution
P(Z ≤ x) = N(x) for x ≤ 0 or P(Z ≤ z) = N(z) for z ≤ 0
x or z 0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09
0.0 0.5000 0.4960 0.4920 0.4880 0.4840 0.4801 0.4761 0.4721 0.4681 0.4641
−0.10 0.4602 0.4562 0.4522 0.4483 0.4443 0.4404 0.4364 0.4325 0.4286 0.4247
−0.20 0.4207 0.4168 0.4129 0.4090 0.4052 0.4013 0.3974 0.3936 0.3897 0.3859
−0.30 0.3821 0.3783 0.3745 0.3707 0.3669 0.3632 0.3594 0.3557 0.3520 0.3483
−0.40 0.3446 0.3409 0.3372 0.3336 0.3300 0.3264 0.3228 0.3192 0.3156 0.3121
−0.50 0.3085 0.3050 0.3015 0.2981 0.2946 0.2912 0.2877 0.2843 0.2810 0.2776
−0.60 0.2743 0.2709 0.2676 0.2643 0.2611 0.2578 0.2546 0.2514 0.2483 0.2451
−0.70 0.2420 0.2389 0.2358 0.2327 0.2296 0.2266 0.2236 0.2206 0.2177 0.2148
−0.80 0.2119 0.2090 0.2061 0.2033 0.2005 0.1977 0.1949 0.1922 0.1894 0.1867
−0.90 0.1841 0.1814 0.1788 0.1762 0.1736 0.1711 0.1685 0.1660 0.1635 0.1611
−1.00 0.1587 0.1562 0.1539 0.1515 0.1492 0.1469 0.1446 0.1423 0.1401 0.1379
−1.10 0.1357 0.1335 0.1314 0.1292 0.1271 0.1251 0.1230 0.1210 0.1190 0.1170
−1.20 0.1151 0.1131 0.1112 0.1093 0.1075 0.1056 0.1038 0.1020 0.1003 0.0985
−1.30 0.0968 0.0951 0.0934 0.0918 0.0901 0.0885 0.0869 0.0853 0.0838 0.0823
−1.40 0.0808 0.0793 0.0778 0.0764 0.0749 0.0735 0.0721 0.0708 0.0694 0.0681
−1.50 0.0668 0.0655 0.0643 0.0630 0.0618 0.0606 0.0594 0.0582 0.0571 0.0559
−1.60 0.0548 0.0537 0.0526 0.0516 0.0505 0.0495 0.0485 0.0475 0.0465 0.0455
−1.70 0.0446 0.0436 0.0427 0.0418 0.0409 0.0401 0.0392 0.0384 0.0375 0.0367
−1.80 0.0359 0.0351 0.0344 0.0336 0.0329 0.0322 0.0314 0.0307 0.0301 0.0294
−1.90 0.0287 0.0281 0.0274 0.0268 0.0262 0.0256 0.0250 0.0244 0.0239 0.0233
−2.00 0.0228 0.0222 0.0217 0.0212 0.0207 0.0202 0.0197 0.0192 0.0188 0.0183
−2.10 0.0179 0.0174 0.0170 0.0166 0.0162 0.0158 0.0154 0.0150 0.0146 0.0143
−2.20 0.0139 0.0136 0.0132 0.0129 0.0125 0.0122 0.0119 0.0116 0.0113 0.0110
−2.30 0.0107 0.0104 0.0102 0.0099 0.0096 0.0094 0.0091 0.0089 0.0087 0.0084
−2.40 0.0082 0.0080 0.0078 0.0075 0.0073 0.0071 0.0069 0.0068 0.0066 0.0064
−2.50 0.0062 0.0060 0.0059 0.0057 0.0055 0.0054 0.0052 0.0051 0.0049 0.0048
−2.60 0.0047 0.0045 0.0044 0.0043 0.0041 0.0040 0.0039 0.0038 0.0037 0.0036
−2.70 0.0035 0.0034 0.0033 0.0032 0.0031 0.0030 0.0029 0.0028 0.0027 0.0026
−2.80 0.0026 0.0025 0.0024 0.0023 0.0023 0.0022 0.0021 0.0021 0.0020 0.0019
−2.90 0.0019 0.0018 0.0018 0.0017 0.0016 0.0016 0.0015 0.0015 0.0014 0.0014
−3.00 0.0013 0.0013 0.0013 0.0012 0.0012 0.0011 0.0011 0.0011 0.0010 0.0010
−3.10 0.0010 0.0009 0.0009 0.0009 0.0008 0.0008 0.0008 0.0008 0.0007 0.0007
−3.20 0.0007 0.0007 0.0006 0.0006 0.0006 0.0006 0.0006 0.0005 0.0005 0.0005
−3.30 0.0005 0.0005 0.0005 0.0004 0.0004 0.0004 0.0004 0.0004 0.0004 0.0003
−3.40 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0002
−3.50 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002
−3.60 0.0002 0.0002 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001
−3.70 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001
−3.80 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001
−3.90 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
−4.00 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
For example, to find the z-value leaving 2.5 percent of the area/probability in the lower tail, find the element 0.0250 in the body of the table. Read
–1.90 at the left end of the element’s row and 0.06 at the top of the element’s column, to give –1.90 – 0.06 = –1.96. Table generated with Excel.
366
df p = 0.10 p = 0.05 p = 0.025 p = 0.01 p = 0.005 df p = 0.10 p = 0.05 p = 0.025 p = 0.01 p = 0.005
Appendix B
1 3.078 6.314 12.706 31.821 63.657 31 1.309 1.696 2.040 2.453 2.744
2 1.886 2.920 4.303 6.965 9.925 32 1.309 1.694 2.037 2.449 2.738
3 1.638 2.353 3.182 4.541 5.841 33 1.308 1.692 2.035 2.445 2.733
4 1.533 2.132 2.776 3.747 4.604 34 1.307 1.691 2.032 2.441 2.728
5 1.476 2.015 2.571 3.365 4.032 35 1.306 1.690 2.030 2.438 2.724
Learning Module 8
6 1.440 1.943 2.447 3.143 3.707 36 1.306 1.688 2.028 2.434 2.719
7 1.415 1.895 2.365 2.998 3.499 37 1.305 1.687 2.026 2.431 2.715
8 1.397 1.860 2.306 2.896 3.355 38 1.304 1.686 2.024 2.429 2.712
9 1.383 1.833 2.262 2.821 3.250 39 1.304 1.685 2.023 2.426 2.708
10 1.372 1.812 2.228 2.764 3.169 40 1.303 1.684 2.021 2.423 2.704
11 1.363 1.796 2.201 2.718 3.106 41 1.303 1.683 2.020 2.421 2.701
12 1.356 1.782 2.179 2.681 3.055 42 1.302 1.682 2.018 2.418 2.698
13 1.350 1.771 2.160 2.650 3.012 43 1.302 1.681 2.017 2.416 2.695
14 1.345 1.761 2.145 2.624 2.977 44 1.301 1.680 2.015 2.414 2.692
15 1.341 1.753 2.131 2.602 2.947 45 1.301 1.679 2.014 2.412 2.690
16 1.337 1.746 2.120 2.583 2.921 46 1.300 1.679 2.013 2.410 2.687
17 1.333 1.740 2.110 2.567 2.898 47 1.300 1.678 2.012 2.408 2.685
18 1.330 1.734 2.101 2.552 2.878 48 1.299 1.677 2.011 2.407 2.682
19 1.328 1.729 2.093 2.539 2.861 49 1.299 1.677 2.010 2.405 2.680
Table of the Student’s t-Distribution (One-Tailed Probabilities)
20 1.325 1.725 2.086 2.528 2.845 50 1.299 1.676 2.009 2.403 2.678
21 1.323 1.721 2.080 2.518 2.831 60 1.296 1.671 2.000 2.390 2.660
22 1.321 1.717 2.074 2.508 2.819 70 1.294 1.667 1.994 2.381 2.648
23 1.319 1.714 2.069 2.500 2.807 80 1.292 1.664 1.990 2.374 2.639
24 1.318 1.711 2.064 2.492 2.797 90 1.291 1.662 1.987 2.368 2.632
25 1.316 1.708 2.060 2.485 2.787 100 1.290 1.660 1.984 2.364 2.626
26 1.315 1.706 2.056 2.479 2.779 110 1.289 1.659 1.982 2.361 2.621
27 1.314 1.703 2.052 2.473 2.771 120 1.289 1.658 1.980 2.358 2.617
28 1.313 1.701 2.048 2.467 2.763 200 1.286 1.653 1.972 2.345 2.601
29 1.311 1.699 2.045 2.462 2.756 ∞ 1.282 1.645 1.960 2.326 2.576
© CFA Institute. For candidate use only. Not for distribution.
To find a critical t-value, enter the table with df and a specified value for a, the significance level. For example, with 5 df, α = 0.05 and a one-tailed test, the desired probability in the tail would be
p = 0.05 and the critical t-value would be t(5, 0.05) = 2.015. With α =0.05 and a two-tailed test, the desired probability in each tail would be p = 0.025 =α/2, giving t(0.025) = 2.571. Table generated
using Excel.
Quantitative Methods for Investment Analysis, Second Edition, by Richard A. DeFusco, CFA, Dennis W. McLeavey, CFA, Jerald E. Pinto, CFA, and David E. Runkle, CFA. Copyright © 2004 by
CFA Institute.
Appendices A-E
© CFA Institute. For candidate use only. Not for distribution.
Appendices A-E 367
Appendix C
Values of χ2 (Degrees of Freedom, Level of Significance)
To have a probability of 0.05 in the right tail when df = 5, the tabled value is χ (5, 0.05) = 11.070.
2
Quantitative Methods for Investment Analysis, Second Edition, by Richard A. DeFusco, CFA, Dennis W. McLeavey, CFA, Jerald E. Pinto,
CFA, and David E. Runkle, CFA. Copyright © 2004 by CFA Institute.
368
df2: 1 161 200 216 225 230 234 237 239 241 242 243 244 246 248 248 249 249 249 249 250 251 252 253 254
2 18.5 19.0 19.2 19.2 19.3 19.3 19.4 19.4 19.4 19.4 19.4 19.4 19.4 19.4 19.4 19.5 19.5 19.5 19.5 19.5 19.5 19.5 19.5 19.5
3 10.1 9.55 9.28 9.12 9.01 8.94 8.89 8.85 8.81 8.79 8.76 8.74 8.70 8.66 8.65 8.65 8.64 8.64 8.63 8.62 8.59 8.57 8.55 8.53
Learning Module 8
4 7.71 6.94 6.59 6.39 6.26 6.16 6.09 6.04 6.00 5.96 5.94 5.91 5.86 5.80 5.79 5.79 5.78 5.77 5.77 5.75 5.72 5.69 5.66 5.63
Table of the F-Distribution
5 6.61 5.79 5.41 5.19 5.05 4.95 4.88 4.82 4.77 4.74 4.70 4.68 4.62 4.56 4.55 4.54 4.53 4.53 4.52 4.50 4.46 4.43 4.40 4.37
6 5.99 5.14 4.76 4.53 4.39 4.28 4.21 4.15 4.10 4.06 4.03 4.00 3.94 3.87 3.86 3.86 3.85 3.84 3.83 3.81 3.77 3.74 3.70 3.67
7 5.59 4.74 4.35 4.12 3.97 3.87 3.79 3.73 3.68 3.64 3.60 3.57 3.51 3.44 3.43 3.43 3.42 3.41 3.40 3.38 3.34 3.30 3.27 3.23
8 5.32 4.46 4.07 3.84 3.69 3.58 3.50 3.44 3.39 3.35 3.31 3.28 3.22 3.15 3.14 3.13 3.12 3.12 3.11 3.08 3.04 3.01 2.97 2.93
9 5.12 4.26 3.86 3.63 3.48 3.37 3.29 3.23 3.18 3.14 3.10 3.07 3.01 2.94 2.93 2.92 2.91 2.90 2.89 2.86 2.83 2.79 2.75 2.71
10 4.96 4.10 3.71 3.48 3.33 3.22 3.14 3.07 3.02 2.98 2.94 2.91 2.85 2.77 2.76 2.75 2.75 2.74 2.73 2.70 2.66 2.62 2.58 2.54
11 4.84 3.98 3.59 3.36 3.20 3.09 3.01 2.95 2.90 2.85 2.82 2.79 2.72 2.65 2.64 2.63 2.62 2.61 2.60 2.57 2.53 2.49 2.45 2.40
12 4.75 3.89 3.49 3.26 3.11 3.00 2.91 2.85 2.80 2.75 2.72 2.69 2.62 2.54 2.53 2.52 2.51 2.51 2.50 2.47 2.43 2.38 2.34 2.30
13 4.67 3.81 3.41 3.18 3.03 2.92 2.83 2.77 2.71 2.67 2.63 2.60 2.53 2.46 2.45 2.44 2.43 2.42 2.41 2.38 2.34 2.30 2.25 2.21
14 4.60 3.74 3.34 3.11 2.96 2.85 2.76 2.70 2.65 2.60 2.57 2.53 2.46 2.39 2.38 2.37 2.36 2.35 2.34 2.31 2.27 2.22 2.18 2.13
15 4.54 3.68 3.29 3.06 2.90 2.79 2.71 2.64 2.59 2.54 2.51 2.48 2.40 2.33 2.32 2.31 2.30 2.29 2.28 2.25 2.20 2.16 2.11 2.07
16 4.49 3.63 3.24 3.01 2.85 2.74 2.66 2.59 2.54 2.49 2.46 2.42 2.35 2.28 2.26 2.25 2.24 2.24 2.23 2.19 2.15 2.11 2.06 2.01
17 4.45 3.59 3.20 2.96 2.81 2.70 2.61 2.55 2.49 2.45 2.41 2.38 2.31 2.23 2.22 2.21 2.20 2.19 2.18 2.15 2.10 2.06 2.01 1.96
18 4.41 3.55 3.16 2.93 2.77 2.66 2.58 2.51 2.46 2.41 2.37 2.34 2.27 2.19 2.18 2.17 2.16 2.15 2.14 2.11 2.06 2.02 1.97 1.92
19 4.38 3.52 3.13 2.90 2.74 2.63 2.54 2.48 2.42 2.38 2.34 2.31 2.23 2.16 2.14 2.13 2.12 2.11 2.11 2.07 2.03 1.98 1.93 1.88
20 4.35 3.49 3.10 2.87 2.71 2.60 2.51 2.45 2.39 2.35 2.31 2.28 2.20 2.12 2.11 2.10 2.09 2.08 2.07 2.04 1.99 1.95 1.90 1.84
21 4.32 3.47 3.07 2.84 2.68 2.57 2.49 2.42 2.37 2.32 2.28 2.25 2.18 2.10 2.08 2.07 2.06 2.05 2.05 2.01 1.96 1.92 1.87 1.81
22 4.30 3.44 3.05 2.82 2.66 2.55 2.46 2.40 2.34 2.30 2.26 2.23 2.15 2.07 2.06 2.05 2.04 2.03 2.02 1.98 1.94 1.89 1.84 1.78
23 4.28 3.42 3.03 2.80 2.64 2.53 2.44 2.37 2.32 2.27 2.24 2.20 2.13 2.05 2.04 2.02 2.01 2.01 2.00 1.96 1.91 1.86 1.81 1.76
24 4.26 3.40 3.01 2.78 2.62 2.51 2.42 2.36 2.30 2.25 2.22 2.18 2.11 2.03 2.01 2.00 1.99 1.98 1.97 1.94 1.89 1.84 1.79 1.73
25 4.24 3.39 2.99 2.76 2.60 2.49 2.40 2.34 2.28 2.24 2.20 2.16 2.09 2.01 2.00 1.98 1.97 1.96 1.96 1.92 1.87 1.82 1.77 1.71
30 4.17 3.32 2.92 2.69 2.53 2.42 2.33 2.27 2.21 2.16 2.13 2.09 2.01 1.93 1.92 1.91 1.90 1.89 1.88 1.84 1.79 1.74 1.68 1.62
© CFA Institute. For candidate use only. Not for distribution.
40 4.08 3.23 2.84 2.61 2.45 2.34 2.25 2.18 2.12 2.08 2.04 2.00 1.92 1.84 1.83 1.81 1.80 1.79 1.78 1.74 1.69 1.64 1.58 1.51
60 4.00 3.15 2.76 2.53 2.37 2.25 2.17 2.10 2.04 1.99 1.95 1.92 1.84 1.75 1.73 1.72 1.71 1.70 1.69 1.65 1.59 1.53 1.47 1.39
120 3.92 3.07 2.68 2.45 2.29 2.18 2.09 2.02 1.96 1.91 1.87 1.83 1.75 1.66 1.64 1.63 1.62 1.61 1.60 1.55 1.50 1.43 1.35 1.25
Infinity 3.84 3.00 2.60 2.37 2.21 2.10 2.01 1.94 1.88 1.83 1.79 1.75 1.67 1.57 1.56 1.54 1.53 1.52 1.51 1.46 1.39 1.32 1.22 1.00
Appendices A-E
Appendices A-E
Panel B. Critical values for right-hand tail area equal to 0.025 Numerator: df1 and Denominator: df2
df1: 1 2 3 4 5 6 7 8 9 10 11 12 15 20 21 22 23 24 25 30 40 60 120 ∞
df2: 1 648 799 864 900 922 937 948 957 963 969 973 977 985 993 994 995 996 997 998 1001 1006 1010 1014 1018
2 38.51 39.00 39.17 39.25 39.30 39.33 39.36 39.37 39.39 39.40 39.41 39.41 39.43 39.45 39.45 39.45 39.45 39.46 39.46 39.46 39.47 39.48 39.49 39.50
Appendix D (continued)
3 17.44 16.04 15.44 15.10 14.88 14.73 14.62 14.54 14.47 14.42 14.37 14.34 14.25 14.17 14.16 14.14 14.13 14.12 14.12 14.08 14.04 13.99 13.95 13.90
Table of the F-Distribution
4 12.22 10.65 9.98 9.60 9.36 9.20 9.07 8.98 8.90 8.84 8.79 8.75 8.66 8.56 8.55 8.53 8.52 8.51 8.50 8.46 8.41 8.36 8.31 8.26
5 10.01 8.43 7.76 7.39 7.15 6.98 6.85 6.76 6.68 6.62 6.57 6.52 6.43 6.33 6.31 6.30 6.29 6.28 6.27 6.23 6.18 6.12 6.07 6.02
6 8.81 7.26 6.60 6.23 5.99 5.82 5.70 5.60 5.52 5.46 5.41 5.37 5.27 5.17 5.15 5.14 5.13 5.12 5.11 5.07 5.01 4.96 4.90 4.85
7 8.07 6.54 5.89 5.52 5.29 5.12 4.99 4.90 4.82 4.76 4.71 4.67 4.57 4.47 4.45 4.44 4.43 4.41 4.40 4.36 4.31 4.25 4.20 4.14
8 7.57 6.06 5.42 5.05 4.82 4.65 4.53 4.43 4.36 4.30 4.24 4.20 4.10 4.00 3.98 3.97 3.96 3.95 3.94 3.89 3.84 3.78 3.73 3.67
9 7.21 5.71 5.08 4.72 4.48 4.32 4.20 4.10 4.03 3.96 3.91 3.87 3.77 3.67 3.65 3.64 3.63 3.61 3.60 3.56 3.51 3.45 3.39 3.33
10 6.94 5.46 4.83 4.47 4.24 4.07 3.95 3.85 3.78 3.72 3.66 3.62 3.52 3.42 3.40 3.39 3.38 3.37 3.35 3.31 3.26 3.20 3.14 3.08
11 6.72 5.26 4.63 4.28 4.04 3.88 3.76 3.66 3.59 3.53 3.47 3.43 3.33 3.23 3.21 3.20 3.18 3.17 3.16 3.12 3.06 3.00 2.94 2.88
12 6.55 5.10 4.47 4.12 3.89 3.73 3.61 3.51 3.44 3.37 3.32 3.28 3.18 3.07 3.06 3.04 3.03 3.02 3.01 2.96 2.91 2.85 2.79 2.72
13 6.41 4.97 4.35 4.00 3.77 3.60 3.48 3.39 3.31 3.25 3.20 3.15 3.05 2.95 2.93 2.92 2.91 2.89 2.88 2.84 2.78 2.72 2.66 2.60
14 6.30 4.86 4.24 3.89 3.66 3.50 3.38 3.29 3.21 3.15 3.09 3.05 2.95 2.84 2.83 2.81 2.80 2.79 2.78 2.73 2.67 2.61 2.55 2.49
15 6.20 4.77 4.15 3.80 3.58 3.41 3.29 3.20 3.12 3.06 3.01 2.96 2.86 2.76 2.74 2.73 2.71 2.70 2.69 2.64 2.59 2.52 2.46 2.40
16 6.12 4.69 4.08 3.73 3.50 3.34 3.22 3.12 3.05 2.99 2.93 2.89 2.79 2.68 2.67 2.65 2.64 2.63 2.61 2.57 2.51 2.45 2.38 2.32
17 6.04 4.62 4.01 3.66 3.44 3.28 3.16 3.06 2.98 2.92 2.87 2.82 2.72 2.62 2.60 2.59 2.57 2.56 2.55 2.50 2.44 2.38 2.32 2.25
18 5.98 4.56 3.95 3.61 3.38 3.22 3.10 3.01 2.93 2.87 2.81 2.77 2.67 2.56 2.54 2.53 2.52 2.50 2.49 2.44 2.38 2.32 2.26 2.19
19 5.92 4.51 3.90 3.56 3.33 3.17 3.05 2.96 2.88 2.82 2.76 2.72 2.62 2.51 2.49 2.48 2.46 2.45 2.44 2.39 2.33 2.27 2.20 2.13
20 5.87 4.46 3.86 3.51 3.29 3.13 3.01 2.91 2.84 2.77 2.72 2.68 2.57 2.46 2.45 2.43 2.42 2.41 2.40 2.35 2.29 2.22 2.16 2.09
21 5.83 4.42 3.82 3.48 3.25 3.09 2.97 2.87 2.80 2.73 2.68 2.64 2.53 2.42 2.41 2.39 2.38 2.37 2.36 2.31 2.25 2.18 2.11 2.04
22 5.79 4.38 3.78 3.44 3.22 3.05 2.93 2.84 2.76 2.70 2.65 2.60 2.50 2.39 2.37 2.36 2.34 2.33 2.32 2.27 2.21 2.14 2.08 2.00
23 5.75 4.35 3.75 3.41 3.18 3.02 2.90 2.81 2.73 2.67 2.62 2.57 2.47 2.36 2.34 2.33 2.31 2.30 2.29 2.24 2.18 2.11 2.04 1.97
© CFA Institute. For candidate use only. Not for distribution.
24 5.72 4.32 3.72 3.38 3.15 2.99 2.87 2.78 2.70 2.64 2.59 2.54 2.44 2.33 2.31 2.30 2.28 2.27 2.26 2.21 2.15 2.08 2.01 1.94
25 5.69 4.29 3.69 3.35 3.13 2.97 2.85 2.75 2.68 2.61 2.56 2.51 2.41 2.30 2.28 2.27 2.26 2.24 2.23 2.18 2.12 2.05 1.98 1.91
30 5.57 4.18 3.59 3.25 3.03 2.87 2.75 2.65 2.57 2.51 2.46 2.41 2.31 2.20 2.18 2.16 2.15 2.14 2.12 2.07 2.01 1.94 1.87 1.79
40 5.42 4.05 3.46 3.13 2.90 2.74 2.62 2.53 2.45 2.39 2.33 2.29 2.18 2.07 2.05 2.03 2.02 2.01 1.99 1.94 1.88 1.80 1.72 1.64
60 5.29 3.93 3.34 3.01 2.79 2.63 2.51 2.41 2.33 2.27 2.22 2.17 2.06 1.94 1.93 1.91 1.90 1.88 1.87 1.82 1.74 1.67 1.58 1.48
120 5.15 3.80 3.23 2.89 2.67 2.52 2.39 2.30 2.22 2.16 2.10 2.05 1.94 1.82 1.81 1.79 1.77 1.76 1.75 1.69 1.61 1.53 1.43 1.31
Infinity 5.02 3.69 3.12 2.79 2.57 2.41 2.29 2.19 2.11 2.05 1.99 1.94 1.83 1.71 1.69 1.67 1.66 1.64 1.63 1.57 1.48 1.39 1.27 1.00
369
370
Panel C. Critical values for right-hand tail area equal to 0.01 Numerator: df1 and Denominator: df2
df1: 1 2 3 4 5 6 7 8 9 10 11 12 15 20 21 22 23 24 25 30 40 60 120 ∞
df2: 1 4052 5000 5403 5625 5764 5859 5928 5982 6023 6056 6083 6106 6157 6209 6216 6223 6229 6235 6240 6261 6287 6313 6339 6366
2 98.5 99.0 99.2 99.2 99.3 99.3 99.4 99.4 99.4 99.4 99.4 99.4 99.4 99.4 99.5 99.5 99.5 99.5 99.5 99.5 99.5 99.5 99.5 99.5
Appendix D (continued)
Learning Module 8
3 34.1 30.8 29.5 28.7 28.2 27.9 27.7 27.5 27.3 27.2 27.1 27.1 26.9 26.7 26.7 26.6 26.6 26.6 26.6 26.5 26.4 26.3 26.2 26.1
Table of the F-Distribution
4 21.2 18.0 16.7 16.0 15.5 15.2 15.0 14.8 14.7 14.5 14.5 14.4 14.2 14.0 14.0 14.0 13.9 13.9 13.9 13.8 13.7 13.7 13.6 13.5
5 16.3 13.3 12.1 11.4 11.0 10.7 10.5 10.3 10.2 10.1 10.0 9.89 9.72 9.55 9.53 9.51 9.49 9.47 9.45 9.38 9.29 9.20 9.11 9.02
6 13.7 10.9 9.78 9.15 8.75 8.47 8.26 8.10 7.98 7.87 7.79 7.72 7.56 7.40 7.37 7.35 7.33 7.31 7.30 7.23 7.14 7.06 6.97 6.88
7 12.2 9.55 8.45 7.85 7.46 7.19 6.99 6.84 6.72 6.62 6.54 6.47 6.31 6.16 6.13 6.11 6.09 6.07 6.06 5.99 5.91 5.82 5.74 5.65
8 11.3 8.65 7.59 7.01 6.63 6.37 6.18 6.03 5.91 5.81 5.73 5.67 5.52 5.36 5.34 5.32 5.30 5.28 5.26 5.20 5.12 5.03 4.95 4.86
9 10.6 8.02 6.99 6.42 6.06 5.80 5.61 5.47 5.35 5.26 5.18 5.11 4.96 4.81 4.79 4.77 4.75 4.73 4.71 4.65 4.57 4.48 4.40 4.31
10 10.0 7.56 6.55 5.99 5.64 5.39 5.20 5.06 4.94 4.85 4.77 4.71 4.56 4.41 4.38 4.36 4.34 4.33 4.31 4.25 4.17 4.08 4.00 3.91
11 9.65 7.21 6.22 5.67 5.32 5.07 4.89 4.74 4.63 4.54 4.46 4.40 4.25 4.10 4.08 4.06 4.04 4.02 4.01 3.94 3.86 3.78 3.69 3.60
12 9.33 6.93 5.95 5.41 5.06 4.82 4.64 4.50 4.39 4.30 4.22 4.16 4.01 3.86 3.84 3.82 3.80 3.78 3.76 3.70 3.62 3.54 3.45 3.36
13 9.07 6.70 5.74 5.21 4.86 4.62 4.44 4.30 4.19 4.10 4.02 3.96 3.82 3.66 3.64 3.62 3.60 3.59 3.57 3.51 3.43 3.34 3.25 3.17
14 8.86 6.51 5.56 5.04 4.70 4.46 4.28 4.14 4.03 3.94 3.86 3.80 3.66 3.51 3.48 3.46 3.44 3.43 3.41 3.35 3.27 3.18 3.09 3.00
15 8.68 6.36 5.42 4.89 4.56 4.32 4.14 4.00 3.89 3.80 3.73 3.67 3.52 3.37 3.35 3.33 3.31 3.29 3.28 3.21 3.13 3.05 2.96 2.87
16 8.53 6.23 5.29 4.77 4.44 4.20 4.03 3.89 3.78 3.69 3.62 3.55 3.41 3.26 3.24 3.22 3.20 3.18 3.16 3.10 3.02 2.93 2.84 2.75
17 8.40 6.11 5.19 4.67 4.34 4.10 3.93 3.79 3.68 3.59 3.52 3.46 3.31 3.16 3.14 3.12 3.10 3.08 3.07 3.00 2.92 2.83 2.75 2.65
18 8.29 6.01 5.09 4.58 4.25 4.01 3.84 3.71 3.60 3.51 3.43 3.37 3.23 3.08 3.05 3.03 3.02 3.00 2.98 2.92 2.84 2.75 2.66 2.57
19 8.19 5.93 5.01 4.50 4.17 3.94 3.77 3.63 3.52 3.43 3.36 3.30 3.15 3.00 2.98 2.96 2.94 2.92 2.91 2.84 2.76 2.67 2.58 2.49
20 8.10 5.85 4.94 4.43 4.10 3.87 3.70 3.56 3.46 3.37 3.29 3.23 3.09 2.94 2.92 2.90 2.88 2.86 2.84 2.78 2.69 2.61 2.52 2.42
21 8.02 5.78 4.87 4.37 4.04 3.81 3.64 3.51 3.40 3.31 3.24 3.17 3.03 2.88 2.86 2.84 2.82 2.80 2.79 2.72 2.64 2.55 2.46 2.36
22 7.95 5.72 4.82 4.31 3.99 3.76 3.59 3.45 3.35 3.26 3.18 3.12 2.98 2.83 2.81 2.78 2.77 2.75 2.73 2.67 2.58 2.50 2.40 2.31
23 7.88 5.66 4.76 4.26 3.94 3.71 3.54 3.41 3.30 3.21 3.14 3.07 2.93 2.78 2.76 2.74 2.72 2.70 2.69 2.62 2.54 2.45 2.35 2.26
24 7.82 5.61 4.72 4.22 3.90 3.67 3.50 3.36 3.26 3.17 3.09 3.03 2.89 2.74 2.72 2.70 2.68 2.66 2.64 2.58 2.49 2.40 2.31 2.21
25 7.77 5.57 4.68 4.18 3.86 3.63 3.46 3.32 3.22 3.13 3.06 2.99 2.85 2.70 2.68 2.66 2.64 2.62 2.60 2.53 2.45 2.36 2.27 2.17
30 7.56 5.39 4.51 4.02 3.70 3.47 3.30 3.17 3.07 2.98 2.91 2.84 2.70 2.55 2.53 2.51 2.49 2.47 2.45 2.39 2.30 2.21 2.11 2.01
40 7.31 5.18 4.31 3.83 3.51 3.29 3.12 2.99 2.89 2.80 2.73 2.66 2.52 2.37 2.35 2.33 2.31 2.29 2.27 2.20 2.11 2.02 1.92 1.80
© CFA Institute. For candidate use only. Not for distribution.
60 7.08 4.98 4.13 3.65 3.34 3.12 2.95 2.82 2.72 2.63 2.56 2.50 2.35 2.20 2.17 2.15 2.13 2.12 2.10 2.03 1.94 1.84 1.73 1.60
120 6.85 4.79 3.95 3.48 3.17 2.96 2.79 2.66 2.56 2.47 2.40 2.34 2.19 2.03 2.01 1.99 1.97 1.95 1.93 1.86 1.76 1.66 1.53 1.38
Infinity 6.63 4.61 3.78 3.32 3.02 2.80 2.64 2.51 2.41 2.32 2.25 2.18 2.04 1.88 1.85 1.83 1.81 1.79 1.77 1.70 1.59 1.47 1.32 1.00
Appendices A-E
Appendices A-E
Panel D. Critical values for right-hand tail area equal to 0.005 Numerator: df1 and Denominator: df2
df1: 1 2 3 4 5 6 7 8 9 10 11 12 15 20 21 22 23 24 25 30 40 60 120 ∞
df2: 1 16211 20000 21615 22500 23056 23437 23715 23925 24091 24222 24334 24426 24630 24836 24863 24892 24915 24940 24959 25044 25146 25253 25359 25464
2 198.5 199.0 199.2 199.2 199.3 199.3 199.4 199.4 199.4 199.4 199.4 199.4 199.4 199.4 199.4 199.4 199.4 199.4 199.4 199.5 199.5 199.5 199.5 200
3 55.55 49.80 47.47 46.20 45.39 44.84 44.43 44.13 43.88 43.68 43.52 43.39 43.08 42.78 42.73 42.69 42.66 42.62 42.59 42.47 42.31 42.15 41.99 41.83
Appendix D (continued)
4 31.33 26.28 24.26 23.15 22.46 21.98 21.62 21.35 21.14 20.97 20.82 20.70 20.44 20.17 20.13 20.09 20.06 20.03 20.00 19.89 19.75 19.61 19.47 19.32
Table of the F-Distribution
5 22.78 18.31 16.53 15.56 14.94 14.51 14.20 13.96 13.77 13.62 13.49 13.38 13.15 12.90 12.87 12.84 12.81 12.78 12.76 12.66 12.53 12.40 12.27 12.14
6 18.63 14.54 12.92 12.03 11.46 11.07 10.79 10.57 10.39 10.25 10.13 10.03 9.81 9.59 9.56 9.53 9.50 9.47 9.45 9.36 9.24 9.12 9.00 8.88
7 16.24 12.40 10.88 10.05 9.52 9.16 8.89 8.68 8.51 8.38 8.27 8.18 7.97 7.75 7.72 7.69 7.67 7.64 7.62 7.53 7.42 7.31 7.19 7.08
8 14.69 11.04 9.60 8.81 8.30 7.95 7.69 7.50 7.34 7.21 7.10 7.01 6.81 6.61 6.58 6.55 6.53 6.50 6.48 6.40 6.29 6.18 6.06 5.95
9 13.61 10.11 8.72 7.96 7.47 7.13 6.88 6.69 6.54 6.42 6.31 6.23 6.03 5.83 5.80 5.78 5.75 5.73 5.71 5.62 5.52 5.41 5.30 5.19
10 12.83 9.43 8.08 7.34 6.87 6.54 6.30 6.12 5.97 5.85 5.75 5.66 5.47 5.27 5.25 5.22 5.20 5.17 5.15 5.07 4.97 4.86 4.75 4.64
11 12.23 8.91 7.60 6.88 6.42 6.10 5.86 5.68 5.54 5.42 5.32 5.24 5.05 4.86 4.83 4.80 4.78 4.76 4.74 4.65 4.55 4.45 4.34 4.23
12 11.75 8.51 7.23 6.52 6.07 5.76 5.52 5.35 5.20 5.09 4.99 4.91 4.72 4.53 4.50 4.48 4.45 4.43 4.41 4.33 4.23 4.12 4.01 3.90
13 11.37 8.19 6.93 6.23 5.79 5.48 5.25 5.08 4.94 4.82 4.72 4.64 4.46 4.27 4.24 4.22 4.19 4.17 4.15 4.07 3.97 3.87 3.76 3.65
14 11.06 7.92 6.68 6.00 5.56 5.26 5.03 4.86 4.72 4.60 4.51 4.43 4.25 4.06 4.03 4.01 3.98 3.96 3.94 3.86 3.76 3.66 3.55 3.44
15 10.80 7.70 6.48 5.80 5.37 5.07 4.85 4.67 4.54 4.42 4.33 4.25 4.07 3.88 3.86 3.83 3.81 3.79 3.77 3.69 3.59 3.48 3.37 3.26
16 10.58 7.51 6.30 5.64 5.21 4.91 4.69 4.52 4.38 4.27 4.18 4.10 3.92 3.73 3.71 3.68 3.66 3.64 3.62 3.54 3.44 3.33 3.22 3.11
17 10.38 7.35 6.16 5.50 5.07 4.78 4.56 4.39 4.25 4.14 4.05 3.97 3.79 3.61 3.58 3.56 3.53 3.51 3.49 3.41 3.31 3.21 3.10 2.98
18 10.22 7.21 6.03 5.37 4.96 4.66 4.44 4.28 4.14 4.03 3.94 3.86 3.68 3.50 3.47 3.45 3.42 3.40 3.38 3.30 3.20 3.10 2.99 2.87
19 10.07 7.09 5.92 5.27 4.85 4.56 4.34 4.18 4.04 3.93 3.84 3.76 3.59 3.40 3.37 3.35 3.33 3.31 3.29 3.21 3.11 3.00 2.89 2.78
20 9.94 6.99 5.82 5.17 4.76 4.47 4.26 4.09 3.96 3.85 3.76 3.68 3.50 3.32 3.29 3.27 3.24 3.22 3.20 3.12 3.02 2.92 2.81 2.69
21 9.83 6.89 5.73 5.09 4.68 4.39 4.18 4.01 3.88 3.77 3.68 3.60 3.43 3.24 3.22 3.19 3.17 3.15 3.13 3.05 2.95 2.84 2.73 2.61
22 9.73 6.81 5.65 5.02 4.61 4.32 4.11 3.94 3.81 3.70 3.61 3.54 3.36 3.18 3.15 3.12 3.10 3.08 3.06 2.98 2.88 2.77 2.66 2.55
23 9.63 6.73 5.58 4.95 4.54 4.26 4.05 3.88 3.75 3.64 3.55 3.47 3.30 3.12 3.09 3.06 3.04 3.02 3.00 2.92 2.82 2.71 2.60 2.48
24 9.55 6.66 5.52 4.89 4.49 4.20 3.99 3.83 3.69 3.59 3.50 3.42 3.25 3.06 3.04 3.01 2.99 2.97 2.95 2.87 2.77 2.66 2.55 2.43
25 9.48 6.60 5.46 4.84 4.43 4.15 3.94 3.78 3.64 3.54 3.45 3.37 3.20 3.01 2.99 2.96 2.94 2.92 2.90 2.82 2.72 2.61 2.50 2.38
© CFA Institute. For candidate use only. Not for distribution.
30 9.18 6.35 5.24 4.62 4.23 3.95 3.74 3.58 3.45 3.34 3.25 3.18 3.01 2.82 2.80 2.77 2.75 2.73 2.71 2.63 2.52 2.42 2.30 2.18
40 8.83 6.07 4.98 4.37 3.99 3.71 3.51 3.35 3.22 3.12 3.03 2.95 2.78 2.60 2.57 2.55 2.52 2.50 2.48 2.40 2.30 2.18 2.06 1.93
60 8.49 5.79 4.73 4.14 3.76 3.49 3.29 3.13 3.01 2.90 2.82 2.74 2.57 2.39 2.36 2.33 2.31 2.29 2.27 2.19 2.08 1.96 1.83 1.69
120 8.18 5.54 4.50 3.92 3.55 3.28 3.09 2.93 2.81 2.71 2.62 2.54 2.37 2.19 2.16 2.13 2.11 2.09 2.07 1.98 1.87 1.75 1.61 1.43
Infinity 7.88 5.30 4.28 3.72 3.35 3.09 2.90 2.74 2.62 2.52 2.43 2.36 2.19 2.00 1.97 1.95 1.92 1.90 1.88 1.79 1.67 1.53 1.36 1.00
With 1 degree of freedom (df ) in the numerator and 3 df in the denominator, the critical F-value is 10.1 for a right-hand tail area equal to 0.05.
Quantitative Methods for Investment Analysis, Second Edition, by Richard A. DeFusco, CFA, Dennis W. McLeavey, CFA, Jerald E. Pinto, CFA, and David E. Runkle, CFA. Copyright © 2004 by
CFA Institute.
371
© CFA Institute. For candidate use only. Not for distribution.
372 Learning Module 8 Appendices A-E
Appendix E
Critical Values for the Durbin-Watson Statistic (α = .05)
15 1.08 1.36 0.95 1.54 0.82 1.75 0.69 1.97 0.56 2.21
16 1.10 1.37 0.98 1.54 0.86 1.73 0.74 1.93 0.62 2.15
17 1.13 1.38 1.02 1.54 0.90 1.71 0.78 1.90 0.67 2.10
18 1.16 1.39 1.05 1.53 0.93 1.69 0.82 1.87 0.71 2.06
19 1.18 1.40 1.08 1.53 0.97 1.68 0.86 1.85 0.75 2.02
20 1.20 1.41 1.10 1.54 1.00 1.68 0.90 1.83 0.79 1.99
21 1.22 1.42 1.13 1.54 1.03 1.67 0.93 1.81 0.83 1.96
22 1.24 1.43 1.15 1.54 1.05 1.66 0.96 1.80 0.86 1.94
23 1.26 1.44 1.17 1.54 1.08 1.66 0.99 1.79 0.90 1.92
24 1.27 1.45 1.19 1.55 1.10 1.66 1.01 1.78 0.93 1.90
25 1.29 1.45 1.21 1.55 1.12 1.66 1.04 1.77 0.95 1.89
26 1.30 1.46 1.22 1.55 1.14 1.65 1.06 1.76 0.98 1.88
27 1.32 1.47 1.24 1.56 1.16 1.65 1.08 1.76 1.01 1.86
28 1.33 1.48 1.26 1.56 1.18 1.65 1.10 1.75 1.03 1.85
29 1.34 1.48 1.27 1.56 1.20 1.65 1.12 1.74 1.05 1.84
30 1.35 1.49 1.28 1.57 1.21 1.65 1.14 1.74 1.07 1.83
31 1.36 1.50 1.30 1.57 1.23 1.65 1.16 1.74 1.09 1.83
32 1.37 1.50 1.31 1.57 1.24 1.65 1.18 1.73 1.11 1.82
33 1.38 1.51 1.32 1.58 1.26 1.65 1.19 1.73 1.13 1.81
34 1.39 1.51 1.33 1.58 1.27 1.65 1.21 1.73 1.15 1.81
35 1.40 1.52 1.34 1.58 1.28 1.65 1.22 1.73 1.16 1.80
36 1.41 1.52 1.35 1.59 1.29 1.65 1.24 1.73 1.18 1.80
37 1.42 1.53 1.36 1.59 1.31 1.66 1.25 1.72 1.19 1.80
38 1.43 1.54 1.37 1.59 1.32 1.66 1.26 1.72 1.21 1.79
39 1.43 1.54 1.38 1.60 1.33 1.66 1.27 1.72 1.22 1.79
40 1.44 1.54 1.39 1.60 1.34 1.66 1.29 1.72 1.23 1.79
45 1.48 1.57 1.43 1.62 1.38 1.67 1.34 1.72 1.29 1.78
50 1.50 1.59 1.46 1.63 1.42 1.67 1.38 1.72 1.34 1.77
55 1.53 1.60 1.49 1.64 1.45 1.68 1.41 1.72 1.38 1.77
60 1.55 1.62 1.51 1.65 1.48 1.69 1.44 1.73 1.41 1.77
65 1.57 1.63 1.54 1.66 1.50 1.70 1.47 1.73 1.44 1.77
70 1.58 1.64 1.55 1.67 1.52 1.70 1.49 1.74 1.46 1.77
75 1.60 1.65 1.57 1.68 1.54 1.71 1.51 1.74 1.49 1.77
80 1.61 1.66 1.59 1.69 1.56 1.72 1.53 1.74 1.51 1.77
85 1.62 1.67 1.60 1.70 1.57 1.72 1.55 1.75 1.52 1.77
90 1.63 1.68 1.61 1.70 1.59 1.73 1.57 1.75 1.54 1.78
95 1.64 1.69 1.62 1.71 1.60 1.73 1.58 1.75 1.56 1.78
100 1.65 1.69 1.63 1.72 1.61 1.74 1.59 1.76 1.57 1.78