100% found this document useful (8 votes)
371 views

Instant download Modern Business Analytics: Practical Data Science for Decision-making - eBook PDF pdf all chapter

eBook

Uploaded by

sajurloutfi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (8 votes)
371 views

Instant download Modern Business Analytics: Practical Data Science for Decision-making - eBook PDF pdf all chapter

eBook

Uploaded by

sajurloutfi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 59

Visit https://ebookluna.

com to download the full version and


explore more ebooks

Modern Business Analytics: Practical Data Science


for Decision-making - eBook PDF

_____ Click the link below to download _____


https://ebookluna.com/download/modern-business-
analytics-practical-data-science-for-decision-making-
ebook-pdf/

Explore and download more ebooks at ebookluna.com


Here are some recommended products that might interest you.
You can download now and explore!

(eBook PDF) Business Analytics Data Analysis Decision


Making 6th

https://ebookluna.com/product/ebook-pdf-business-analytics-data-
analysis-decision-making-6th/

ebookluna.com

Business Analytics: Data Analysis & Decision Making 6th


Edition (eBook PDF)

https://ebookluna.com/product/business-analytics-data-analysis-
decision-making-6th-edition-ebook-pdf/

ebookluna.com

(eBook PDF) Business Analytics: Data Analysis & Decision


Making 7th Edition

https://ebookluna.com/product/ebook-pdf-business-analytics-data-
analysis-decision-making-7th-edition/

ebookluna.com

Business Analytics: Data Analysis & Decision Making


(MindTap Course List) 7th Edition Albright - eBook PDF

https://ebookluna.com/download/business-analytics-data-analysis-
decision-making-mindtap-course-list-ebook-pdf/

ebookluna.com
(eBook PDF) Analytics, Data Science, & Artificial
Intelligence: Systems for Decision Support 11th Edition

https://ebookluna.com/product/ebook-pdf-analytics-data-science-
artificial-intelligence-systems-for-decision-support-11th-edition/

ebookluna.com

Analytics, data science, & artificial intelligence :


systems for decision support Eleventh Edition Dursun Delen
- eBook PDF
https://ebookluna.com/download/analytics-data-science-artificial-
intelligence-systems-for-decision-support-ebook-pdf/

ebookluna.com

(eBook PDF) Accounting Business Reporting for Decision


Making 6th

https://ebookluna.com/product/ebook-pdf-accounting-business-reporting-
for-decision-making-6th/

ebookluna.com

(eBook PDF) Statistics for Business Decision Making


Analysis 2nd

https://ebookluna.com/product/ebook-pdf-statistics-for-business-
decision-making-analysis-2nd/

ebookluna.com

(eBook PDF) Spreadsheet Modeling & Decision Analysis: A


Practical Introduction to Business Analytics 8th Edition

https://ebookluna.com/product/ebook-pdf-spreadsheet-modeling-decision-
analysis-a-practical-introduction-to-business-analytics-8th-edition/

ebookluna.com
ISTUDY
MODERN BUSINESS
ANALYTICS

ISTUDY
ISTUDY
MODERN BUSINESS
ANALYTICS
Practical Data Science for Decision Making

Matt Taddy
Amazon, Inc.

Leslie Hendrix
University of South Carolina

Matthew C. Harding
University of California, Irvine

ISTUDY
Final PDF to printer

MODERN BUSINESS ANALYTICS


Published by McGraw Hill LLC, 1325 Avenue of the Americas, New York, NY 10019. Copyright ©2023 by
McGraw Hill LLC. All rights reserved. Printed in the United States of America. No part of this publication may
be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without
the prior written consent of McGraw Hill LLC, including, but not limited to, in any network or other electronic
storage or transmission, or broadcast for distance learning.
Some ancillaries, including electronic and print components, may not be available to customers outside the
United States.
This book is printed on acid-free paper.
1 2 3 4 5 6 7 8 9 LKV 27 26 25 24 23 22
ISBN 978-1-266-10833-4
MHID 1-266-10833-5
Cover Image: MirageC/Getty Images

All credits appearing on page or at the end of the book are considered to be an extension of the copyright page.

The Internet addresses listed in the text were accurate at the time of publication. The inclusion of a website
does not indicate an endorsement by the authors or McGraw Hill Education, and McGraw Hill Education
does not guarantee the accuracy of the information presented at these sites.

mheducation.com/highered

ISTUDY tad08335_fm_ise.indd iv 01/28/22 07:31 PM


ABOUT THE AUTHORS

Matt Taddy is the author of Business Data Science


(McGraw Hill, 2019). From 2008–2018 he was a professor of econo-
metrics and statistics at the University of Chicago Booth School of
Business, where he developed their Data Science curriculum. Prior
to and while at Chicago Booth, he has also worked in a variety of
industry positions including as a principal researcher at Microsoft and
a research fellow at eBay. He left Chicago in 2018 to join Amazon as
Courtesy of Matt Taddy a vice president.

Leslie Hendrix is a clinical associate professor in the


Darla Moore School of Business at the University of South Carolina.
She received her PhD in statistics in 2011 and a BS in mathematics
in 2005 from the University of South Carolina. She has received two
university-wide teaching awards for her work in teaching business ana-
lytics and statistics courses and is active in the research and teaching
communities for analytics. She was instrumental in founding the Moore
Courtesy of Leslie Hendrix School’s newly formed Data Lab and currently serves as the assistant
director.

Matthew C. Harding is a professor of economics


and statistics at the University of California, Irvine. He holds a PhD
from MIT and an M.Phil. from Oxford University. Dr. Harding conducts
research on econometrics, consumer finance, health policy, and energy
economics and has published widely in leading academic journals. He
is the founder of Ecometricx, LLC, a big data and machine learning
consulting company, and cofounder of FASTlab.global Institute, a
Courtesy of Matthew nonprofit focusing on education and evidence-based policies in the
C. Harding areas of fair access and sustainable technologies.

ISTUDY
BRIEF CONTENTS

About the Authors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v


Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x
Guided Tour . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii

1 Regression. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2 Uncertainty Quantification. . . . . . . . . . . . . . . . . . . . . . . . . . . 55

3 Regularization and Selection. . . . . . . . . . . . . . . . . . . . . . . . 100

4 Classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151

5 Causal Inference with Experiments . . . . . . . . . . . . . . . . . . 175

6 Causal Inference with Controls. . . . . . . . . . . . . . . . . . . . . . 215

7 Trees and Forests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259

8 Factor Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282

9 Text as Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316

10 Deep Learning. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345

Appendix: R Primer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383


Bibliography 419
Glossary 424
Acronyms 433
Index 435

vi

ISTUDY
CONTENTS

About the Authors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v


Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x
What Is This Book About? x

Guided Tour . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
Practical Data Science for Decision Making xi
An Introductory Example xii
Machine Learning xiv
Computing with R xv

Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
1 Regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Linear Regression 3
Residuals 15
Logistic Regression 21
Likelihood and Deviance 26
Time Series 30
Spatial Data 46

2 Uncertainty Quantification. . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Frequentist Uncertainty 56
False Discovery Rate Control 67
The Bootstrap 72
More on Bootstrap Sampling 86
Bayesian Inference 91
3 Regularization and Selection. . . . . . . . . . . . . . . . . . . . . . . . 100
Out-of-Sample Performance 101
Building Candidate Models 108
Model Selection 130
Uncertainty Quantification for the Lasso 144

4 Classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Nearest Neighbors 152
Probability, Cost, and Classification 158
Classification via Regression 160
Multinomial Logistic Regression 163

ISTUDY
viii    Contents

5 Causal Inference with Experiments . . . . . . . . . . . . . . . . . . 175


Notation for Causal Inference 177
Randomized Controlled Trials 179
Regression Adjustment 184
Regression Discontinuity Designs 192
Instrumental Variables 199
Design of Experiments 208

6 Causal Inference with Controls. . . . . . . . . . . . . . . . . . . . . . 215


Conditional Ignorability 216
Double Machine Learning 224
Heterogeneous Treatment Effects 231
Using Time Series as Controls 241

7 Trees and Forests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259


Decision Trees 261
Random Forests 268
Causal Inference with Random Forests 275
Distributed Computing for Random Forests 277

8 Factor Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282


Clustering 283
Factor Models and PCA 290
Factor Regression 302
Partial Least Squares 308

9 Text as Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316


Tokenization 317
Text Regression 325
Topic Models 329
Word Embedding 338

10 Deep Learning. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345


The Ingredients of Deep Learning 346
Working with Deep Learning Frameworks 352
Stochastic Gradient Descent 367
The State of the Art 374
Intelligent Automation 380

ISTUDY
Contents    ix

Appendix: R Primer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383


Getting Started with R 384
Working with Data 396
Advanced Topics for Functions 408
Organizing Code, Saving Work, and Creating Reports 414

Bibliography 419
Glossary 424
Acronyms 433
Index 435

ISTUDY
Visit https://ebookluna.com
now to explore a diverse
collection of ebooks available
in formats like PDF, EPUB, and
MOBI, compatible with all
devices. Don’t miss the chance
to enjoy exciting offers and
quickly download high-quality
materials in just a few simple
steps!
PREFACE

What Is This Book About?


The practice of data analytics is changing and modernizing. Innovations in computation and
machine learning are creating new opportunities for the data analyst: exposing previously
unexplored data to scientific analysis, scaling tasks through automation, and allowing deeper
and more accurate modeling. Spreadsheet models and pivot tables are being replaced by code
scripts in languages like R and Python. There has been massive growth in digitized information,
accompanied by development of systems for storage and analysis of this data. There has also
been an intellectual convergence across fields—machine learning and computer science, sta-
tistics, and social sciences and economics—that has raised the breadth and quality of applied
analysis everywhere. This is the data science approach to analytics, and it allows leaders to go
deeper than ever to understand their operations, products, and customers.
This book is a primer for those who want to gain the skills to use data science to help make
decisions in business and beyond. The modern business analyst uses tools from machine learn-
ing, economics, and statistics to not only track what has happened but predict the future for
their businesses. Analysts may need to identify the variables important for business policy, run
an experiment to measure these variables, and mine social media for information about public
response to policy changes. A company might seek to connect small changes in a recommen-
dation system to changes in customer experience and use this information to estimate a demand
curve. And any analysis will need to scale to companywide data, be repeatable in the future,
and quantify uncertainty about the model estimates and conclusions.
This book focuses on business and economic applications, and we expect that our core
audience will be looking to apply these tools as data scientists and analysts inside companies.
But we also cover examples from health care and other domains, and the practical material that
you learn in this book applies far beyond any narrow set of business problems.
This is not a book about one of machine learning, economics, or statistics. Rather, this
book pulls from all of these fields to build a toolset for modern business analytics. The material
in this book is designed to be useful for decision making. Detecting patterns in past data can
be useful—we will cover a number of pattern recognition topics—but the necessary analysis
for deeper business problems is about why things happen rather than what has happened. For
this reason, this book will spend the time to move beyond correlation to causal analysis. This
material is closer to economics than to the mainstream of data science, which should help you
have a bigger practical impact through your work.
We can’t cover everything here. This is not an encyclopedia of data analysis. Indeed, for
continuing study, there are a number of excellent books covering different areas of contempo-
rary machine learning and data science. For example, Hastie et al. (2009) is a comprehensive
modern statistics reference and James et al. (2021) is a less advanced text from a similar view-
point. You can view this current text as a stepping stone to a career of continued exploration
and learning in statistics and machine learning. We want you to leave with a set of best prac-
tices that make you confident in what to trust, how to use it, and how to learn more.
x

ISTUDY
GUIDED TOUR

This book is based on the Business Data Science text by Taddy (2019), which was itself developed
as part of the MBA data science curriculum at the University of Chicago Booth School of Business.
This new adaptation creates a more accessible and course-ready textbook, and includes a major
expansion of the examples and content (plus an appendix tutorial on computing with R). Visit Con-
nect for digital assignments, code, datasets, and additional resources.

Practical Data Science for Decision Making


Our target readership is anyone who wants to get the skills to use modern large-scale data to
make decisions, whether they are working in business, government, science, or anywhere else.
In the past 10 years, we’ve observed the growth of a class of generalists who can understand busi-
ness problems and also dive into the (big) data and run their own analyses. There is a massive demand
for people with these capabilities, and this book is our attempt to help grow more of these sorts of
people. You may be reading this book from a quantitative undergraduate course, as part of your MBA
degree at a business school, or in a data science or other graduate program. Or, you may just be reading
the book on your own accord. As data analysis has become more crucial and exciting, we are seeing
a boom in people switching into data analysis careers from a wide variety of backgrounds. Those
self-learners and career-switchers are as much our audience here as students in a classroom.
All of this said, this is not an easy book. We have tried to avoid explanations that require
calculus or advanced linear algebra, but you will find the book a tough slog if you do not have a
solid foundation in first-year mathematics and probability. Since the book includes a breadth of
material that spans a range of complexity, we begin each chapter with a summary that outlines
each section and indicates their difficulty according to a ski-hill scale:
The easiest material, requiring familiarity with some transformations like logarithms
and exponents, and an understanding of the basics of probability.
Moderately difficult material, involving more advanced ideas from probability and
statistics or ideas that are going to be difficult to intuit without some linear algebra.
The really tough stuff, involving more complex modeling ideas (and notation) and
tools from linear algebra and optimization.
The black diamond material is not necessary for understanding future green or blue sections,
and so instructors may wish to set their courses to cover the easy and moderately difficult sec-
tions while selecting topics from the hardest sections.
The book is designed to be self-contained, such that you can start with little prerequisite
background in data science and learn as you go. However, the pace of content on introductory
probability and statistics and regression is such that you may struggle if this is your first-ever
course on these ideas. If you find this to be the case, we recommend spending some time work-
ing through a dedicated introductory statistics book to build some of this understanding before
diving into the more advanced data science material.

ISTUDY
xii    Guided Tour

It is also important to recognize that data science can be learned only by doing. This means
writing the code to run analysis routines on really messy data. We will use the R scripting lan-
guage for all of our examples. All example code and data is available online, and one of the
most important skills you will get out of this book will be an advanced education in this pow-
erful and widely used statistical software. For those who are completely new to R, we have also
included an extensive R primer. The skills you learn here will also prepare you well for learning
how to program in other languages, such as Python, which you will likely encounter in your
business analysis career.
This is a book about how to do modern business analytics. We will lay out a set of core
principles and best practices that come from statistics, machine learning, and economics. You
will be working through many real data analysis examples as you learn by doing. It is a book
designed to prepare scientists, engineers, and business professionals to use data science to
improve their decisions.

An Introductory Example
Before diving into the core material, we will work through a simple finance example to illus-
trate the difference between data processing or description and a deeper business analysis.
Consider the graph in Figure 0.1. This shows seven years of monthly returns for stocks in the
S&P 500 index (a return is the difference between the current and previous price divided by
the prior value). Each line ranging from bright yellow to dark red denotes an individual stock’s
return series. Their weighted average—the value of the S&P 500—is marked with a bold line.
Returns on three-month U.S. treasury bills are in gray.
This is a fancy plot. It looks cool, with lots of different lines. It is the sort of plot that you
might see on a computer screen in a TV ad for some online brokerage platform. If only I had
that information, I’d be rich!

S&P500
0.5
Return
0.0
–0.5

2010 2011 2012 2013 2014 2015 2016 2017

FIGURE 0.1 A fancy plot: monthly stock returns for members of the S&P 500 and their average (the bold
line). What can you learn?

ISTUDY
Guided Tour    xiii

But what can you actually learn from Figure 0.1? You can see that returns do tend to
bounce around near zero (although the long-term average is reliably much greater than zero).
You can also pick out periods of higher volatility (variance) where the S&P 500 changes more
from month to month and the individual stock returns around it are more dispersed. That’s
about it. You don’t learn why these periods are more volatile or when they will occur in the
future. More important, you can’t pull out useful information about any individual stock. There
is a ton of data on the graph but little useful information.
Instead of plotting raw data, let’s consider a simple market model that relates individual
stock returns to the market average. The capital asset pricing model (CAPM) regresses the
returns of an individual asset onto a measure of overall market returns, as shown here:
rjt = αj + βjmt + εjt (0.1)
The output rjt is equity j return at time t. The input mt is a measure of the average return—the
“market”—at time t. We take mt as the return on the S&P 500 index that weights 500 large
companies according to their market capitalization (the total value of their stock). Finally, εjt is
an error that has mean zero and is uncorrelated with the market.
Equation (0.1) is the first regression model in this book. You’ll see many more. This is a
simple linear regression that should be familiar to most readers. The Greek letters define a line
relating each individual equity return to the market, as shown in Figure 0.2. A small βj, near zero,
indicates an asset with low market sensitivity. In the extreme, fixed-income assets like treasury
bills have βj = 0. On the other hand, a βj > 1 indicates a stock that is more volatile than the mar-
ket, typically meaning growth and higher-risk stocks. The αj is free money: assets with αj > 0 are
adding value regardless of wider market movements, and those with αj < 0 destroy value.
Figure 0.3 represents each stock “ticker” in the two-dimensional space implied by the mar-
ket model’s fit on the seven years of data in Figure 0.1. The tickers are sized proportional to
each firm’s market capitalization. The two CAPM parameters—[α, β]—tell you a huge amount
about the behavior and performance of individual assets. This picture immediately allows you
to assess market sensitivity and arbitrage opportunities. For example, the big tech stocks of
Facebook (FB), Amazon (AMZN), Apple (AAPL), Microsoft (MSFT), and Google (GOOGL)
all have market sensitivity β values close to one. However, Facebook, Amazon, and Apple
generated more money independent of the market over this time period compared to Micro-
soft and Google (which have nearly identical α values and are overlapped on the plot). Note
0.3
Equity return
0.1
−0.1
−0.3

−0.2 −0.1 0.0 0.1 0.2


Market return

FIGURE 0.2 A scatterplot of a single stock’s returns against market returns, with the fitted regression
line for the model of Equation (0.1) shown in red.

ISTUDY
xiv    Guided Tour

FB

0.015
AMZN

AAPL
0.010

V
Alpha

BA
AMGN
DIS
0.005

T
PEP JNJ PFE GOOG
MSFT
WFC GE
PG KO
WMT JPM
0.000

CVX
IBM XOM
ORCL BAC
CSCO

0.4 0.6 0.8 1.0 1.2 1.4 1.6


Beta

FIGURE 0.3 Stocks positioned according to their fitted market model, where α is money you make
regardless of what the market does and β summarizes sensitivity to market movements. The tickers are sized
proportional to market capitalization. Production change alpha to α and beta to β in the plot axis labels.

that Facebook’s CAPM parameters are estimated from a shorter time period, since it did not
have its IPO until May of 2012. Some of the older technology firms, such as Oracle (ORCL),
Cisco (CSCO), and IBM, appear to have destroyed value over this period (negative alpha).
Such information can be used to build portfolios that maximize mean returns and minimize
variance in the face of uncertain future market conditions. It can also be used in strategies
like pairs-trading where you find two stocks with similar betas and buy the higher alpha while
“shorting” the other.
CAPM is an old tool in financial analysis, but it serves as a great illustration of what to strive
toward in practical data science. An interpretable model translates raw data into information that
is directly relevant to decision making. The challenge in data science is that the data you’ll be
working with will be larger and less structured (e.g., it will include text and image data). Moreover,
CAPM is derived from assumptions of efficient market theory, and in many applications you won’t
have such a convenient simplifying framework on hand. But the basic principles remain the same:
you want to turn raw data into useful information that has direct relevance to business policy.

Machine Learning
Machine learning (ML) is the field of using algorithms to automatically detect and predict pat-
terns in complex data. The rise of machine learning is a major driver behind data science and a
big part of what differentiates today’s analyses from those of the past. ML is closely related to
modern statistics, and indeed many of the best ideas in ML have come from statisticians. But
whereas statisticians have often focused on model inference—on understanding the parameters
of their models (e.g., testing on individual coefficients in a regression)—the ML community
has historically been more focused on the single goal of maximizing predictive performance
(i.e., predicting future values of some response of interest, like sales or prices).

ISTUDY
Guided Tour    xv

A focus on prediction tasks has allowed ML to quickly push forward and work with larger
and more complex data. If all you care about is predictive performance, then you don’t need
to worry about whether your model is “true” but rather just test how well it performs when
predicting future values. This single-minded focus allows rapid experimentation on alternative
models and estimation algorithms. The result is that ML has seen massive success, to the point
that you can now expect to have available for almost any type of data an algorithm that will
work out of the box to recognize patterns and give high-quality predictions.
However, this focus on prediction means that ML on its own is less useful for many decision-
making tasks. ML algorithms learn to predict a future that is mostly like the past. Suppose that
you build an ML algorithm that looks at how customer web browser history predicts how much
they spend in your e-commerce store. A purely prediction-focused algorithm will discern what
web traffic tends to spend more or less money. It will not tell you what will happen to the
spending if you change a group of those websites (or your prices) or perhaps make it easier for
people to browse the Web (e.g., by subsidizing broadband). That is where this book comes in:
we will use tools from economics and statistics in combination with ML techniques to create a
platform for using data to make decisions.
Some of the material in this book will be focused on pure ML tasks like prediction and
pattern recognition. This is especially true in the earlier chapters on regression, classification,
and regularization. However, in later chapters you will use these prediction tools as parts of
more structured analyses, such as understanding subject-specific treatment effects, fitting
consumer demand functions, or as part of an artificial intelligence system. This typically
involves a mix of domain knowledge and analysis tools, which is what makes the data scientist
such a powerful figure. The ML tools are useless for policy making without an understanding
of the business problems, but a policy maker who can deploy ML as part of their analysis
toolkit will be able to make better decisions faster.

Computing with R
You don’t need to be a software engineer to work as a data scientist, but you need to be able
to write and understand computer code. To learn from this book, you will need to be able to
read and write in a high-level scripting language, in other words, flexible code that can be used
to describe recipes for data analysis. In particular, you will need to have a familiarity with R
(r-project.org).
The ability to interact with computers in this way—by typing commands rather than click-
ing buttons or choosing from a menu—is a basic data analysis skill. Having a script of com-
mands allows you to rerun your analyses for new data without any additional work. It also
allows you to make small changes to existing scripts to adapt them for new scenarios. Indeed,
making small changes is how we recommend you work with the material in this book. The
code for every in-text example is available on-line, and you can alter and extend these scripts
to suit your data analysis needs. In the examples for this book, all of the analysis will be con-
ducted in R. This is an open-source high-level language for data analysis. R is used widely
throughout industry, government, and academia. Companies like RStudio sell enterprise prod-
ucts built around R. This is not a toy language used simply for teaching purposes—R is the real
industrial-strength deal.
For the fundamentals of statistical analysis, R is tough to beat: all of the tools you need for
linear modeling and uncertainty quantification are mainstays. R is also relatively forgiving for

ISTUDY
xvi    Guided Tour

the novice programmer. A major strength of R is its ecosystem of contributed packages. These
are add-ons that increase the capability of core R. For example, almost all of the ML tools that
you will use in this book are available via packages. The quality of the packages is more varied
than it is for R’s core functionality, but if a package has high usage you should be confident that
it works as intended.
The Appendix of this book contains a tutorial that is dedicated to getting you started in R.
It focuses on the topics and algorithms that are used in the examples in this book. You don’t
need to be an expert in R to learn from this book; you just need to be able to understand the
fundamentals and be willing to mess around with the coded examples. If you have no formal
background in coding, worry not: many in the field started out in this position. The learning
curve can be steep initially, but once you get the hang of it, the rest will come fast. The tutorial
in the Appendix should help you get started. We also provide extensive examples throughout
the book, and all code, data, and homework assignments are available through Connect. Every
chapter ends with a Quick Reference section containing the basic R recipes from that chapter.
When you are ready to learn more, there are many great places where you can supplement your
understanding of the basics of R. If you simply search for R or R statistics books on-line, you
will find a huge variety of learning resources.

ISTUDY
ACKNOWLEDGMENTS

We are grateful for the reviewers who provided feedback on this first edition:

Sue Abdinnour, Wichita State University Arash Negahban, California State


Anil Aggarwal, University of Baltimore University, Chico
Goutam Chakraborty, Oklahoma State Yasin Ozcelik, Fairfield University
University Brad Price, West Virginia University
Rick Cleary, Babson College Xingye Qiao, Binghamton University
John Daniels, Central Michigan University Roman Rabinovich, Boston University
John Draper, Ohio State University Bharatendra Rai, UMass-Dartmouth
Janet Frasier, West Virginia University Balaraman Rajan, California State
Phillip C. Fry, Boise State University University, East Bay
Marina Girju, California Baptist University Rouzbeh Razavi, Kent State University
Richard Hauser, East Carolina University John Repede, Queens University of Charlotte
Kuo-Ting “Ken” Hung, Suffolk University Thomas R. Robbins, East Carolina
Aimee Jacobs, California State University, University
Fresno Wendy Swenson Roth, Georgia State
Jaehwan Jeong, Radford University University
Patrick Johanns, Univeristy of Iowa Seokwoo Song, Weber State University
Barry King, Butler University John R. Stevens, Utah State University
Lauren Kleitz, Xavier University Jie Tao, Fairfield University
Su “Sue” Kong, Kutztown University Vicar S. Valencia, Indiana University South
Min Li, California State University, Bend
Sacramento Nikhil Varaiya, San Diego State University
Jiajuan Liang, University of New Haven Gang Wang, UMass-Dartmouth
Vic Matta, Ohio University K. Matthew Wong, St. John’s University
Ebrahim Mortaz, Pace University Chase Wu, New Jersey Institute of
Bob Myers, Georgia Tech University Technology
Robert Nauss, University of Yajiong “Lucky” Xue, East Carolina
Missouri-St. Louis University

ISTUDY
xviii    Preface

Instructors: Student Success Starts with You


Tools to enhance your unique voice
Want to build your own course? No problem. Prefer to use an
OLC-aligned, prebuilt course? Easy. Want to make changes throughout
65%
Less Time
the semester? Sure. And you’ll save time with Connect’s auto-grading too.
Grading

Study made personal


Incorporate adaptive study resources like
SmartBook® 2.0 into your course and help your
students be better prepared in less time. Learn
more about the powerful personalized learning
experience available in SmartBook 2.0 at
www.mheducation.com/highered/connect/smartbook

Laptop: McGraw Hill; Woman/dog: George Doyle/Getty Images

Affordable solutions, Solutions for


added value your challenges
Make technology work for you with A product isn’t a solution. Real
LMS integration for single sign-on access, solutions are affordable, reliable,
mobile access to the digital textbook, and come with training and
and reports to quickly show you how ongoing support when you need
each of your students is doing. And with it and how you want it. Visit www.
our Inclusive Access program you can supportateverystep.com for videos
provide all these tools at a discount to and resources both you and your
your students. Ask your McGraw Hill students can use throughout the
representative for more information. semester.

Padlock: Jobalou/Getty Images Checkmark: Jobalou/Getty Images

ISTUDY
Preface    xix

Students: Get Learning that Fits You


Effective tools for efficient studying
Connect is designed to help you be more productive with simple, flexible, intuitive tools that maximize
your study time and meet your individual learning needs. Get learning that works for you with Connect.

Study anytime, anywhere “I really liked this


Download the free ReadAnywhere app and access app—it made it easy
your online eBook, SmartBook 2.0, or Adaptive to study when you
Learning Assignments when it’s convenient, even don't have your text-
if you’re offline. And since the app automatically book in front of you.”
syncs with your Connect account, all of your work is
available every time you open it. Find out more at
www.mheducation.com/readanywhere - Jordan Cunningham,
Eastern Washington University

Everything you need in one place


Your Connect course has everything you need—whether reading on
your digital eBook or completing assignments for class, Connect makes
it easy to get your work done.

Calendar: owattaphotos/Getty Images

Learning for everyone


McGraw Hill works directly with Accessibility Services
Departments and faculty to meet the learning needs
of all students. Please contact your Accessibility
Services Office and ask them to email
[email protected], or visit
www.mheducation.com/about/accessibility
for more information.

Top: Jenner Images/Getty Images, Left: Hero Images/Getty Images, Right: Hero Images/Getty Images

ISTUDY
Visit https://ebookluna.com
now to explore a diverse
collection of ebooks available
in formats like PDF, EPUB, and
MOBI, compatible with all
devices. Don’t miss the chance
to enjoy exciting offers and
quickly download high-quality
materials in just a few simple
steps!
Proctorio
Remote Proctoring & Browser-Locking
Capabilities
Remote proctoring and browser-locking capabilities, hosted by
Proctorio within Connect, provide control of the assessment
environment by enabling security options and verifying the identity of the student.
Seamlessly integrated within Connect, these services allow instructors to control students’
assessment experience by restricting browser activity, recording students’ activity, and verify-
ing students are doing their own work.
Instant and detailed reporting gives instructors an at-a-glance view of potential academic
integrity concerns, thereby avoiding personal bias and supporting evidence-based claims.

ReadAnywhere
Read or study when it’s convenient for you with McGraw Hill’s free ReadAnywhere app. Avail-
able for iOS or Android smartphones or tablets, ReadAnywhere gives users access to McGraw
Hill tools including the eBook and SmartBook 2.0 or Adaptive Learning Assignments in Con-
nect. Take notes, highlight, and complete assignments offline–all of your work will sync when
you open the app with WiFi access. Log in with your McGraw Hill Connect username and
password to start learning–anytime, anywhere!

OLC-Aligned Courses
Implementing High-Quality Online Instruction and Assessment through Preconfigured
Courseware
In consultation with the Online Learning Consortium (OLC) and our certified Faculty
Consultants, McGraw Hill has created pre-configured courseware using OLC’s quality score-
card to align with best practices in online course delivery. This turnkey courseware contains
a combination of formative assessments, summative assessments, homework, and application
activities, and can easily be customized to meet an individual’s needs and course outcomes. For
more information, visit https://www.mheducation.com/highered/olc.

Tegrity: Lectures 24/7


Tegrity in Connect is a tool that makes class time available 24/7 by automatically capturing
every lecture. With a simple one-click start-and-stop process, you capture all computer screens
and corresponding audio in a format that is easy to search, frame by frame. Students can replay
any part of any class with easy-to-use, browser-based viewing on a PC, Mac, iPod, or other
mobile device.
Educators know that the more students can see, hear, and experience class resources,
the better they learn. In fact, studies prove it. Tegrity’s unique search feature helps students

xx

ISTUDY
efficiently find what they need, when they need it, across an entire semester of class record-
ings. Help turn your students’ study time into learning moments immediately supported by
your lecture. With Tegrity, you also increase intent listening and class participation by easing
students’ concerns about note-taking. Using Tegrity in Connect will make it more likely you
will see students’ faces, not the tops of their heads.

Test Builder in Connect


Available within Connect, Test Builder is a cloud-based tool that enables instructors to format
tests that can be printed, administered within a Learning Management System, or exported as
a Word document of the test bank. Test Builder offers a modern, streamlined interface for easy
content configuration that matches course needs, without requiring a download.
Test Builder allows you to:
· access all test bank content from a particular title.
· easily pinpoint the most relevant content through robust filtering options.
· manipulate the order of questions or scramble questions and/or answers.
· pin questions to a specific location within a test.
· determine your preferred treatment of algorithmic questions.
· choose the layout and spacing.
· add instructions and configure default settings.
Test Builder provides a secure interface for better protection of content and allows for just-
in-time updates to flow directly into assessments.

Writing Assignment
Available within Connect and Connect Master, the Writing Assignment tool delivers a learning
experience to help students improve their written communication skills and conceptual under-
standing. As an instructor you can assign, monitor, grade, and provide feedback on writing
more efficiently and effectively.

Application-Based Activities in Connect


Application-Based Activities in Connect are highly interactive, assignable exercises that provide
students a safe space to apply the concepts they have learned to real-world, course-specific prob-
lems. Each Application-Based Activity involves the application of multiple concepts, allowing
students to synthesize information and use critical thinking skills to solve realistic scenarios.

Your Book, Your Way


McGraw Hill’s Content Collections Powered by Create® is a self-service website that
enables instructors to create custom course materials—print and eBooks—by drawing upon

ISTUDY
McGraw Hill’s comprehensive, cross-disciplinary content. Choose what you want from our
high-quality textbooks, articles, and cases. Combine it with your own content quickly and eas-
ily, and tap into other rights-secured, third-party content such as readings, cases, and articles.
Content can be arranged in a way that makes the most sense for your course and you can
include the course name and information as well. Choose the best format for your course: color
print, black-and-white print, or eBook. The eBook can be included in your Connect course and
is available on the free ReadAnywhere app for smartphone or tablet access as well. When you
are finished customizing, you will receive a free digital copy to review in just minutes! Visit
McGraw Hill Create®—www.mcgrawhillcreate.com—today and begin building!

xxii

ISTUDY
1
This chapter develops the framework and language of regression: building models
that predict response outputs from feature inputs.

Section 1.1 Linear Regression: Specify, estimate, and predict from a linear
regression model for a quantitative response y as a function of inputs x. Use
log transforms to model multiplicative relationships and elasticities, and use
­interactions to allow the effect of inputs to depend on each other.
Section 1.2 Residuals: Calculate the residual errors for your regression fit, and
understand the key fit statistics deviance, R2, and degrees of freedom.
Section 1.3 Logistic Regression: Build logistic regression models for a binary
response variable, and understand how logistic regression is related to linear
regression as a generalized linear model. Translate the concepts of ­deviance,
likelihood, and R2 to logistic regression, and be able to interpret logistic
­regression coefficients as effects on the log odds that y = 1.
Section 1.4 Likelihood and Deviance: Relate likelihood maximization and
deviance minimization, use the generalized linear models to determine r­ esidual
deviance, and use the predict function to integrate new data with the same
­variable names as the data used to fit your regression.
Section 1.5 Time Series: Adapt your regression models to allow for
­dependencies in data that has been observed over time, and understand time
series concepts including seasonal trends, autoregression, and panel data.
Section 1.6 Spatial Data: Add spatial fixed effects to your regression mod-
els and use Gaussian process models to estimate spatial dependence in your
observations.

ISTUDY
2    Chapter 1   Regression

T
he vast majority of problems in applied data science require regression modeling. You
have a response variable (y) that you want to model or predict as a function of a vector
of input features, or covariates (x). This chapter introduces the basic framework and lan-
guage of regression. We will build on this material throughout the rest of the book.
Regression is all about understanding the conditional probability distribution for “y given
x,” which we write as p(y|x). Figure 1.1 illustrates the conditional distribution in contrast to a
marginal distribution, which is so named because it corresponds to the unconditional distribu-
tion for a single margin (i.e., column) of a data matrix.
A variable that has a probability distribution (e.g., number of bathrooms in Figure 1.1) is
called a random variable. The mean for a random variable is the average of random draws from
its probability distribution. While the marginal mean is a simple number, the conditional mean
is a function. For example, from Figure 1.1b, you can see that the average home selling price
takes different values indexed by the number of bathrooms. The data is distributed randomly
around these means, and the way that you model these distributions drives your estimation and
prediction strategies.

Conditional Expectation
A basic but powerful regression strategy is to build models in terms of averages and lines. That
is, we will model the conditional mean for our output variable as a linear function of inputs.
Other regression strategies can sometimes be useful, such as quantile regression that models
percentiles of the conditional distribution. However for the bulk of applications you will find
that mean regression is a good approach.
There is some important notation that you need to familiarize yourself with for the rest of
the book. We model the conditional mean for y given x as
​𝔼[y | x] = f  ​(​x′β​)​​ (1.1)
where
• ​𝔼[⋅​]​denotes the taking of the expectation or average of whatever random variable is inside
the brackets. It is an extremely important operation, and we will use this notation to define
many of our statistical models.
8000

Home value
Frequency

1000000
4000
0

0 500000 1500000 0 1 2 3 4 5 6 7
Home value Number of bathrooms
(a) Marginal Distribution (b) Conditional Distribution

FIGURE 1.1 Illustration of marginal versus conditional distributions for home prices. On the left, we have
the marginal distribution for all of the home prices. On the right, home price distributions are conditional on
the number of bathrooms.

ISTUDY
Chapter 1   Regression    3

• The vertical bar | means “given” or “conditional upon,” so that ​𝔼[y|x]​​is read as “the
­average for y given inputs x.”
• f (·) is a “link” function that transforms from the linear model to your response.
• x = [1, x1, x2, . . . xp] is the vector of covariates and β = [β0, β1, β2, . . . βp] are the
­corresponding coefficients.

⎢⎥
The vector notation, x′β, is shorthand for the sum of elementwise products:
⎡​β​0​⎤
​β​1​
​x′β = [1​x​1​​x​2​⋯ ​x​p​]​ ​β​2​​ ​= ​β​0​+ ​x​1​β​1​+ ​x​2​β​2​+ … + ​x​p​β​p​​ (1.2)

⎣ ​p​⎦

β
This shorthand notation will be used throughout the book. Here we have used the convention
that x0 = 1, such that β0 is the intercept.
The link function, f(·), defines the relationship between your linear function x′β and the
response. The link function gives you a huge amount of modeling flexibility. This is why mod-
els of the kind written in Equation (1.1) are called generalized linear models (GLMs). They
allow you to make use of linear modeling strategies after some simple transformations of your
output variable of interest. In this chapter we will outline the two most common GLMs: linear
regression and logistic regression. These two models will serve you well for the large majority
of analysis problems, and through them you will become familiar with the general principles
of GLM analysis.

1.1 Linear Regression


Linear regression is the workhorse of analytics. It is fast to fit (in terms of both analyst and com-
putational time), it gives reasonable answers in a variety of settings (so long as you know how
to ask the right questions), and it is easy to interpret and understand. The model is as follows:
​​𝔼[y|x] = ​β​0​+ ​x​1​β​1​+ ​x​2​β​2​+ … + ​x​p​β​p​​ (1.3)
This corresponds to using the link function f(z) = z in Equation (1.1).
With just one input x, you can write the model as ​𝔼​[​y​|​x​]​= ​β​0​+ x ​β​1​ and plot it as in
­Figure 1.2. β0 is the intercept. This is where the line crosses the y axis when x is 0. β1 is the

β1

β0

FIGURE 1.2 Simple linear regression with a positive slope β1. The plotted line corresponds to 𝔼​[​y​|​x​]​.

ISTUDY
4    Chapter 1   Regression

E[Y∣X]

Gaussian
distribution

FIGURE 1.3 Using simple linear regression to picture the Gaussian conditional distribution for y|x.
Here ​𝔼[y|x]​​are the values on the line and the variation parallel to the y axis (i.e., within each narrow vertical
strip) is assumed to be described by a ­Gaussian distribution.

slope and describes how ​𝔼[y|x​]​changes as x changes. If x increases by 1 unit, ​𝔼​[​y|x​]​changes by


β1. For a two predictor model, we are fitting a plane. Higher dimensions are more difficult to
imagine, but the basic intuition is the same.
When fitting a regression model—i.e., when estimating the β coefficients—you make
some assumptions about the conditional distribution beyond its mean at ​𝔼[​ ​y|x​]​. Linear regres-
sion is commonly fit for Gaussian (normal) conditional distributions. We write this conditional
distribution as
​y | x ~ N​(​x′β, ​σ​2​)​​ (1.4)

This says that the distribution for y as a function of x is normally distributed around
​𝔼[y|x] = x′β​​with variance σ2. The same model is often written with an additive error term:
​y = x′β + ε, ε ~ N(0, ​σ​2​)​ (1.5)
where ε are the “independent” or “idiosyncratic” errors. These errors contain the variations in
y that are not correlated with x. Equations (1.4) and (1.5) describe the same model. Figure 1.3
illustrates this model for single-input simple linear regression. The line is the average ​𝔼[y|x]​​
and vertical variation around the line is what is assumed to have a normal distribution.
You will often need to transform your data to make the linear model of Equation (1.5)
realistic. One common transform is that you need to take a logarithm of the response, say, “r,”
such that your model becomes
​log (r) = x′β + ε, ε ~ N(0, ​σ​2​)​ (1.6)
Of course this is the same as the model in Equation (1.5), but we have just made the replace-
ment y = log(r). You will likely also consider transformations for the input variables, such that
elements of x include logarithmic and other functional transformations. This is often referred
to as feature engineering.

Example 1.1 Orange Juice Sales: Exploring Variables and the Need for a log-log Model As
a concrete example, consider sales data for orange juice (OJ) from Dominick’s grocery
stores. Dominick’s was a Chicago-area chain. This data was collected in the 1990s and
is publicly available from the Kilts Center at the University of Chicago’s Booth School of

ISTUDY
Chapter 1   Regression    5

brands—Tropicana, Minute Maid, Dominick’s—at 83 stores in the Chicago area, as well as an


indicator, ad, showing whether each brand was advertised (in store or flyer) that week.

> oj <– read.csv(“oj.csv”,strings=T)


> head(oj)
sales price brand ad
1 8256 3.87 tropicana 0
2 6144 3.87 tropicana 0
3 3840 3.87 tropicana 0
4 8000 3.87 tropicana 0
5 8896 3.87 tropicana 0
6 7168 3.87 tropicana 0
> levels(oj$brand)
[1] “dominicks” “minute.maid” “tropicana”

Notice the argument strings=T in read.csv as shorthand for “stringsAsFactors = TRUE.”


This converts our brand column into a factor variable. This was the default behavior of read.
csv prior to version 4.0.0 of R, but you now need to specify it explicitly. Otherwise you will get
an error when you try to make the plots or fit the regression models below.
The code-printout above is our first example showing R code and output. We will include
a ton of code and output snippets like this throughout the book: they are an integral part of the
material. If this output looks unfamiliar to you, you should break here and take the time to work
through the R-primer in the Appendix.
Figure 1.4 shows the prices and sales broken out by brand. You can see in Figure 1.4a that
each brand occupies a different price range: Dominick’s is the budget option, Tropicana is the
luxury option, and Minute Maid lives between. In Figure 1.4c, sales are clearly decreasing with
dominicks minute.maid tropicana

6e+05

12
10
4e+05

log(sales)
Brand

Sales

8
2e+05

6
0e+00

1 2 3 4 0.5 1.5 2.5 3.5 –0.5 0.0 0.5 1.0


Price Price log(price)
(a) Price by Brand (b) Sales vs. Price (c) log Sales vs. log Price

FIGURE 1.4

ISTUDY
6    Chapter 1   Regression

price. This makes sense: demand is downward sloping, and if you charge more, you sell less.
More specifically, it appears that log sales has a roughly linear relationship with log price. This
is an important point. Whenever you are working with linear (i.e., additive) models, it is crucial
that you try to work in the space where you expect to find linearity. For variables that change
multiplicatively with other factors, this is usually the log scale (see the nearby box for a quick
review on logarithms). For comparison, the raw (without log) values in Figure 1.4b show a
nonlinear relationship between prices and sales.

log-log Models and Elasticities


Another common scenario models against each other two variables that both move multipli-
catively. For example, Figure 1.5 shows the national gross domestic product (GDP) versus
imports for several countries. Fitting a line to the left panel would be silly; its slope will be
entirely determined by small changes in the U.S. values. In contrast, the right panel shows that
GDP and imports follow a neat linear relationship in log space.
Returning to our OJ example, Figure 1.4c indicates that this log-log model might be appro-
priate for the orange juice sales versus price analysis. One possible regression model is
​​log ​(​𝚜𝚊𝚕𝚎𝚜​)​= ​β​0​+ ​β​1​log ​(​𝚙𝚛𝚒𝚌𝚎​)​+ ε​​ (1.7)
Here, log(sales) increase by β1 for every unit increase in log(price). Conveniently, log-log
models have a much more intuitive interpretation: sales increase by β1% for every 1% increase
in price. To see this, you need a bit of calculus. Write y = exp[β0 + β1 log(x) + ε] and differen-
tiate with respect to x:
dy ​β​1​ ​β​0​+​β​1​log​(​x​)​+ε __​β​ ​ dy / y
​___ ​ ​= __
​x ​​e​ ​= ​x1 ​y ⇒ ​β​1​= ____
​ ​​ (1.8)
dx dx / x
This shows that β1 is the proportional change in y over the proportional change in x. In econom-
ics there is a special name for such an expression: elasticity. The concept of elasticity will play
an important role in many of our analyses.
10000

United States United States


Japan
India
8
8000

United
Brazil Kingdom
France
Canada
Australia
Argentina Netherlands
6

Egypt
4000 6000

GreMalaysia
ece
De nmark
log(GDP)

Finland
Israel
Nigeria
GDP

Japan BoliviaCuba
Panama
Mauritius
Haiti
India Jamaica
2
2000

Liberia
BrazilUni ted Kingdom
France
Canada
Australia
Argentina
Neth
Egyerl
ptands
0

Malaysia
Greece
Denmark
Nigeria
Finland
Israel
Mauritius
Jamaica
Panama
Samoa
Liberia
Bolivia
Cuba
Haiti Samoa
0

0 200 400 600 800 1000 1200 –2 0 2 4 6 8


Imports log(Imports)

FIGURE 1.5 National GDP against imports, in original and log scale.

ISTUDY
Chapter 1   Regression    7

Logarithms and Exponents


Recall the logarithm definition:
​​log (a) = b ⇔ a = ​e​b​​ (1.9)
Here, e ≈ 2.72 is “Euler’s number” and we refer to eb as “e to the power of b” or, simply,
‘b exponentiated.’ We will sometimes write exp[b] instead of eb; they mean the same
thing. There are other types of logarithms (sometimes base 10 is used in introductory
classes), but we will always use the natural log defined in Equation (1.9). The base e
plays a central role in science and modeling of systems because ex is its own derivative:
dex/dx = ex for those readers who know their calculus.
In a simple linear regression for log(y) on x, β1 is added to the expected value for
log(y) for each unit increase in x:
​​log ​(​y​)​= ​β​0​+ ​β​1​x + ϵ.​​ (1.10)
The fact that we are taking the log of y makes this model multiplicative. Recall some
basic facts about logs and exponents: log(ab) = log(a) +log(b), log(ab) = b log(a), and
ea+b = eaeb. Thus, exponentiating both sides of Equation (1.10) yields
​y = ​e​​β​0​+​β​1​x+ϵ​= ​e​​β​0​​​e​​β​1​x​​e​ϵ​​ (1.11)
Considering x* = x + 1, you get that
​y* = ​e​​β​0​+ϵ​​e​​β​1​x*​= ​e​​β​0​+ϵ​​e​​β​1​(​x+1​)​​= ​e​​β​0​+​β​1​x+ϵ​​e​​β​1​​= ​ye​​​β​1​​​ (1.12)
Therefore, each unit increase in x leads ​𝔼​[​y|x​]​to be multiplied by the factor ​e​​β​1​​.

Example 1.2 Orange Juice Sales: Linear Regression Now that we have established what a
log-log model will do for us, let’s add a bit of complexity to the model from (1.7) to make it
more realistic. If you take a look at Figure 1.4c, it appears that the three brands have log-log
sales-price relationships that are concentrated around three separate lines. If you suspect that
each brand has the same β1 elasticity but a different intercept (i.e., if all brands have sales that
move with price the same way but at the same price some brands will sell more than others),
then you would use a slightly more complex model that incorporates both brand and price:
​​log (𝚜𝚊𝚕𝚎𝚜) = ​α​𝚋𝚛𝚊𝚗𝚍​+ β log (𝚙𝚛𝚒𝚌𝚎) + ε​​ (1.13)

Here, αbrand is shorthand for a separate intercept for each OJ brand, which we could write out
more fully as
​​α​𝚋𝚛𝚊𝚗𝚍​= ​α​0​​1​​[​𝚍𝚘𝚖𝚒𝚗𝚒𝚌𝚔𝚜​]​​ + ​α​1​​1​​[​𝚖𝚒𝚗𝚞𝚝𝚎.𝚖𝚊𝚒𝚍​]​​ + ​α​2​​1​​[​𝚝𝚛𝚘𝚙𝚒𝚌𝚊𝚗𝚊​]​.​ ​ (1.14)

The indicator functions, ​1​​[​v​]​,​ are one if v is the true factor level and zero otherwise. Hence,
Equation (1.13) says that, even though their sales all have the same elasticity to price, the
brands can have different sales at the same price due to brand-specific intercepts.

Fitting Regressions with glm


To fit this regression in R you will use the glm function, which is used to estimate the class of
generalized linear models that we introduced in Equation (1.1). There is also a lm function that

ISTUDY
Visit https://ebookluna.com
now to explore a diverse
collection of ebooks available
in formats like PDF, EPUB, and
MOBI, compatible with all
devices. Don’t miss the chance
to enjoy exciting offers and
quickly download high-quality
materials in just a few simple
steps!
Other documents randomly have
different content
vihreään veteen.

»Ottakaahan pieni kävely, rakas eversti», puhui tyyni, pilkallinen


ääni hänen takanaan.

Yhä pidellen vantista katseli eversti epätietoisena ympärilleen ja


näki koko laivan laidan täynnä mustia kasvoja, jotka vielä
toissapäivänä olisivat kalvenneet nähdessään hänen rypistävän
kulmiaan mutta jotka nyt kaikki seisoivat siinä häijynilkisesti
irvistellen.

Hetkeksi voitti hänessä raivo pelon. Hän kirosi heitä ääneen


rumasti ja runsaasti, irrotti sitten kätensä ja astui lankulle. Kolme
askelta hän ennätti ottaa ennen kuin menetti tasapainonsa ja putosi
läiskähtäen allaan oleviin vihreisiin syvyyksiin.

Kun hän taas ilmaa haukkoen tuli pinnalle, oli Cinco Llagas jo
muutaman kaapelinmitan päässä.

Mutta karjuvat, pilkalliset onnentoivotukset, jotka myötäilivät


laivalta hänen matkaansa, hän vielä kuuli ja ne syövyttivät hänen
voimattoman raivonsa yhä syvemmälle hänen sieluunsa.

Kymmenes luku

DON DIEGO

Don Diego de Espinosa y Valdez heräsi pää pakottavana ja katseli


raukein silmin hyttiään, johon aurinko perässä olevasta ikkunasta
valoi kirkkaita säteitään. Hän huokasi syvään ja sulki uudelleen
silmänsä sietämättömän päänkivun vuoksi. Maatessaan siinä hän
koetti päästä selville ajasta ja paikasta. Mutta tuskansa vuoksi ja
puolipökerryksissä kun vielä oli, hän ei saanut ainoatakaan
yhtenäistä ajatusta syntymään.

Selittämätön levottomuuden tunne pakotti hänet taas avaamaan


silmänsä ja uudelleen tutkimaan ympäristöään.

Ei voinut olla epäilystäkään, että hän makasi oman laivansa


laajassa hytissä, joten hänen käsittämätön levottomuutensa oli
varmaan kokonaan perusteeton. Mutta kun heräävä muisti riensi
hänen mietteittensä avuksi, pakotti se hänet itsepäisesti inttämään,
että tässä oli jotakin, joka ei ollut tolallaan. Auringon alhainen asema,
joka salli sen vuodattaa kultaista loistettaan hytin täydeltä, sai hänet
ensin päättelemään, että oli aikainen aamu, siinä tapauksessa että
laiva kulki länteen päin. Sitten johtui hänen mieleensä toinen
mahdollisuus. Laiva saattoi olla menossa itään päin, ja siinä
tapauksessa oli myöhäinen ilta. Laiva oli kulussa, sen hän arvasi
heikosta veden kohinasta, joka hänen alapuoleltaan kuului. Mutta
miten oli mahdollista, että he purjehtivat, vaikka hän, heidän
kapteeninsa, ei tiennyt olivatko he menossa länteen vaiko itään eikä
voinut muistaa, minne heidän matkansa piti?

Hänen ajatuksensa palasivat eilispäivän seikkailuihin, jos ne nyt


sitten olivat tapahtuneet eilen. Helposti saavutettu voitto Barbados-
saarella muistui selvänä hänen mieleensä. Jokaisen
yksityistapauksen hän muisti elävästi aina siihen hetkeen asti, kun
hän taas astui oman laivansa kannelle. Mutta siinä muisti äkkiä ja
selittämättömällä tavalla katkesi.

Hän oli juuri aikeissa vaivata kipeätä päätään kaikenlaisilla


arvailuilla, kun ovi aukeni ja hän näki sanomattomaksi
hämmästyksekseen omien parhaiden vaatteittensa astuvan hyttiin.
Se oli erityisen komea ja luonteenomaisesti espanjalainen puku,
mustaa taftikangasta runsaine hopeareunuksineen, puku jonka hän
vuosi sitten oli teettänyt itselleen Cadizissa, ja hän tunsi sen jokaisen
yksityiskohdan niin tarkoin, että hänen oli mahdotonta ajatella
erehtyvänsä sen suhteen.

Puku pysähtyi sulkeakseen oven ja lähestyi sitten vuodetta, jolla


Don Diego lepäsi, ja puvun sisältä ilmestyi Don Diegon kokoinen
hoikka herrasmies. Nähdessään Don Diegon hämmästyneen
katseen herrasmies pidensi askeleitaan.

»Valveilla, vai?» kysyi hän espanjan kielellä.

Makuulla oleva mies tuijotti hänen ruskeisiin, hieman pilkallisiin


kasvoihinsa ymmällään. Hän oli liiaksi hämmästynyt voidakseen
vastata.

Vieraan sormet koskettivat Don Diegon takaraivoa, jolloin hän


tuskasta kiemurrellen parahti pahasti.

»Hellä, vai?» virkkoi vieras. Hän otti Don Diegon ranteen


etusormensa ja peukalonsa väliin ja silloin vasta Don Diego sai
puhjetuksi puhumaan.

»Oletteko lääkäri?» kysyi hän.

»Sitäkin muun ohessa.» Tumma herrasmies jatkoi potilaansa


valtimon tutkimista. »Vankka ja säännöllinen», ilmoitti hän vihdoin ja
irrotti otteensa ranteesta. »Teille ei ole tullut mitään vaurioita.»

Don Diego ponnistautui istumaan punaiselle samettivaatteelle.


»Kuka piru te olette?» kysyi hän. »Ja mitä pirua teillä on tekemistä
minun puvussani ja minun laivallani?»

Vieraan kulmakarvat kohosivat korkealle ja hänen leveä suunsa


vetäytyi heikkoon ivahymyyn.

»Pelkäänpä että houritte vielä. Tämä ei ole teidän laivanne. Tämä


on minun laivani ja vaatteet ovat myös minun.»

»Teidän laivanne?» kertasi toinen ihmeissään, ja yhä enemmän


ihmeissään hän lisäsi: »Ja teidän vaatteenne? Mutta… tottahan…»
Hurjina vilkuivat hänen silmänsä ympäri kajuutan. Hän tutki sen
uudelleen tarkaten jokaista tuttua esinettä. »Olenko minä hullu?»
kysyi hän vihdoin. »Varmastihan tämä laiva on Cinco Llagas?»

»Kyllä se on Cinco Llagas.»

»Siinä tapauksessa…» Espanjalainen vaikeni. Hänen katseensa


kävi murheelliseksi. »Valga me Dios!» huudahti hän kuin
tuskissaan-. »Aiotteko sanoa minulle myös, että olette Don Diego de
Espinosa?»

»Enhän toki, minun nimeni on Blood, kapteeni Blood, ja laiva,


kuten tämä kaunis vaatekertakin on sotasaalistani. Ja te, Don Diego,
olette vankini.»

Vaikka vastaus olikin hämmästyttävä, tuntui se kuitenkin Don


Diegosta lohduttavalta siihen nähden, mitä hän oli alkanut pelätä.

»Mutta… ettekö sitten ole espanjalainen?»

»Te imartelette minua kastilialaisen puhetapani vuoksi. Minulla on


kunnia olla irlantilainen. Te arvatenkin luulitte, että oli tapahtunut
ihme. Niin onkin asian laita. Ihme, jonka minun kekseliäisyyteni, joka
ei suinkaan ole halveksittava, on aikaansaanut.»

Lyhyesti kapteeni sitten paljasti salaisuuden kertomalla, mitä oli


tapahtunut. Se oli kertomus, joka sai espanjalaisen vuoroin
punastumaan ja vuoroin kalpenemaan. Hän tunnusteli takaraivoaan
ja tapasi siellä vahvistuksen kertomuksen todenperäisyydelle
kananmunan kokoisen kuhmun muodossa. Vihdoin hän katsahti
hätääntyneenä pilkallista kapteeni Bloodia ja huudahti:

»Entä poikani? Missä poikani on? Hän oli samassa veneessä, joka
toi minut laivalle!»

»Poikanne on turvassa. Hän ja veneen miehistö sekä teidän


tykkimiehenne tovereineen ovat varsin mukavasti raudoissa kannen
alla.» Don Diego vaipui takaisin vuoteelle ja hänen kiiltävän mustat
silmänsä tuijottivat yläpuolella oleviin ruskeisiin kasvoihin. Hän hillitsi
itsensä. Hänellä oli täysi annos sitä mielentyyneyttä, jota hänen hurja
ammattinsa vaati. Onnen pyörä oli kierähtänyt hänelle vastaiseksi
viime yrityksessä. Aivan voiton hetki oli kääntynyt hänelle tappioksi.
Hän otti vastaan kohtalonsa stoalaisen tyyneydellä. Äärimmäisen
välinpitämättömänä kysyi hän sitten:

»Entä nyt, señor kapteeni?»

»Nyt», sanoi kapteeni Blood — antaaksemme hänelle sen


arvonimen, jonka hän itselleen oli omaksunut — »koska olen
helläsydäminen mies, valitan, ettette kuollut siitä napsauksesta,
jonka annoimme teille. Sillä se tietää sitä, että teidän täytyy
vaivautua koettamaan kuolla uudelleen.»
»Ah!» Don Diego vetäisi syvään henkeään. »Mutta onko se
välttämätöntä?» kysyi hän ilman nähtävää levottomuutta.

Kapteeni Bloodin katse hyväksyi hänen käyttäytymisensä.

»Kysykää itseltänne», sanoi hän, »sanokaahan minulle, mitä te


itse kokeneena ja verentahrimana merirosvona tekisitte.»

»Mutta siinä asiassahan on ero.» Don Diego nousi istualleen


miettiäkseen asiaa. »Ero on siinä, että te kehutte olevanne
helläsydäminen mies.»

Kapteeni Blood istahti pitkän tammisen pöydän nurkalle. »Mutta


minä en ole mikään hölmö», vastasi hän, »enkä salli että
luonteenomainen irlantilainen hentomielisyyteni estää minua
tekemästä sitä, mikä on välttämätöntä ja viisasta. Te ja teidän
kymmenen eloonjäänyttä roistoanne olette alituisena uhkana tällä
laivalla. Sitä paitsi vettä ja muonaa ei ole liian paljon laivalla. Tosin
on meitä onneksi pieni joukko, mutta te ja teidän miehenne lisäävät
sitä sangen sopimattomalla tavalla. Joten siis huomaatte, että järki
kehoittaa meitä joka suhteessa kieltäytymään seuranne tarjoamasta
hauskuudesta ja kovettaen hellät sydämemme pyytää mitä
kohteliaimmin teitä astumaan laidan yli.»

»Ymmärrän», virkkoi espanjalainen miettiväisenä. Hän heilautti


säärensä vuoteesta ja istui nyt sen reunalla nojaten kyynärpäitään
polviin. Hän oli päässyt selville vastustajastaan ja kohteli häntä nyt
yhtä pilkallisen kohteliaasti ja mairittelevan sydämellisesti kuin
tämäkin häntä. »Myönnän, että puheessanne on paljonkin perää.»

»Vapautatte minut suunnattomasta taakasta», vastasi kapteeni


Blood. »En tahtoisi esiintyä tarpeettoman ankarana, varsinkin kun
minä ja toverini olemme niin erinomaisen paljosta suuressa
kiitollisuuden velassa teille. Sillä mitä se lieneekin merkinnyt muille,
teidän ryöstöretkenne Barbados-saarelle sattui meille erittäin
otolliseen aikaan. Olen sen vuoksi iloinen havaitessani, että olette
yhtä mieltä kanssani siinä, ettei muuta mahdollisuutta ole
olemassa.»

»Mutta, ystäväni, niin paljoa en ole myöntänyt.»

»Jos teillä on jokin muu hyväksyttävä ehdotus, niin olen erittäin


onnellinen saadessani kuulla sen.»

Don Diego siveli mustaa pujopartaansa.

»Voitteko antaa minulle miettimisaikaa huomiseen? Päätäni


särkee niin kirotusti, että ajatteleminen on miltei mahdotonta. Ja
myöntänette sen, että asia vaatii vakavaa harkintaa.»

Kapteeni Blood nousi seisomaan. Takanaan olevalta hyllyltä hän


otti puolentunnin lasin, käänsi sen niin, että ruskeaa hiekkaa
sisältävä puolikas oli ylöspäin, ja asetti sen pöydälle.

»Olen pahoillani, että minun täytyy kiirehtiä tässä asiassa, Don


Diego, mutta tuo on kaikki mitä voin teille myöntää. Ellette sen
jälkeen kun tuo hiekka on valunut loppuun, voi ehdottaa mitään
hyväksyttävää tapaa, niin olen, vaikkakin äärimmäisen
vastenmielisesti, velvollinen kehoittamaan teitä ystävinenne
astumaan laidan yli.»

Kapteeni Blood kumarsi ja mentyään ulos lukitsi oven jälkeensä.

Polviinsa nojaten ja kädet poskilla istui Don Diego ja katseli,


kuinka hiekka valui ylemmästä puolikkaasta alempaan. Ja mitä
kauemmin hän sitä katseli, sitä syvemmäksi kävivät rypyt hänen
ruskeilla kasvoillaan.

Täsmälleen silloin, kun viimeiset hiekkajyvät valahtivat reiästä,


avautui ovi jälleen.

Espanjalainen huokasi syvään ja kohottautui antaakseen


vastauksen, jota kapteeni Blood oli tullut kuulemaan.

»Olen miettinyt erästä keinoa, herra kapteeni, mutta se riippuu


teidän ihmisystävällisyydestänne. Te jätätte meidät jollekin tämän
ruton saastuttaman saariryhmän saarelle oman kohtalomme
heiteltäviksi.»

Kapteeni Blood mutristi huuliaan.

»Asialla on vaikeutensa», sanoi hän hitaasti.

»Pelkäsin sitä.» Don Diego huokaisi taas ja nousi seisomaan.


»Älkäämme sitten puhuko siitä sen enempää.»

Vaaleansiniset silmät tarkkasivat häntä kuin teräsvasamat.

»Eihän teitä pelottane kuolema, Don Diego?»

Espanjalainen nosti päätään ylpeästi ja hänen kulmansa


vetäytyivät ryppyyn.

»Kysymyksenne on loukkaava, sir.»

»Asetan siinä tapauksessa kysymyksen toisin — ehkäpä hieman


onnistuneemmassa muodossa. Tahdotte tietenkin mielellänne
elää?»
»Ah, siihen voin vastata. Haluan elää ja vielä hartaammin haluan,
että poikani eläisi. Mutta elämänhaluni ei ole tekevä minua pelkuriksi
teidän iloksenne, herra mestari-ivaaja.» Se oli ensimmäinen kerta,
jolloin hän osoitti merkkiäkään suuttumuksesta tai kiivastumisesta.

Kapteeni Blood ei vastannut heti. Kuten aikaisemminkin istuutui


hän taas pöydän kulmalle.

»Olisitteko halukas ansaitsemaan elämän ja vapauden omasta,


poikanne ja tovereittenne puolesta?»

»Ansaitsemaan?» sanoi Don Diego, eikä vaaleansinisiltä


terässilmiltä jäänyt huomaamatta vavahdus, joka kulki espanjalaisen
ruumiin läpi. »Ansaitsemaan, sanoitte? Miksipä ei, ellei ehdotus,
jonka aiotte tehdä, käy kunnialleni.»

»Sellainen ei puoleltani saata tulla kysymykseenkään», vakuutti


kapteeni Blood. »Ymmärrän, että merirosvollakin saattaa olla
kunniantuntoa.» Ja sitten hän esitti ehdotuksensa. »Jos katsotte
ikkunasta, Don Diego, niin näette jotakin, joka muistuttaa pilven
hattaraa taivaan reunassa. Se on Barbados-saari, joka on suoraan
takanamme. Koko päivän olemme purjehtineet itää kohti vain
yhdestä syystä — päästäksemme Barbados-saaresta niin kauaksi
kuin suinkin. Mutta nyt kun emme enää näe maata, alkavat
vaikeudet. Ainoa mies joukossamme, joka on saanut koulutusta
merenkulussa, on kuumeessa — niin, sen pahoinpitelyn johdosta,
jonka alaiseksi hän oli joutunut juuri ennen kuin toimme hänet
mukanamme laivaan. Osaan itse hoitaa kulussa olevaa alusta ja
laivassa on pari kolme miestä, jotka pystyvät minua siinä auttamaan,
mutta merimiestaidon korkeampia salaisuuksia ja taitoa löytää
suunta tiettömällä ulapalla emme tunne ensinkään. Käsitätte
helposti, että maihinmeno tai summittainen purjehtiminen tässä —
kuten niin sattuvasti sanoitte — rutonsaastuttamassa saaristossa
saattaisi käydä meille kohtalokkaaksi. Ja niinpä päädymme
seuraavaan. Haluamme päästä Curacaoon, hollantilaiseen
siirtomaahan niin suoraan kuin mahdollista. Annatteko
kunniasananne siitä, että viette meidät sinne, jos annan teille
vapautenne jälleen? Ja jos teette sen, olen laskeva teidät ja
jäljelläolevan miehistönne vapauteen saavuttuamme sinne.»

Don Diegon pää vaipui rintaa vasten ja hän astui miettiväisenä


perässä olevan ikkunan luo. Siinä hän seisoi katsellen
auringonpaisteista ulappaa ja suuren aluksen tyyntä vanavettä —
hänen oman aluksensa, jonka nämä englantilaiset koirat olivat
häneltä ryöstäneet, hänen oman laivansa, jota häntä nyt vaadittiin
kuljettamaan turvalliseen satamaan, jossa hän sen lopullisesti
menettäisi ja josta se ehkä uudistettuna lähtisi taistelemaan hänen
omia maanmiehiään vastaan.

Se oli vaa’an toisessa kupissa. Toisessa painoi kuudentoista


miehen elämä. Neljäntoista elämä ei merkinnyt hänelle paljoakaan,
mutta jäljellä olevien kahden kohtalo koski häntä itseään ja hänen
poikaansa.

Hän kääntyi vihdoin, ja koska hänen selkänsä oli valoon päin, ei


kapteeni Blood saattanut nähdä kuinka kalpeaksi hän oli käynyt.

»Hyväksyn», sanoi espanjalainen.

Yhdestoista luku

POJAN USKOLLISUUTTA
Kunniasanansa perusteella sai Don Diego de Espinosa nauttia
täydellistä vapautta entisellä laivallaan, ja laivan ohjaus, jonka hän
oli lupautunut suorittamaan, oli kokonaan hänen käsissään. Ja siitä
syystä, että laivan miehistö oli kokonaan outo espanjalaisten valta-
alueiden vesillä ja myös sen vuoksi, että Bridgetownin aikaiset
tapahtumat eivät vielä olleet kylliksi opettaneet sitä pitämään jokaista
espanjalaista petollisena, verenhimoisena koirana, joka tavattaessa
oli lyötävä kuoliaaksi, se kohteli häntä samanlaisella ystävyydellä
mitä hänen oma hieno maailmanmiehen käytöksensä oli omiaan
herättämään. Hän söi ateriansa suurhytissä Bloodin ja kolmen hänen
avukseen valitun upseerin, Hagthorpen, Wolverstonen ja Dyken
seurassa.

He havaitsivat Don Diegon miellyttäväksi, jopa hupaiseksi


toveriksi, ja hänen urhea käytöksensä ja mielenmalttinsa
vastoinkäymisen hetkellä lisäsivät yhä sitä ystävällistä mielialaa, jota
he häntä kohtaan tunsivat.

Oli mahdotonta epäillä Don Diegoa epärehellisestä pelistä. Sitä


paitsi ei saattanut havaita mitään järjellistä syytä siihen. Hän oli ollut
äärimmäisen suora heitä kohtaan. Hän oli ilmoittanut heille, että he
olivat tehneet pahan erehdyksen purjehtiessaan suoraan
myötätuuleen lähtiessään Barbados-saarelta. Heidän olisi tullut
purjehtia saaresta alahankaan Karibian merelle ja pois saaristosta.
Nyt oli heidän purjehdittava uudelleen saariston läpi päästäkseen
Curacaoon, eikä reitti suinkaan ollut heille vaaraton. Missä tahansa
saarien välissä saattoivat he tavata joko tasaväkisen tai
voimakkaamman aluksen ja olipa se espanjalainen tai
englantilainen, oli asia heille yhtä paha, sillä miehistön ollessa liian
pieni ei heidän käynyt antautuminen taisteluun. Vähentääkseen
vaaran mahdollisimman pieneksi hän ohjasi sen vuoksi laivan ensin
etelään ja sitten länteen ja pääsi siten Tobago- ja Grenada-saarten
välistä vaarallisen alueen ulkopuolelle ja tuli Karibian meren verraten
turvallisille vesille.

»Jos tätä tuulta jatkuu», puhui hän heille sinä iltana


illallispöydässä selitettyään heille sitä ennen laivan aseman, »niin
pääsemme Curacaoon kolmessa päivässä.» Tuuli pysyi samana
kolme päivää, vieläpä kiihtyikin toisena, mutta sittenkään ei
kolmannen päivän ehtoona näkynyt merkkiäkään maasta. Cinco
Llagas kynti yhä merta, jota rajoitti vain taivaan sini. Kapteeni Blood
huomautti siitä levottomana Don Diegolle.

»Huomisaamuna se tapahtuu», vastasi Don Diego rauhallisen


varmasti.

»Taivaan pyhien nimessä, te espanjalaiset puhutte aina


huomisaamusta, mutta huomisaamu ei koskaan koita, ystäväni.»

»Mutta tällä kerralla se tulee, olkaa huoleti siitä. Vaikka nousisitte


kuinka aikaiseen hyvänsä katsomaan, niin olette näkevä maata, Don
Pedro.»

Kapteeni Blood jatkoi tyytyväisenä matkaansa ja meni katsomaan


Jerry Pittiä, potilastaan, jonka tilaa Don Diego sai kiittää
pelastumisensa mahdollisuudesta. Hän oli nyt ollut neljäkolmatta
tuntia vapaa kuumeesta ja Peter Bloodin taitavassa hoidossa alkoi
hänen silvottu selkänsä vähitellen tyydyttävästi parantua. Hän oli jo
siinä määrin parantunut, että valitti sitä, kun täytyi pysytellä
kuumassa ja ahtaassa hytissä. Ollakseen hänelle mieliksi salli
kapteeni Blood hänen hieman hengittää raitista ilmaa laivan
kannella, ja niinpä kun viimeiset päivän säteet vetäytyivät taivaalta,
tuli Jeremias Pitt kapteenin tukemana ulkoilmaan.
Istuen luukun reunuksella täytti somersetshireläinen nuori mies
kiitollisena keuhkonsa raikkaalla yöilmalla ja tunsi virkistyvänsä siitä.
Sitten hänen merimiesvaistonsa pakotti häntä katselemaan
tummana kaartuvaa taivasta, jolla jo kiilui myriadeja kultaloisteisia
tähtiä. Hetken hän katseli sitä ikään kuin sivumennen,
välinpitämättömänä, mutta sitten hänen katseensa äkkiä kiintyi
yhteen kohtaan. Hän katsahti ympärilleen ja sitten kapteeni Bloodiin,
joka seisoi hänen vieressään.

»Tiedätkö mitään tähtitieteestä, Peter?» kysyi hän.

»Tähtitieteestä? Totisesti en osaisi erottaa Orionia Venuksesta.»

»Ah! Ja luulenpa, että jokainen tästä hölmömäisestä miehistöstä


on yhtä tietämätön kuin sinäkin.»

»Olisi ystävällisempää sanoa, että he tietävät siitä vielä


vähemmän.»

Jeremias osoitti erästä valoisaa paikkaa taivaalla ylähangan


puolella.
»Tuo on pohjantähti», sanoi hän.

»Niinkö? Kumma kun osaat löytää sen noiden muiden joukosta.»

»Ja pohjantähti miltei keulan kohdalla ylähangan puolella tietää


sitä, että purjehdimme pohjoiseen, luoteeseen tai sillä välillä, sillä en
usko, että olemme enempää kuin kymmenkunta astetta läntistä
pituutta.»

»Kuinka niin?» ihmetteli Peter Blood.


»Sinähän kerroit, eikö niin, että tulimme saariston länsipuolta
Tobago- ja Grenada-saarten lomitse Curacaota kohti. Jos me nytkin
noudattaisimme samaa suuntaa, niin pohjantähden pitäisi olla tuolla
takanamme.»

Silmänräpäyksessä Bloodista kaikkosi rauhallisuus. Hän oikein


jäykistyi epäluulosta ja oli juuri sanomaisillaan jotakin, kun pimeässä
heidän yläpuolellaan välähti valojuova, joka oli peräisin parhaillaan
aukenevasta peräkajuutan ovesta. Ovi sulkeutui jälleen ja kohta
kuului askeleita kajuutan portaista. Don Diego lähestyi. Kapteeni
Blood puristi sormillaan merkitsevästi Jerryn olkapäätä. Sitten hän
huusi Don Diegolle puhuen englannin kieltä, jonka hän oli ottanut
tavakseen, kun toisia oli läsnä.

»Tahdotteko ratkaista pienen erimielisyyden, joka on syntynyt


välillämme, Don Diego?» sanoi hän leikkisästi. »Me emme oikein ole
yhtä mieltä siitä, mikä on pohjantähti.»

»Vai niin?» espanjalaisen ääni oli rauhallinen. Siinä oli ikään kuin
rahtunen naurua, ja syy siihen selvisi hänen seuraavasta
lauseestaan. »Mutta tehän kerroitte minulle, että herra Pitt oli teidän
laivurinne?»

»Paremman puutteessa», nauroi kapteeni hyväntahtoisen


ylenkatseellisesti. »Olen valmis lyömään vetoa hänen kanssaan
siitä, että tuo on pohjantähti.» Ja hän osoitti kädellään taivasta kohti
perään päin. Hän kertoi jälkeenpäin, että jos hän olisi saanut Don
Diegolta myöntävän vastauksen, niin hän olisi heti lävistänyt hänet
miekallaan. Mutta espanjalainen päinvastoin osoitti selvästi
halveksumistaan.
»Te olette yhtä varma asiastanne kuin tietämätönkin, Don Petro, ja
te hävisitte. Pohjantähti on tuolla.» Ja hän osoitti sitä kohden.

»Oletteko varma asiasta?»

»Mutta rakas Don Pedro!» Espanjalaisen äänessä kaikui iloisen


vastalauseen tuntu. »Voiko olla mahdollista, että erehdyin? Onhan
tuolla kompassi. Tulkaa kompassikoppiin, niin näette mihin suuntaan
olemme menossa.»

Hänen äärimmäinen suoruutensa ja rauhallisuutensa, jolla ei ollut


mitään salattavaa, poisti heti epäilyksen, joka niin äkkiä oli
juolahtanut kapteeni Bloodin mieleen. Mutta Pitt ei ollut niin vähällä
tyydytetty.

»Siinä tapauksessa, Don Diego, olisi hauska kuulla, miksi


kuljemme siihen suuntaan, jos kerran olemme matkalla Curacaoon»,
sanoi hän.

Taaskaan ei Don Diego näyttänyt vähintäkään epäröivän.

»Teillä on täysi syy kysyä sitä», vastasi hän ja huokasi. »Olin


toivonut, ettei sitä huomattaisi. Olen ollut huolimaton — ah,
rangaistavan huolimaton. Laiminlöin huomioidenteon. Se on aina
ollut tapani. Olen itsestäni liian varma. Luotan liian paljon lokikirjan
mukaan tehtyihin laskelmiin, ja tänä päivänä, kun vihdoin otin esille
kvadrantin, huomasin että olimmekin tulleet puoli astetta liiaksi
etelään, jotenka Curacao on nyt suoraan pohjoiseen. Siinä syy
viivytykseemme. Mutta me olemme siellä huomisaamuna.»

Selitys oli niin täydelleen tyydyttävä ja tuli niin rehellisesti ja


valmiisti, että oli mahdotonta uskoa, että Don Diego olisi aikonut
pettää sanansa. Ja kun Don Diego taas oli poistunut, tunnusti
kapteeni Blood Pittille, että oli tyhmää epäillä häntä. Olkoon hänen
entisyytensä millainen tahansa, niin hän oli näyttänyt mitä miehiä
hän oli ilmoittaessaan, että hän ennemmin kuolisi kuin ryhtyisi
mihinkään, mikä saattaisi vahingoittaa hänen kunniaansa tai
isänmaataan.

Espanjan valtavedet ja niillä purjehtivien seikkailijain metkut olivat


kapteeni Blondille outoja, joten hänellä vielä oli harhaluulonsa. Mutta
seuraava aamunkoitto oli haihduttava ne rajusti ja ainiaksi.

Tullessaan kannelle jo ennen auringon nousua hän näki edessään


maata, kuten Don Diego oli illalla luvannut. Se oli noin kymmenen
mailin päässä heistä, pitkä idästä länteen kulkeva rannikko, ja siitä
pisti kallioinen niemeke aivan heitä kohti. Nähdessään sen hän
rypisti otsaansa. Hän ei ollut havainnut, että Curacao olisi niin laaja.
Toden teolla näytti maa pikemminkin mantereita kuin saarelta.

Ylähangan puolella heistä hän huomasi maalta puhaltavan heikon


tuulen tuomana suuren laivan, joka hänen arvionsa mukaan oli
suunnilleen yhtä kookas kuin heidän omansakin. Hänen
katsoessaan sitä se muutti äkkiä suuntaansa ja tuli nyt suoraan heitä
kohti.

Tusinan verran hänen miehiään liikuskeli jo etukannella


innokkaasti tähystäen tulokasta ja heidän äänensä ja naurunsa
kuului selvästi uljaan Cinco Llagsin perään saakka.

»Tuolla», virkkoi pehmeä ääni sulavalla espanjan kielellä hänen


takanaan, »on luvattu maa, Don Pedro.»
Äänessä oli jonkinlaista salaperäistä voitonriemua, joka sai
kapteeni Bloodin epäluulon uudelleen heräämään eloon. Hän kääntyi
äkkiä Don Diegoon päin, niin äkkiä, että viekas hymy tämän huulilta
ei kerinnyt kadota ennen kuin kapteeni Bloodin katse tutkivana osui
hänen kasvoihinsa.

»Se näkyy tuottavan teille outoa tyydytystä olosuhteista


huolimatta», sanoi kapteeni Blood.

»Luonnollisesti.» Espanjalainen hieroi kämmeniään yhteen, ja


herra Blood huomasi, että liike oli hieman epävarma. »Tyydytystä,
jota merimies tuntee.»

»Tai jota petturi tuntee — vai?» kysyi Blood tyynesti. Ja kun


espanjalainen astui askelen taaksepäin ja hänen hahmonsa äkkiä
muuttui, oli Blood varma siitä, että hänen epäluulonsa oli oikeutettu.
Hän ojensi kätensä maata kohden ja kysyi ankarasti: »Mikä maa tuo
on? Rohkenetteko väittää, että se on Curacaon rantaa?»

Hän astui Don Diegoa kohti ja askel askelelta väistyi tämä


taaksepäin. »Sanonko teille, mikä maa se on? Sanonko?» Hänen
varmuutensa näytti häikäisevän ja hämmästyttävän espanjalaista,
sillä vastausta ei kuulunut. Silloin veti herra Blood uhkarohkean
vedon — vaikkei aivan uhkarohkeaa kuitenkaan. Hän tiesi, että niin
pitkää rantaviivaa ei voinut olla muualla kuin joko mantereita tai
sitten Kuballa tai Hispaniolalla. Mannerta se ei voinut olla, sen hän
myös tiesi. Koska hän tiesi, että Kuba oli kauempana pohjoisessa ja
lännessä kuin Hispaniola, seurasi siitä, päätteli hän nopeasti
itsekseen, että jos Don Diego aikoi pettää hänet, niin hän oli
ohjannut laivan lähintä espanjalaista aluetta kohti. »Tuo maa, senkin
petollinen, valapatto espanjalainen koira, on Hispaniolan saari.»
Sen sanottuaan hän piti tarkasti silmällä kalpenevaa espanjalaista
nähdäkseen, oliko hän osannut oikeaan. Mutta nyt oli väistelevä Don
Diego jo tullut keskiväliin peräkantta, jossa peräpurje esti heitä
näkymästä sinne missä muut englantilaiset olivat. Hänen huulensa
vääntyivät rumaan hymyyn.

»Ah, perro inglés! Sinä tiedät liian paljon», sanoi hän matalalla
äänellä ja syöksyi kapteenin kurkkuun kiinni.

Kiinteästi toisiinsa kiertyneinä he huojuivat hetken puoleen ja


toiseen, kunnes yhdessä kaatuivat kannelle, jolloin Don Diego
kapteenin kamppaamana jäi alle. Espanjalainen oli luottanut tukeviin
voimiinsa. Mutta ne osoittautuivat riittämättömiksi irlantilaisen
teräksisessä otteessa, joka äskeisessä orjuudessa oli yhä
vahvistunut. Espanjalainen oli luottanut siihen, että hän kuristamalla
Bloodin voittaisi sen puolituntisen, minkä laivan ehtiminen heidän
luokseen mahdollisesti vaatisi. Hän oli varma siitä, että alus oli
espanjalainen, sillä mikään muu laiva ei olisi niin rohkeasti luovaillut
Hispaniolan vesillä. Mutta kaikki hänen aikaansaannoksensa
kääntyivät hänelle pettymykseksi ja päälle päätteeksi aivan
hyödyttömiksi. Sen hän tajusi maatessaan selällään ja Bloodin
painaessa polvellaan hänen rintaansa, samalla kun miehet
kapteeninsa kutsumina riensivät kolistellen paikalle.

»Joko minä nyt tässä luen rukouksen likaisen sielusi puolesta?»


pilkkasi Blood vankiaan raivoissaan.

Mutta vaikka espanjalainen olikin menettänyt kaikki pelastumisen


toiveensa, pakotti hän huulensa hymyyn ja vastasi pilkalla pilkkaan:

»Onpa hauska nähdä, kuka sinun sielusi puolesta rukoilee, kun


tuo sotalaiva on kupeellasi.»
»Tuo sotalaiva!» huudahti kapteeni Blood aavistaen, että oli jo liian
myöhäistä välttää Don Diegon petoksen seurauksia.

»Tuo laiva», vastasi Don Diego yhä pilkallisemmin. »Tiedättekö,


mikä se on? Minäpä sanon sen teille. Se on Encarnacion, Don
Miguel de Espinosan, Kastilian pääamiraalin lippulaiva, ja Don
Miguel on minun veljeni. Tapaamisemme on erinomaisen onnellinen
asia. Se osoittaa, että kaikkivaltias johtaa katolisen Espanjan
kohtaloita.»

Kapteeni Bloodissa ei näkynyt jälkeäkään leikinlaskusta eikä


kohteliaisuudesta. Hänen vaaleat silmänsä leimahtivat ja hänen
kasvonsa jäykistyivät.

Hän nousi ja jätti espanjalaisen miestensä haltuun. »Sitokaa


hänet», käski hän. »Sitokaa hänet nilkoista ja ranteista, mutta älkää
vahingoittako häntä — ei hiuskarvaakaan hänen kallisarvoisesta
päästään.»

Huomautus oli hyvinkin tarpeellinen. Sillä hurjistuneina siitä


mahdollisuudesta, että he nyt joutuisivat vaihtamaan orjuutensa,
josta juuri olivat päässeet, vielä pahempaan, olisivat miehet repineet
espanjalaisen kappaleiksi siinä paikassa. Ja kun he nyt tottelivat
kapteeniaan ja pidättäytyivät siitä, niin se tapahtui vain sen vuoksi,
että he hänen muuttuneessa äänensävyssään havaitsivat lupauksen
jostakin vielä paremmasta Don Diegolle kuin kuolema.

»Senkin kurjimus, saastainen merirosvo! Kunnian mies!» puhutteli


kapteeni Blood vankiaan.

Mutta Don Diego katsahti häneen ja nauroi.


»Te arvioitte minut liian mitättömäksi.» Hän puhui englantia, jotta
kaikki ymmärtäisivät mitä hän sanoi. »Sanoin teille, että en pelkää
kuolemaa ja olen sen nyt näyttänyt toteen. Ettekö käsitä,
englantilainen koira?»

»Irlantilainen, jos suvaitsette», korjasi kapteeni Blood. »Entäs


teidän kunniasananne, espanjalainen roisto!»

»Luulitteko minun antavan teille kunniasanaani, jotta tämä komea,


kaunis espanjalainen laiva jäisi teidän roistojen käsiin, ehkäpä vielä
käydäkseen sotaa toisia espanjalaisia vastaan. Ha, ha», Don Diego
nauroi syvää kurkkunauruaan. »Te hölmöt! Voitte tappaa minut. Pyh!
Mitäpä siitä. Kuolen täytettyäni tehtäväni hyvin. Vähemmän kuin
tunnin kuluttua olette espanjalaisten vankeina ja Cinco Llagas joutuu
taas Espanjalle.»

Kapteeni Bloodin ruskettuneet kasvot kävivät kalpeiksi hänen


katsellessaan espanjalaista tarkkaavasti. Vangin ympärillä
tungeksivat entiset orjat meluten, raivoten ja suorastaan
kirjaimellisesti »janoten verta».

»Odottakaa», komensi kapteeni Blood käskevästi, kääntyi


kantapäillään ja meni reelingin ääreen. Hänen seisoessaan siellä
syvissä mietteissä yhtyivät häneen Hagthorpe, Wolverstone ja Ogle,
tykkimies. Ääneti he katselivat veden poikki vastaantulevaa laivaa.
Se oli kääntynyt yhden viivan alatuuleen ja kulki nyt suuntaa, jossa
sen lopulta täytyi yhtyä Cinco Llagsiin.

»Vähemmässä kuin puolessa tunnissa», virkkoi nyt kapteeni


Blood, »on se kohdallamme ja pyyhkäisee kantemme puhtaaksi
tykeillään.»
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookluna.com

You might also like