100% found this document useful (1 vote)
80 views52 pages

Immediate download Applied Analytics through Case Studies Using SAS and R: Implementing Predictive Models and Machine Learning Techniques Deepti Gupta ebooks 2024

through

Uploaded by

joesolina
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 (1 vote)
80 views52 pages

Immediate download Applied Analytics through Case Studies Using SAS and R: Implementing Predictive Models and Machine Learning Techniques Deepti Gupta ebooks 2024

through

Uploaded by

joesolina
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/ 52

Download the full version of the textbook now at textbookfull.

com

Applied Analytics through Case Studies Using


SAS and R: Implementing Predictive Models and
Machine Learning Techniques Deepti Gupta

https://textbookfull.com/product/applied-
analytics-through-case-studies-using-sas-and-r-
implementing-predictive-models-and-machine-
learning-techniques-deepti-gupta/

Explore and download more textbook at https://textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Machine Learning with R Cookbook Second Edition Analyze


data and build predictive models Bhatia

https://textbookfull.com/product/machine-learning-with-r-cookbook-
second-edition-analyze-data-and-build-predictive-models-bhatia/

textbookfull.com

Predictive Analytics with Microsoft Azure Machine Learning


Barga

https://textbookfull.com/product/predictive-analytics-with-microsoft-
azure-machine-learning-barga/

textbookfull.com

Introduction to Deep Learning Using R: A Step-by-Step


Guide to Learning and Implementing Deep Learning Models
Using R Taweh Beysolow Ii
https://textbookfull.com/product/introduction-to-deep-learning-using-
r-a-step-by-step-guide-to-learning-and-implementing-deep-learning-
models-using-r-taweh-beysolow-ii/
textbookfull.com

Invest in ASEAN Countries Analysis and Treaties Lorenzo


Riccardi

https://textbookfull.com/product/invest-in-asean-countries-analysis-
and-treaties-lorenzo-riccardi/

textbookfull.com
Public Health Mini Guides Obesity 1 Pap/Psc Edition Nick
Townsend And Angela Scriven (Eds.)

https://textbookfull.com/product/public-health-mini-guides-
obesity-1-pap-psc-edition-nick-townsend-and-angela-scriven-eds/

textbookfull.com

New York School of Interior Design Home Ellen S. Fisher

https://textbookfull.com/product/new-york-school-of-interior-design-
home-ellen-s-fisher/

textbookfull.com

Key to the New World A History of Early Colonial Cuba Luis


Martínez-Fernández

https://textbookfull.com/product/key-to-the-new-world-a-history-of-
early-colonial-cuba-luis-martinez-fernandez/

textbookfull.com

Frontiers in Computer Education Proceedings of the 2nd


International Conference on Frontiers in Computer
Education ICFCE 2014 Wuhan China December 24 25 2014 1st
Edition Yuanzhi Wang (Editor)
https://textbookfull.com/product/frontiers-in-computer-education-
proceedings-of-the-2nd-international-conference-on-frontiers-in-
computer-education-icfce-2014-wuhan-china-december-24-25-2014-1st-
edition-yuanzhi-wang-editor/
textbookfull.com

Kantian Perspectives on Issues in Ethics and Bioethics 1st


Edition Lina Papadaki

https://textbookfull.com/product/kantian-perspectives-on-issues-in-
ethics-and-bioethics-1st-edition-lina-papadaki/

textbookfull.com
The Miniature Guide to Critical Thinking Concepts and
Tools 8th Edition Richard Paul

https://textbookfull.com/product/the-miniature-guide-to-critical-
thinking-concepts-and-tools-8th-edition-richard-paul/

textbookfull.com
Applied Analytics
through Case Studies
Using SAS and R
Implementing Predictive Models and
Machine Learning Techniques

Deepti Gupta
Applied Analytics
through Case Studies
Using SAS and R
Implementing Predictive Models
and Machine Learning Techniques

Deepti Gupta
Applied Analytics through Case Studies Using SAS and R
Deepti Gupta
Boston, Massachusetts, USA

ISBN-13 (pbk): 978-1-4842-3524-9      ISBN-13 (electronic): 978-1-4842-3525-6


https://doi.org/10.1007/978-1-4842-3525-6
Library of Congress Control Number: 2018952360
Copyright © 2018 by Deepti Gupta
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the
material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation,
broadcasting, reproduction on microfilms or in any other physical way, and transmission or information
storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now
known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with
every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not
identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to
proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication,
neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or
omissions that may be made. The publisher makes no warranty, express or implied, with respect to the
material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Celestin John
Development Editor: James Markham
Coordinating Editor: Divya Modi
Cover designed by eStudioCalamar
Cover image designed by Freepik (www.freepik.com)
Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street,
6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-
sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member
(owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a
Delaware corporation.
For information on translations, please e-mail [email protected], or visit http://www.apress.com/
rights-permissions.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and
licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales
web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is available to
readers on GitHub via the book's product page, located at www.apress.com/978-1-4842-3524-9. For more
detailed information, please visit http://www.apress.com/source-code.
Printed on acid-free paper
I am dedicating this book to my Family.
Table of Contents
About the Author����������������������������������������������������������������������������������������������������� xi

About the Contributor�������������������������������������������������������������������������������������������� xiii


About the Technical Reviewer���������������������������������������������������������������������������������xv

Acknowledgments�������������������������������������������������������������������������������������������������xvii

Introduction������������������������������������������������������������������������������������������������������������xix

Chapter 1: Data Analytics and Its Application in Various Industries������������������������ 1


What Is Data Analytics?���������������������������������������������������������������������������������������������������������������� 2
Data Collection������������������������������������������������������������������������������������������������������������������������ 3
Data Preparation���������������������������������������������������������������������������������������������������������������������� 4
Data Analysis��������������������������������������������������������������������������������������������������������������������������� 4
Model Building������������������������������������������������������������������������������������������������������������������������� 5
Results������������������������������������������������������������������������������������������������������������������������������������� 5
Put into Use����������������������������������������������������������������������������������������������������������������������������� 5
Types of Analytics������������������������������������������������������������������������������������������������������������������������� 6
Understanding Data and Its Types������������������������������������������������������������������������������������������������� 7
What Is Big Data Analytics?���������������������������������������������������������������������������������������������������������� 8
Big Data Analytics Challenges����������������������������������������������������������������������������������������������� 10
Data Analytics and Big Data Tools����������������������������������������������������������������������������������������� 11
Role of Analytics in Various Industries����������������������������������������������������������������������������������� 14
Who Are Analytical Competitors?������������������������������������������������������������������������������������������ 18
Key Models and Their Applications in Various Industries������������������������������������������������������������ 18
Summary������������������������������������������������������������������������������������������������������������������������������������ 21
References���������������������������������������������������������������������������������������������������������������������������������� 21

v
Table of Contents

Chapter 2: Banking Case Study������������������������������������������������������������������������������ 27


Applications of Analytics in the Banking Sector������������������������������������������������������������������������� 28
Increasing Revenue by Cross-Selling and Up-Selling����������������������������������������������������������� 29
Minimizing Customer Churn�������������������������������������������������������������������������������������������������� 30
Increase in Customer Acquisition������������������������������������������������������������������������������������������ 30
Predicting Bank-Loan Default������������������������������������������������������������������������������������������������ 31
Predicting Fraudulent Activity����������������������������������������������������������������������������������������������� 32
Case Study: Predicting Bank-Loan Defaults with Logistic Regression Model����������������������������� 34
Logistic Regression Equation������������������������������������������������������������������������������������������������ 35
Odds�������������������������������������������������������������������������������������������������������������������������������������� 36
Logistic Regression Curve����������������������������������������������������������������������������������������������������� 37
Logistic Regression Assumptions������������������������������������������������������������������������������������������ 38
Logistic Regression Model Fitting and Evaluation����������������������������������������������������������������� 39
Statistical Test for Individual Independent Variable in Logistic��������������������������������������������������� 40
Regression Model������������������������������������������������������������������������������������������������������������������ 40
Predictive Value Validation in Logistic Regression Model������������������������������������������������������ 41
Logistic Regression Model Using R��������������������������������������������������������������������������������������������� 46
About Data����������������������������������������������������������������������������������������������������������������������������� 47
Performing Data Exploration������������������������������������������������������������������������������������������������� 47
Model Building and Interpretation of Full Data���������������������������������������������������������������������� 52
Model Building and Interpretation of Training and Testing Data�������������������������������������������� 56
Predictive Value Validation���������������������������������������������������������������������������������������������������� 61
Logistic Regression Model Using SAS���������������������������������������������������������������������������������������� 65
Model Building and Interpretation of Full Data���������������������������������������������������������������������� 74
Summary������������������������������������������������������������������������������������������������������������������������������������ 92
References���������������������������������������������������������������������������������������������������������������������������������� 92

Chapter 3: Retail Case Study���������������������������������������������������������������������������������� 97


Supply Chain in the Retail Industry��������������������������������������������������������������������������������������������� 98
Types of Retail Stores����������������������������������������������������������������������������������������������������������������� 99

vi
Table of Contents

Role of Analytics in the Retail Sector���������������������������������������������������������������������������������������� 100


Customer Engagement�������������������������������������������������������������������������������������������������������� 100
Supply Chain Optimization�������������������������������������������������������������������������������������������������� 101
Price Optimization��������������������������������������������������������������������������������������������������������������� 103
Space Optimization and Assortment Planning��������������������������������������������������������������������� 103
Case Study: Sales Forecasting for Gen Retailers with SARIMA Model�������������������������������������� 105
Overview of ARIMA Model��������������������������������������������������������������������������������������������������� 107
Three Steps of ARIMA Modeling������������������������������������������������������������������������������������������������ 111
Identification Stage������������������������������������������������������������������������������������������������������������� 111
Estimation and Diagnostic Checking Stage������������������������������������������������������������������������� 113
Forecasting Stage���������������������������������������������������������������������������������������������������������������� 114
Seasonal ARIMA Models or SARIMA������������������������������������������������������������������������������������������ 115
Evaluating Predictive Accuracy of Time Series Model�������������������������������������������������������������� 117
Seasonal ARIMA Model Using R������������������������������������������������������������������������������������������������ 118
About Data��������������������������������������������������������������������������������������������������������������������������� 119
Performing Data Exploration for Time Series Data�������������������������������������������������������������� 119
Seasonal ARIMA Model Using SAS�������������������������������������������������������������������������������������������� 133
Summary���������������������������������������������������������������������������������������������������������������������������������� 158
References�������������������������������������������������������������������������������������������������������������������������������� 159

Chapter 4: Telecommunication Case Study���������������������������������������������������������� 161


Types of Telecommunications Networks����������������������������������������������������������������������������������� 162
Role of Analytics in the Telecommunications Industry�������������������������������������������������������������� 163
Predicting Customer Churn������������������������������������������������������������������������������������������������� 163
Network Analysis and Optimization������������������������������������������������������������������������������������� 165
Fraud Detection and Prevention������������������������������������������������������������������������������������������ 166
Price Optimization��������������������������������������������������������������������������������������������������������������� 166
Case Study: Predicting Customer Churn with Decision Tree Model������������������������������������������ 168
Advantages and Limitations of the Decision Tree���������������������������������������������������������������� 169
Handling Missing Values in the Decision Tree��������������������������������������������������������������������� 170

vii
Table of Contents

Handling Model Overfitting in Decision Tree������������������������������������������������������������������������ 170


How the Decision Tree Works���������������������������������������������������������������������������������������������� 171
Measures of Choosing the Best Split Criteria in Decision Tree�������������������������������������������� 172
Decision Tree Model Using R����������������������������������������������������������������������������������������������������� 179
About Data��������������������������������������������������������������������������������������������������������������������������� 179
Performing Data Exploration����������������������������������������������������������������������������������������������� 180
Splitting Data Set into Training and Testing������������������������������������������������������������������������� 183
Model Building & Interpretation on Training and Testing Data��������������������������������������������� 184
Decision Tree Model Using SAS������������������������������������������������������������������������������������������������ 193
Model Building and Interpretation of Full Data�������������������������������������������������������������������� 200
Model Building and Interpretation on Training and Testing Data����������������������������������������� 208
Summary���������������������������������������������������������������������������������������������������������������������������������� 217
References�������������������������������������������������������������������������������������������������������������������������������� 217

Chapter 5: Healthcare Case Study������������������������������������������������������������������������ 221


Application of Analytics in the Healthcare Industry������������������������������������������������������������������ 224
Predicting the Outbreak of Disease and Preventative Management����������������������������������� 225
Predicting the Readmission Rate of the Patients���������������������������������������������������������������� 225
Healthcare Fraud Detection������������������������������������������������������������������������������������������������� 227
Improve Patient Outcomes & Lower Costs�������������������������������������������������������������������������� 228
Case Study: Predicting Probability of Malignant and Benign Breast Cancer with
Random Forest Model��������������������������������������������������������������������������������������������������������������� 230
Working of Random Forest Algorithm���������������������������������������������������������������������������������� 230
Random Forests Model Using R������������������������������������������������������������������������������������������ 238
Random Forests Model Using SAS�������������������������������������������������������������������������������������� 249
Summary���������������������������������������������������������������������������������������������������������������������������������� 271
References�������������������������������������������������������������������������������������������������������������������������������� 271

Chapter 6: Airline Case Study������������������������������������������������������������������������������� 277


Application of Analytics in the Airline Industry�������������������������������������������������������������������������� 280
Personalized Offers and Passenger Experience������������������������������������������������������������������ 281
Safer Flights������������������������������������������������������������������������������������������������������������������������ 282

viii
Table of Contents

Airline Fraud Detection�������������������������������������������������������������������������������������������������������� 283


Predicting Flight Delays������������������������������������������������������������������������������������������������������� 284
Case Study: Predicting Flight Delays with Multiple Linear Regression Model�������������������������� 286
Multiple Linear Regression Equation����������������������������������������������������������������������������������� 287
Multiple Linear Regression Assumptions and Checking for Violation of
Model Assumptions������������������������������������������������������������������������������������������������������������� 287
Variables Selection in Multiple Linear Regression Model���������������������������������������������������� 290
Evaluating the Multiple Linear Regression Model��������������������������������������������������������������� 290
Multiple Linear Regression Model Using R������������������������������������������������������������������������������� 292
About Data��������������������������������������������������������������������������������������������������������������������������� 293
Performing Data Exploration����������������������������������������������������������������������������������������������� 293
Model Building & Interpretation on Training and Testing Data��������������������������������������������� 299
Multiple Linear Regression Model Using SAS��������������������������������������������������������������������������� 311
Summary���������������������������������������������������������������������������������������������������������������������������������� 340
References�������������������������������������������������������������������������������������������������������������������������������� 340

Chapter 7: FMCG Case Study�������������������������������������������������������������������������������� 345


Application of Analytics in FMCG Industry�������������������������������������������������������������������������������� 346
Customer Experience & Engagement���������������������������������������������������������������������������������� 347
Sales and Marketing������������������������������������������������������������������������������������������������������������ 347
Logistics Management�������������������������������������������������������������������������������������������������������� 348
Markdown Optimization������������������������������������������������������������������������������������������������������ 349
Case Study: Customer Segmentation with RFM Model and K-means Clustering��������������������� 350
Overview of RFM Model������������������������������������������������������������������������������������������������������ 351
Overview of K-means Clustering����������������������������������������������������������������������������������������� 355
RFM Model & K-means Clustering Using R������������������������������������������������������������������������������� 358
About Data��������������������������������������������������������������������������������������������������������������������������� 358
Performing Data Exploration����������������������������������������������������������������������������������������������� 359
RFM Model & K-means Clustering Using SAS��������������������������������������������������������������������������� 376
Summary���������������������������������������������������������������������������������������������������������������������������������� 393
References�������������������������������������������������������������������������������������������������������������������������������� 394

Index��������������������������������������������������������������������������������������������������������������������� 397
ix
About the Author
Deepti Gupta completed her MBA in Finance & PGPM in
Operation Research in 2010. She has worked with KPMG
and IBM private limited as a Data Scientist and is currently
working as a data science freelancer. Deepti has extensive
experience in predictive modeling and machine learning
and her expertise is in SAS and R. Deepti has developed
data science courses and delivered data science trainings
and conducted workshops in both corporate and academic
institutions. She has written multiple blogs and white papers.
Deepti has a passion for mentoring budding data scientists.

xi
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
About the Contributor
Dr. Akshat Gupta is currently working as a Senior
Applications Engineer at MilliporeSigma in Applications
Engineering, Global Manufacturing Sciences and
Technology (MSAT) group. He authored the health-
care case study (Chapter5) of this book. His focal area of
research is cell culture clarification and tangential flow
filtration. Dr. Gupta has extensive experience in Design
of Experiments (DOE) and statistical analysis. He holds
a Bachelor of Technology (B.Tech) degree in Chemical
Engineering from the Vellore Institute of Technology, and a Master of Science (MS)
and Doctor of Philosophy (Ph.D.) in Chemical Engineering from the University of
Massachusetts Lowell. He also has graduate certificates in Modeling and Simulation, and
Nanotechnology.

xiii
About the Technical Reviewer
Preeti Pandhu has a Master of Science degree in Applied
(Industrial) Statistics from the University of Pune. She is SAS
certified as a base and advanced programmer for SAS 9 as
well as a predictive modeler using SAS Enterprise Miner 7.
Preeti has more than 18 years of experience in analytics and
training.
She started her career as a lecturer in statistics and began
her journey into the corporate world with IDeaS (now a SAS
company), where she managed a team of business analysts
in the optimization and forecasting domain. She joined SAS as a corporate trainer before
stepping back into the analytics domain to contribute to a solution-testing team and
research/consulting team. She was with SAS for 9 years. Preeti is currently passionately
building her analytics training firm, DataScienceLab (www.datasciencelab.in).

xv
Acknowledgments
Book writing is one of the most interesting and challenging attempt one can take up.
This book could not have been completed without the encouragement, guidance, and
support of my family. I would like to thank Dr. Akshat Gupta, Ved Prakash Garg, Col. Atul
Gupta, Dr. Anvita Garg, Ayush Gupta, RS Miyan, Ansi Miyan, Dr. James Chrostowski, and
my colleagues and friends for their productive discussions and suggestions. My special
thanks to Celestin John who provided great help on everything ranging from technical
support to answering my queries. I appreciate the thoughtful and insightful comments
from the editor and the reviewers. Thanks to the Apress team, especially to Divya Modi
for all the patience, support, and guidance in completing this project.

xvii
Introduction
Analytics is a big buzz and a need for today’s industries to solve their business problems.
Analytics helps in mining the structured and unstructured data in order to withdraw the
effective insights from the data, which will help to make effective business decisions. SAS
and R are highly used tools in analytics across the globe by all industries for data mining
and building machine learning and predictive models. This book focuses on industrial
business problems and a practical analytical approach to solve those problems by
implementing predictive models and machine learning techniques using SAS and R
analytical languages.
The primary objective of this book is to help statisticians, developers, engineers,
and data analysts who are well versed in writing codes; have a basic understanding of
data and statistics; and are planning to transition to a data scientist profile. The most
challenging part is practical and hands-on knowledge of building predictive models and
machine learning algorithms and deploying them in industries to address industrial
business problems. This book will benefit the reader in solving the business problems
in various industrial domains by sharpening their analytical skills in getting practical
exposure to various predictive model and machine learning algorithms in six industrial
domains.

What’s in This Book


This book focuses on industrial business problems and practical analytical approaches
to solve those problems by implementing predictive models and machine learning
techniques using SAS Studio and R analytical languages. This book contains six
industrial case studies of various domains with data and all the codes in SAS Studio
and R languages, which would benefit all readers to practice and implement these
models in their own business cases.
In Chapter 1 the general outline about analytics, the role of analytics in various
industries, and a few popular data science and analytical tools are discussed.
Chapter 2 describes the role of analytics in the banking industry with a detailed
explanation of predicting a bank loan default case study in R and SAS. Chapter 3

xix
Introduction

describes how analytics contribute in the retail industry and offers a detailed explanation
of forecasting a case study in R and SAS. Chapter 4 describes how analytics is reshaping
the telecommunications industry and gives a detailed explanation of a case study on
predicting customer churn in R and SAS. Chapter 5 describes the application of analytics
in the healthcare industry and gives a clear explanation of a case study on predicting the
probability of benign and malignant breast cancer using R and SAS. Chapter 6 describes
the role of analytics in the airline industry and provides a case study on predicting flight
arrival delays (minutes) in R and SAS. Chapter 7 describes the application of analytics
in the FMCG industry with a detailed explanation of a business case study on customer
segmentation based on their purchasing history using R and SAS.

Who’s the Target Audience?


• Data Scientists who would like to implement machine learning
techniques with a practical analytical approach toward a particular
industrial problem.

• Statistician, Engineers, and Researchers with a great theoretical


understanding of data and statistics and would like to enhance their
skills by getting practical exposure to data modeling.

• Data analysts who know about data mining but would like to
implement predictive models and machine learning techniques.

• Developers who are well versed with coding but would like to
transition to a career in data science.

What You Will Learn


• Introduction to analytics and data understanding.

• How to approach industrial business problems with an analytical


approach.

• Practical and hands-on knowledge in building predictive model and


machine learning techniques.

• Building the analytical strategies.

xx
CHAPTER 1

Data Analytics and Its


Application in Various
Industries
Data analytics has become part and parcel of any business in today’s world. In fact, it
has evolved into an industry in itself. Vast numbers of software platforms are available
for data extraction, scrubbing, analysis, and visualization. Some of these platforms
are specialized for carrying out one of the above-listed aspects of data analytics, while
others offer a generalist tool to carry out almost all tasks ranging from data scrubbing to
visualization. Of these platforms, SAS® and R are the most popular for data analytics with
a large global clientele.
In 1967, Statistical Analysis System (SAS) started as a federal funded project for
graduate students to track agriculture data at North Carolina State University.1 Today it
has become a global leader in data analysis software market with customers spanning
®
over 148 countries.2 Ninety-six of the top 100 Fortune Global 500 companies use SAS. R,
which originally was a statistical computing language, has advanced significantly over
the years. R Studio is an Integrated Development Environment (IDE) for R3 and offers a
®
free, user-friendly platform for data analytics. Both SAS and R offer vast capabilities but
have certain contrasting advantages that are discussed later in more detail.
A broad array of companies ranging from the largest global banks to regional
transport firms are using data analytics to solve diverse sets of problems These diverse
applications have one commonality: using data and statistics as the basis for decision
making.
In this chapter, certain key aspects related to data analytics will be introduced.

1
© Deepti Gupta 2018
D. Gupta, Applied Analytics through Case Studies Using SAS and R,
https://doi.org/10.1007/978-1-4842-3525-6_1
Chapter 1 Data Analytics and Its Application in Various Industries

What Is Data Analytics?


Analytics is defined as the process of developing the actionable insights through the
application of statistical model and analysis from the data.4 Applying data analytics
for decision making is a systematic process. It starts with understanding the nature of
industry, general functionality, bottlenecks, and challenges specific to the industry. It
is also helpful to know who the key companies are, size of industry, and in some cases
general vocabulary and terms associated with operations. After that we take a deeper dive
in to the area specific to the application or a business case to which data analytics needs
to be applied. A thorough understanding of the application, associated variables, sources
of data, and knowledge of the reliability of different data sources are very important.
Data analytics firms pay a lot of attention to these aspects and often employ a vast
number of subject-matter experts specific to industries and at times even specific to
certain key applications. Business research consultants are also employed for gaining
understanding and insights in certain cases. During the preliminary phase of a project,
data analytics firms perform elaborate surveys and conduct series of interviews to gain
more information about the company and the business problem.5 A good understanding
of industry and the application can result in significant cost saving and can improve
accuracy, performance, and practicality of the model.
Once the application or the problem statement is well understood, then the
implementation process starts. The core methodology of implementing data analytics
for solving a business problem is shown in Figure 1-1.6

Data
Collection

Data
Put into use
Preparation

Data
Results
Analysis

Model
Building

Figure 1-1. Data Analytics Methodology


2
Chapter 1 Data Analytics and Its Application in Various Industries

D
 ata Collection
The first step in the process is data collection. Data relevant to the applicant is collected.
The quality, quantity, validity, and nature of data directly impact the analytical outcome.
A thorough understanding of the data on hand is extremely critical.
It is also useful to have an idea about some other variables that may not directly be
sourced from the industry or the specific application itself but may have a significant
impact if included into the model. For example, when developing a model to predict
flight delays, weather can be a very important variable, but it might have to be obtained
from a different source then the rest of the data set. Data analytics firms also have ready
access to certain key global databases including weather, financial indices, etc. In recent
years, data mining of digital social media like Twitter and Facebook is also becoming
very popular.7 This is particularly helpful in understanding trends related to customer
satisfaction with various services and products. This technique also helps reduce the
reliance on surveys and feedbacks. Figure 1-2 shows a Venn diagram of various sources
of data that can be tapped into for a given application.

Industry data

Data from
other sources
(Weather,
Firm Specific data social media,
etc.)
Application
specific data

Figure 1-2. Venn diagram of data sources

3
Chapter 1 Data Analytics and Its Application in Various Industries

D
 ata Preparation
The next step is data preparation. Usually raw data is not in a format that can be directly
used to perform data analysis. In very simple terms, most platforms require data to be
in a matrix form with the variables being in different columns and rows representing
various observations. Figure 1-3 shows an example of structured data.

Figure 1-3. Format of structured data

Data may be available in structured, semi-structured, and unstructured form. A


significant effort is needed to align semi-structured and unstructured data into a usable
form as shown in Figure 1-3. Once the data is brought together in a structured form, the
next stage in data preparation is data cleansing or scrubbing. Data scrubbing encompass
processes that help remove inconsistencies, errors, missing values, or any other issues
that can pose challenges during data analysis or model building with a given data set.8
Work at this stage can be as simple as changing the format of a variable, to running
advanced algorithms to estimate suitable estimates for missing values. This task is
significantly more involved when it comes to big data.

D
 ata Analysis
Once data is converted into a structured format, the next stage is to perform data
analysis. At this stage underlying trends in the data are identified. This step can include
fitting a linear or nonlinear regression model, performing principal component analysis
or cluster analysis, identifying if data is normally distributed or not. The goal is to identify

4
Chapter 1 Data Analytics and Its Application in Various Industries

what kind of information can be extracted from the data and if there are underlying
trends that can be useful for a given application. This phase is also very useful for
scoping out the models that can be most useful to capture the trends in data and if the
data satisfies underlying assumptions for the model. One example would be to see if the
data is normally distributed or not to identify if parametric models can be used or a
non-­parametric model is required.

M
 odel Building
Once the trends in data are identified, the next step is to put the data to work and build
a model that will help with the given application or help solve a business problem. A
vast number of statistical models are available that can be used, and new models are
being developed every day. Models can significantly vary in terms of complexity and
can range from simple univariate linear regression models to complex machine learning
algorithms. Quality of a model is not governed by complexity but rather by its ability to
account for real trends and variations in data and sift information from noise.

R
 esults
Results obtained from the models are validated to ensure accuracy and model
robustness. This can be done two ways; the first is by splitting the original data set into
training and validation data sets. In this approach, part of the data is used for model
building and the remaining part is used for validation. The other approach is to validate
data against real-time data once the model is deployed. In some cases, the same data is
used to build multiple different types of models to confirm if the model outputs are real
and not statistical artifacts.

Put into Use


Once the model is developed it is deployed in a real-time setting for a given application.
As shown in the Figure 1-1, the overall process is somewhat iterative in nature. Many
times, the models have to be corrected and new variables added or some variables
removed to enhance model performance. Additionally, models need to be constantly
recalibrated with fresh data to keep them current and functional.

5
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
Chapter 1 Data Analytics and Its Application in Various Industries

T ypes of Analytics
Analytics can be broadly classified under three categories: descriptive analytics,
predictive analytics, and prescriptive analytics.9 Figure 1-4 shows the types and
descriptions of types of analytics.

Descriptive • What has happened


and why it
Analytics happened?

Predictive • What will happen


Analytics next?

Prescriptive • What best can be


Analytics done ?

Figure 1-4. Types of Analytics

Different types of information can be obtained by applying the different categories of


analytics. This will be explained in the following section.

1. Descriptive Analytics: Most of the organizations use descriptive


analytics in order to know about their company performance.
Example, management at a retail firm can use descriptive
analytics to know the trends of sales in past years, or inferring
trends of operation cost, product, or service performance.

2. Predictive Analytics: In case of predictive analytics, historical


trends coupled with other variables are used to see what could
happen in the future to the firm. Example, Management at the
same retail firm can use the sales trends from previous years to
forecast sales for the coming year.

6
Chapter 1 Data Analytics and Its Application in Various Industries

3. Prescriptive Analytics: In prescriptive analytics, the objective


is to identify factors or variables that are impacting trends.
Once the responsible variables are identified, strategies and
recommendations are made to improve the outcome. For
example, Management at the same retail firm identifies that the
operation cost is significantly high due to overstocking at certain
stores. Based on this insight, an improved inventory management
would be recommended to the given locations.

Understanding Data and Its Types


Data is a collection of variables, facts, and figures that serves as raw material to create
information and generate insights. The data needs to be manipulated, processed, and
aligned in order to withdraw useful insights. Data is divided into two broad forms:
qualitative and quantitative data.10
1. Qualitative data: The data that is expressed in words and
descriptions like text, images, etc. is considered as qualitative
data. Qualitative data collection uses unstructured and semi-
structured techniques. There are various common methods to
collect qualitative data like conducting interviews, diary studies,
open-ended questionnaires, etc. Examples of qualitative data are
gender, demographic details, colors, etc. There are three main
types of qualitative data:

• Nominal: Nominal data can have two or more categories but


there is no intrinsic rank or order to the categories. For example,
gender and marital status (single, married) are categorical
variables having two categories and there is no intrinsic rank or
order to the categories.

• Ordinal: In ordinal data, the items are assigned to categories and


there is an intrinsic rank or order to the categories. For example,
age group: Infant, Young, Adult, and Senior Citizen.

• Binary: Binary data can take only two possible values. For
example, Yes/No, True/False.

7
Chapter 1 Data Analytics and Its Application in Various Industries

2. Quantitative data: The data that is in numerical format is


considered as quantitative data. Such a type of data is used in
conducting quantitative analysis. Quantitative data collection
uses much more structured techniques. There are various
common methods to collect quantitative data like surveys,
online polls, telephone interviews, etc. Examples of quantitative
data are height, weight, temperature, etc. There are two types of
quantitative data:
• Discrete Data: Discrete data is based on count and it can only
take a finite number of values. Typically it involves integers.
For example, the number of students in data science class is
discrete data because you are counting a whole and it cannot be
subdivided. It is not possible to have 8.3 students.

• Continuous Data: Continuous data can be measured, take any


numeric values, and be subdivided meaningfully into finer and
finer levels. For example, the weights of the data science students
can be measured at a more precise scale – kilograms, grams,
milligrams, etc.

While on the topic of data, it is a good time to get a basic understanding of “Big Data.”
Big Data is not just a buzzword but is fast becoming a critical aspect of data analytics.
It is discussed in more detail in the following section.

What Is Big Data Analytics?


The term “big data” is defined as the huge volume of both structured and unstructured
data that is so large that it is not possible to process such data using traditional databases
and software. As a result, many organizations that collect, process, and conduct big
data analysis turn to specialized big data tools like NoSQL databases, Hadoop, Kafka,
Mapreduce, Spark, etc. Big data is a huge cluster of numbers and words. Big data
analytics is the process of finding the hidden patterns, trends, correlations, and other
effective insights from those large stores of data. Big data analytics helps organizations

8
Chapter 1 Data Analytics and Its Application in Various Industries

harness their data to use it for finding new opportunities, faster and better decision
making, increased security, and competitive advantages over rivals, such as higher
profits and better customer service. Characteristics of Big data are often described using
5 Vs, which are velocity, volume, value, variety, and veracity.11 Figure 1-5 illustrates 5 Vs
related to the big data.

Volume
Petabytes
Files
Records

Value Velocity
Statistical Batch
Events Real time
Correlations Streams

5 Vs of Big Data

Variety
Veracity
Structured
Authenticity
Unstructured
Reliability
Trustworthiness Social
Mobile

Figure 1-5. 5 Vs of Big Data

Big Data analytics applications assist data miners, data scientists, statistical modelers,
and other professionals to analyze the growing volumes of structured and mostly
unstructured data such as data from social media, emails, web servers, sensors, etc.
Big data analytics helps companies to get accessibility to nontraditional variables or
sources of information, which helps organizations to make quicker and smarter business
decisions.

9
Chapter 1 Data Analytics and Its Application in Various Industries

Big Data Analytics Challenges


Most of the organizations are experiencing effective benefits by using big data analytics,
but there are some different obstacles that is making it difficult to achieve the benefits
promised by big data analytics.12 Some of the key challenges are listed below:
• Lack of internal skills: The most important challenge that
organizations face in implementing big data initiatives is lack of
internal skills, and there is a high cost of hiring data scientists and
data miners for filling the gaps.

• Increasing growth of the data: Another important challenge of big


data analytics is the growth of the data at a tremendous pace. It creates
issues in managing the quality, security, and governance of the data.

• Unstructured Data: As most of the organizations are trying to


leverage new and emerging data sources, it is leading to the more
unstructured and semi-structured data. These new unstructured
and semi-structured data sources are largely streaming data coming
from social medial platforms like Twitter, Facebook, web server logs,
Internet of Things (IOT), mobile applications, surveys, and many
more. The data can be in the form of images, email messages, audio
and video files, etc. Such unstructured data is not easy to analyze
without having advanced big data analytical tools.

• Data Siloes: In organizations there are several types of applications


for creating the data like customer relationship management (CRM),
supply chain management (SCM), enterprise resource planning
(ERP), and many more. Integrating the data from all these wide
sources is not an easy task for the organization and is one of the
biggest challenges faced by big data analytics.

10
Random documents with unrelated
content Scribd suggests to you:
“I am glad I have not such a fearful temper.—Miss Endicott, you
play croquet, of course. I challenge you to a game.”
Fanny tripped gayly down the path. But mamma, I noticed, looked
very grave.
CHAPTER IV.

AN, Nelly, and Stuart played croquet until it was fairly


dusk. There were shouts of laughter, and much hurrying
around, as if no time was to be lost. Mamma and I went
quietly about our duties; and when I had the children in
bed, I came into the nursery and sat down to have a
brief talk with her. By this time the click of the balls had ceased, and
the three were strolling up and down the street.
“How odd it seems!” I said. “I wonder if we shall get along nicely.”
“Don’t begin to fear thus early, Mr. Faint-heart,” returned mamma,
smilingly. “It will not be as nice as having our house to ourselves; but
we are not doing it for pure enjoyment. When we are tired, and
worried, and discouraged we must think of all the nice things we
shall buy in the fall, and be comforted. We shall have papa a new
study carpet, and get his chair freshly covered.”
“And if it could be Russia leather! That would last him all his life. At
all events, we will spend half on him; and I am sure he will deserve it.
He will, likely, be the greatest sufferer by the confusion.”
“The boys will be out of doors much of the time, no doubt. We
must try to improve our invalid as rapidly as possible. Poor boy!”
“Mamma,” I said, “what a great generous heart you have! You
always pity every one. I have a suspicion that Mr. Louis is cross as
well as sick.”
“Then we must minister to the mind as well as the body.”
“I am glad that Stuart is bright and cheerful.”
“O, those children must come in!” she said, starting up. “Fanny is
so thoughtless!”
They answered the summons, but sat down on the porch step,
where Stuart finished a story of boyish school-pranks, which was
very amusing, to say the least. Papa came in time to hear the last of
it, and shook his head rather sagely.
“It is past ten,” announced mamma.
“Country bed-time!” said Stuart, gayly. “I suppose, Mrs. Endicott,
that is a hint for me to go stir up my bear, and listen to a few growls.
A menagerie; ten cents admittance. Who’ll venture in? Don’t all
speak at once, or the place may be crowded.”
“Perhaps, since he is not very well, you had better sleep in another
room to-night,” mamma said.
“Because he might eat me up in the night, since he refused his
supper. I am much obliged, Mrs. Endicott.”
Mamma came around a trifle, so that she faced him, and, standing
in the shaded light, raised her soft, dark eyes to his, and said,—
“This is out of consideration to him, and not the fear of what will
happen to you. That will be the thought for you to go to bed with, and
see if you cannot resolve it into a lesson worth the learning. If I adopt
you into my household, I shall train you as one of my children. And
you will be astonished to see what marvels a little care for the
feelings of others will work.”
Stuart blushed and smiled, said good night, and followed papa to
the best guest-chamber, that I had put in such lovely order. And so
there was quiet through the night.
Louis did not make his appearance at breakfast; but Stuart had
been in stirring him up, for we heard the growls. But he was so merry
and good-natured when he came down, that one had not the heart to
find any fault. Indeed, he kept the children laughing all through the
meal.
“What is there to do in this queer little town, Mr. Endicott?” he
asked presently. “Fishing, I suppose—the staple amusement of lazy
people. Any hunting?”
“Not at this season; and very little at any. There are some nice
rambles, and the fishing, as you say.”
“Any young fellows that one would like?”
“Yes a number; though some of them keep pretty busy during the
day. And I forgot rowing. There are boats to be had.”
“Thank you. I’ll take a saunter round. I always do have the luck of
finding some one.”
“And there are books in the library. You may like to keep fresh for
fall. So your brother was a good deal disappointed at not passing?”
“Yes. It wouldn’t have troubled me. Steve was not a bit anxious; so
I should have let it go without a sigh. There is nothing like resignation
in this world.”
“You are an admirable pattern of it,” said Fanny. “I feel tempted to
envy you. I have another fortnight of school; and fearful
examinations are hanging over my devoted head.”
“Couldn’t I go in your stead? I am fresh from it all, and might save
you much vanity and vexation of spirit.”
“Especially the vanity. Your kindness is only exceeded by your
great beauty. Shakespeare.”
“Fanny!” said papa.
Mamma rose from the table, and prepared a dainty breakfast upon
a waiter, pouring the coffee in a pretty medallion cup that had been
given her at Christmas. Then she took it herself. Stuart sprang up
with an instinct of gentlemanliness.
“You are not going to carry that up stairs?” he asked, in surprise.
“Why not?”
“If you are not going to send a servant, I will take it.”
“You may carry it for me, if you like; but I wish to make a call upon
your brother.”
He was her attendant as far as the door; but when her summons
was answered, she dismissed him. Then she walked straight to the
bedside, placing her tray on a small table.
“Are you rested this morning?” she asked, gently. “I think you will
feel better for some breakfast. I am sorry that you should be so
fatigued and ill, for a place seldom looks bright under such
circumstances. But we will do our best for you, and you must try as
well.”
The scowl remained in his forehead. He raised himself on his
elbow, and turned towards her, though his eyes were still averted.
“I am obliged for the trouble, though I do not need any breakfast,”
he said, rather gruffly.
“I think you do need it. Here is a glass of cool spring water, and
some fragrant coffee. A little of both may revive you. Does your head
still ache? If I had known just what to do for you, I should have come
again last night.”
“Was it you who—” and his face flushed a swarthy scarlet.
“Yes;” and mamma looked steadily at him out of her sweet brown
eyes.
He moved uneasily, and in his heart wished she were away.
“Was it you who came last evening?” he asked, in a low,
wondering tone.
“Yes. I felt anxious about you. I knew you were in a strange place,
and, doubtless, feeling awkward and lonesome. That must be my
apology.”
“O,” he exclaimed, “don’t make any—to me. I acted like a boor! I
am sorry and ashamed. And I don’t deserve that you should take all
this trouble for me. But I had been—”
“And I did sympathize with you to the utmost. The disappointment
must have proved great. But I do believe it will be much better for
you to wait. You were not strong enough to take up a college
course.”
“Yet I had said those things over and over again. I knew them fairly
well, at least. And to have all those boobies set up and sneer! I could
have killed them!”
He looked so at the moment.
“O,” mamma said, “you must not think of this now. Do not try to
keep the angry flames alive. It is a bright, lovely morning; and if you
could make the effort to come down on the porch, you would feel so
much better! Try this coffee—to please me.”
“You are very kind and solicitous.”
There was a little tremble in his voice; but he made no effort to
touch the food.
“If you appreciate it, you will begin your breakfast before
everything gets cold. You will feel more like rising then. Come, I
mean to cheer you up in spite of yourself. This is not Doubting
Castle, and I cannot take in Giant Despair.”
He smiled faintly then, and sipped his coffee.
“There,” mamma said, in her bright, cheery way, “you have made a
small beginning, and that gives me faith in you. Now I must go back
to my flock. Down stairs there is a cool, pleasant library, and a piano,
which always stands open. I want you to feel at home.”
“You are good,” he returned. “Can I have the library to myself, or
only with Mr. Endicott?”
“Yes; or the parlor, either. Indeed, Mr. Endicott has finished his
sermons, and will be out nearly all day.”
“Thank you.”
Stuart was lying in wait at the foot of the stairs.
“Well,” with a gay little laugh, “did you beard the lion in his den? I
must go up and make him roar.”
“No,” said mamma, laying her hand on his arm, “you must not go
up; and I ask, as a personal favor, that you will not tease him this
whole day.”
“Tease him! The baby! Poor little thing!”
“I have promised him a quiet morning. You will not compel me to
break my word?”
“Then I shall have to go out and hunt up some fun.”
She smiled in her irresistible fashion, that conquered if it did not
convince.
We had made an exception, and done the most of our Saturday’s
work on Friday morning. So now there was only a little dusting, with
the usual making of beds, and all that. I had just finished the other
rooms, when Louis left his, and went quietly down to the study,
shutting himself in. To mamma’s satisfaction, he had eaten nearly all
the breakfast she had prepared.
I put the room in its usual order. Oddly enough, I found a withered
rose under the pillow, and it was still sweet. I remembered that
Stephen was very fond of roses. There were ever so many small
articles strewn about. I thought those big boys were as careless as
the children.
Papa came in just before dinner was ready, and had a little chat
with Louis, though the young man was not disposed to be social. At
dinner he seemed dreadfully awkward and embarrassed, his sallow
cheeks, flushing at the least word. Somehow I was glad Stuart was
not there. Afterwards he went up to his room, and spent the whole
afternoon alone.
We had rather a funny time. Stuart came in late, and insisted upon
having his dinner in the kitchen, telling Ann two or three such
laughable Irish stories, that they were friends straightway. Then he
would insist upon carrying Fan’s basket when she was ready to start
on her visitation, as she called it.
“It was as good as a play,” he said afterwards. “I thought I should
smile audibly at that old lady—Mrs. Means, I believe you called her.
She is an ungrateful wretch, Mrs. Endicott. ‘She did not like such
light, chaffy bread; it had no heart. You might as well eat sawdust.’
And she wanted to know how many eggs were in the custard; and
when people sent currants, she wished they would send sugar, too.
‘Nasty, sour things!’ Why, I had half a mind to hustle the gifts back in
the basket, and bring them home.”
“We are not to get weary in well doing,” said mamma.
“I’m not sure but a little wholesome hunger would be good. And
then that old Mrs. Bogert! Doesn’t she look funny there in the bed,
with her little, wrinkled face and that flapping cap-ruffle. And her talk,
and the queer way in which she keeps questioning her maid—‘Betty,
how long is it since I was tuck sick?’ in that high, cracked voice,
which sounds like a smashed hand organ with a monkey grinding it.
‘Betty, tell the gentleman how I fell down the cellar stairs. Betty, bring
me my snuff-box; mebby the young gentleman will take a pinch.’”
He imitated Mrs. Bogert’s tone so exactly, that we could not help
laughing.
“Did you take a pinch?” asked Nelly.
“Of course I did. And such sneezing!”
“It was dreadful,” said Fan, with a reproachful look. “And not a bit
in earnest.”
“How did you do it?” Nelly questioned.
“This way.”
There isn’t any method of spelling such terrific sneezing. No
combination of letters would do it justice. I thought I wouldn’t laugh;
but I did and the children screamed.
“Good snuff—wasn’t it?” he said, with a droll wink.
“I don’t see how you can do it, all in fun,” said wide-eyed Daisy.
“I do not believe I shall take you out with me again,” commented
Fan, severely.
“But I know the way now. I shall drop in to see the old lady often,
and get a pinch of snuff. O, dear! I am almost worn out with my
arduous duties. Can any one stay me with a glass, and comfort me
with cold water—the literal for apples and love? And then can’t we
dissipate on croquet? If I sit still much longer I shall have the rickets.
My physician prescribed active exercise.”
“You had better take the baby out in her carriage, if you want
exercise,” said Tiny Tim, having heard the two connected some way.
He laughed.
“For—

‘Satan finds some mischief still


For idle hands to do.’

Isn’t that in the hymn book?”


“Not in mine,” returned Fan.
“Well, I am sure it is in the spelling-book. I learned it somewhere;
and it is about a busy bee. Good instructions, like pins, are never
lost.”
“But pins are lost. Your logic is faulty.”
“No they’re always gone before—that is, before you want them.”
“You are too smart for your size,” said Fan. “I am afraid you’ll grow
up a dunce.”
“Well, you cannot have all the virtues for a little money. As it is, I
think of striking for higher wages.”
“You are not worth what you get now,” said Fan, running away.
Stuart did not venture up stairs until just before supper. Louis
declined to come down; so mamma sent him some tea, berries, and
biscuits.
“I am afraid you are beginning in a way to make trouble for
yourself,” papa said, thoughtfully, afterwards.
“I am going to indulge him for a few days. He is nervous, and
really bashful; and I want him to learn to like us. But he cannot be
forced to do anything.”
“I believe I like my girls the best,” said papa, fondly.
Saturday evenings, when no one dropped in, were our choicest
time of all the week. Mamma played, and we all sang. This time no
one came to disturb us. And we never knew, until long afterwards,
that Louis Duncan listened with his eyes full of tears, and had not the
courage to join us. But it always appeared to me like a little bit of
heaven below. Papa’s sweet tenor voice seemed to belong to some
particular hymns, and it took me far above the petty work-day affairs.
How good and lovely he was in his every-day walks and ways!
Louis began to get somewhat acquainted with us on Sunday. He
did not go to church, but lay on the bed reading nearly all day. No
one found any fault with him; and Stuart’s teasing tongue was
hushed. I think he stood a little in awe of my mother, gentle as she
was. It was plain to see that the boys had been brought up with mere
outward forms of religion; that they had no love and very little respect
for it. How different they were from Stephen!
But the enforced quiet was broken on Monday morning, there
were some high words, and then an unmistakable blow, followed by
a struggle and a fall. Papa went up stairs.
“Boys,” he said, with severe but simple dignity, “are you brothers,
and must you quarrel? If you have no respect for yourselves, I
implore you to have a little for my house, that has hitherto been the
abode of harmony. I will not have it.”
The combatants paused, and glared at each other with angry
eyes. Stuart had come off victor, for it was Louis who had fallen. He
was deadly white now, with a blue line about the mouth.
“I won’t be struck as if I was a child,” exclaimed Stuart, with fierce
determination; “and he struck me.”
“I told you to let that brush alone,” said the other, sullenly. “Your
own was there.”
“Stuart, go in the room opposite and finish your toilet. I shall
expect an apology from you both when you come down stairs.
Breakfast is ready.”
It seemed as if we were to have neither of them; but when the
meal was about half over Stuart entered the room. His face was
flushed, and his eyes were still sending out fiery rays; but he went
straight to papa.
“Mr. Endicott,” he said, making an effort to steady his voice, “I am
truly sorry that I should have been so rude and ungentlemanly in
your house. I ask your pardon.—And yours, Mrs. Endicott.”
“I pardon you on condition that a similar event never happens,
while you are here, at least. You are both too old to fall into such
rough-and-tumble school-boy fights.”
Mamma held out her hand to him as he passed her. He blushed
deeply, but seized it with a thankful eagerness. After that our meal
was very silent.
Ann went up stairs to see if Louis would have any breakfast.
“Sure, he’s crosser than two sticks when the fire is kindlin’. He
doesn’t want sup nor bite; and if he did, it’s little he’d get from me.”
So mamma judged that it was best to pay no further attention to
him. He did not even come down at noon; and then Stuart found that
his door was locked.
Quite late in the afternoon I was hurrying through the hall, when he
opened his door suddenly. His hair was tumbled, his cheeks scarlet,
and his eyes wild and staring.
“For God’s sake, get me a drink of water!” he cried, hoarsely.
I took it up to him, and knocked; but there was no answer. I made
some ado opening the door, and walked in rather timidly. He was
laughing and talking incoherently but clutched at the pitcher of water
and drank great, desperate swallows. Then he sank back on the bed
exhausted.
I ran to mamma in affright.
“Louis Duncan is sick and out of his mind!” I cried. “O, mamma, I
am sorry they came. We shall have our hands full of trouble.”
She went to the room with me. He did not appear to know either of
us, and we could not rouse him to any coherency.
“It is a fever. The doctor must be sent for immediately. Tell Nelly to
go. And, Rose, we must arrange the other room, and take him over
there, since it may be a long illness. Well, we must have patience.
God knows what is for the best.”
I soon had everything in order. Papa coming in, he partly led and
partly carried Louis to the best room. Mamma bathed his head and
put some draughts on his wrists and his feet. Now he lay quietly, with
his eyes half open, breathing heavily.
Dr. Hawley called just before supper.
“A bad case,” he said, gravely, “a bad case! Why, the fellow is
worn to skin and bone already, and looks as if he had had the
jaundice for the last month. But we will do our best. He may be
stronger than he appears.”
Stuart felt pretty sober that evening.
“I suppose I ought not to have stirred him up so this morning,” he
said. “But it is such fun! And it was all about a trifle. I used his hair-
brush; and he is as particular as any old maid. Then I tormented him
a little, and he seized the brush and gave me a box on the ear, which
I won’t take from any one without a row. I am not a baby. And it was
awful mean of him! And so we clinched. But he has been in a
dreadful temper for the last month. He was mad because Stephen
wouldn’t let him go to Lake George with a lot of fellows.”
“It was fortunate that he did not,” returned mamma. “And, Stuart, I
hope, in the weeks to come, you will learn your duty towards him.
God has not given you this tie for you to disregard so utterly.”
Stuart looked at her with wondering eyes, but made no answer.
“Our first experience with boys seems to be rather trying,” said
Fanny, as we were going to bed that night. “I hope and pray that he
may not die—and in our house!”
I thought of what Stephen had asked of me.
CHAPTER V.

N awesome quiet settled over the house. I did not


remember a time when any one had ever been very
sick. The children gathered in groups, and spoke in
whispers, and for a day or two Stuart appeared almost
conscience-stricken. But his natural flow of spirits could
not be repressed. Yet his laugh jarred on my nerves. We were used
to caring so much for each other’s welfare and comfort, and
sympathizing with sorrows or trivial illnesses, that his carelessness
seemed to us as something quite dreadful. Yet he was so pleasant
and good-natured, so ready to do anything that was asked of him,
though he never appeared to think that he might volunteer any little
service.
“We must make some allowance for them,” mamma said, in her
kindly fashion. “Remember that they have had no mother. Much of
their lives has been spent at school; and their uncle was a cold and
rather arrogant man, papa thinks. So they have had no chance to
acquire the graces of home life.”
When the tidings became noised abroad through the village, we
were quite besieged. Mamma threw up the fortifications at the hall
door. The old women, who were curious, or anxious, or even kindly-
hearted in their officious way, heard all of the story there, or in the
sitting-room, that it was necessary for them to know. Aunt Letty
Perkins was not last nor least.
“Was it true, as she had understood, that these two young men
came to study with Mr. Endicott? She heard they were going in
college, or something or other. She hoped he would get well paid for
his trouble—young college chaps were always pretty wild. There was
no great loss without some small gain; and if this young fellow was
sick, he couldn’t be kitin’ round the village into all sorts of mischief.”
“No, to be sure not,” returned mamma, with a smile at this sort of
comfort.
“But what are you to do? You have your hands full already, with
such a houseful of children! I allers say that Mis’ Endicott’s the most
wonderful woman I know. I should think you’d a been worn out long
ago; and here you haven’t scarcely a wrinkle in your face!”
“I do not know why people should wrinkle up their faces when they
have a number of healthy, happy children about them. Why, they
keep you young, Mrs. Perkins. It takes you back to your own
childhood continually.”
“I hope you’re a going to get paid for all this.”
“I do not believe the Duncans will become chargeable to the
parish, since they have fortunes of their own,” said mamma, rather
dryly.
“Rich, now? Well, that’s good! Though rich men’s sons are
exposed to sights of temptations. No one knows!” and Aunt Letty
shook her head solemnly.
“I fancy there will not be many here at Wachusett.”
“Mean to keep them the whole year?”
“No; only through vacation.”
“They have gardeens, I s’pose?”
“Mr. Endicott is their sole guardian now, with the exception of an
elder brother, who acts for them.”
“O!”
Then Aunt Letty fidgeted about.
“If you should want some one to help do the nussin’, I could take
my knitting and sit up stairs. I haven’t much of anything to do, and I’d
as lief.”
“No,” said mamma. “I am much obliged. Mrs. Whitcomb is coming
over this evening.”
So Aunt Letty had to go away without seeing the patient. But she
had considerable news to sow broadcast, which comforted her.
For the first two days I spent all my time in the sick room, while
papa remained at night. The violent paroxysms were not very long at
a time, and for the rest he only tumbled about and wanted a drink
every few moments. Then Mrs. Whitcomb arrived, and I was partly
released.
By Saturday Dr. Hawley had nearly given up the faintest hope.
Every one knew who was meant when the prayer for the sick was
used on Sunday. Something in papa’s voice touched me in a
peculiar manner. In the great calm of earth and sky, it seemed so
strange that any life should go out into utter nothingness! Why, the
smallest insects were on the wing, and birds and bees went
humming and soaring, with no anxious cares, just brim full of glad,
free life.
If we had been less engrossed, we should have felt quite elated
over Fanny’s successful examination; but, as it was, we were glad to
have her at home, without thinking much about it. So the days
passed until the quivering life seemed to hang by a mere thread.
“If he can go through the next twelve hours!” said Dr. Hawley, in a
low tone. “But there seems so little strength to him. I can’t realize
that he has ever been such a rosy, rollicking boy as that Stuart; and
yet I do not see why he should not have been. Well, we have done
our best, Mrs. Whitcomb, and the good parson has prayed; so we
must leave all the rest in God’s hands. Don’t let him sleep more than
an hour at a time, and then give him a teaspoonful of this, out of the
glass—remember.”
I didn’t want to go to bed. I crept up to the room, and Mrs.
Whitcomb, and the other strange, uncertain presence, standing by
the window and watching the great stars and the little flecks of silver
cloud threading their way in and out like dainty ladies. I was so afraid
of death, too! and yet I wanted to stay. I thought of Stephen’s
perplexity concerning his brothers, and did not wonder at it now. I
was sorry that I had been so ungracious that night; but I had made
all the amends I could. And I prayed softly for the sick boy, that he
might live to a better and less selfish life, that he might see and know
the great things there are for men to do in the world.
Twelve. The old eight-day clock in the hall told it off in a solemn
way, and went on ticking “forever, never,” and Mrs. Whitcomb
breathed in her chair as if she were asleep; but in a moment she
rose and gave the medicine.
“You had better lie down here on the couch, Rose. Here is a
pillow.”
“No; I am not sleepy.” And crossing my arms on the window sill, I
rested my chin on them, and watched the stars again.
One, two, three; and the summer night began to show signs of
drowsiness. The stars grew dimmer, and there was a peculiar
grayish duskiness in the heavens. Then a faint stirring in the east, a
melting of the gray into rose and gold, a piping of birds in the leafy
trees, and a strange tremulousness in all the air. I turned away from
the window and glanced at the pallid face, put my fingers on the thin
wrist. Had the resurrection of the morning reached him?
“O, Mrs. Whitcomb,” I exclaimed, “his pulse is stronger! I believe
he will live. I am so thankful!”
“Now run to bed, dear. You have had your way, and sat up all
night.”
I did fall asleep, and never woke until the breakfast bell rang. Dr.
Hawley came in bright and early, and the verdict was favorable.
“Now you must feed him on beef tea, and I’ll feed him on iron,” he
said to Mrs. Whitcomb. “We will run a race to see which can get the
most fat on his bones. Goodness knows there’s need enough of it.
He seems to have put into practice some one’s suggestion, to take
off his flesh and sit in his bones a space. Cool, for this hot weather.”
“I suppose we can venture to be a little jolly now,” Stuart said, that
afternoon, as we were all on the porch. “We have been going about
this whole week like a funeral procession.”
“There might have been one—very easily,” I replied, with as much
sternness as I could put in my voice.
“But when you are through the woods, what is the use of
frightening yourself with the darkness and the ‘bug-a-boos’? Isn’t that
what you tell children? I never really believed that he was going to
die. It is only your good people—”
“Then there is not much fear of you,” said Fan.
“Thank Goodness, no. I mean to have a deal of fun out of life yet.
Just wait until I can get my hands into the money. There will be larks
then, I can tell you. Meanwhile, may we not dissipate harmlessly on
croquet?”
“I think not,” was my answer. “Your brother is very weak and
nervous; and I have sometimes found the click of the balls hard to
bear myself.”
“Hang it! I wish he was in—England with Stephen. He is always
putting on airs of some kind. Before I’d be such a Molly-fuss-budget
I’d go off and hang myself, and leave my money to the nearest of
kin.”
“O, Stuart,” I exclaimed, “you are perfectly—”
“There, don’t preach to me, you small midget! I hate girls’
preaching. It’s hard enough to have it on Sundays. Can a leopard
change his spots? Yes, he can go off to another spot. So I’ll go.
Adieu, little grandmother.”
He caught his hat, and walked down the garden path as if
whistling for a wager.
“There, you have made him angry,” declared Fan.
“I cannot help it. He doesn’t seem to care for anything. O!”
I was after him in a minute, for there he had Tabby by the nape of
the neck, holding her up high to see her draw up her feet and curl
her tail between her legs like a dog.
“Put her down!” I cried, authoritatively.
He held me off with one arm.
“Why, she likes it,” he said. “Look! what an angelic smile illumines
her countenance!”
“Mia-o-o-ow!” was kitty’s answer, in a prolonged wail; but she
managed to twist herself out of his grasp, and bounded off.
“You are a cruel, hateful boy!” I exclaimed, angrily.
But he only laughed, and went on his way whistling. Fan glanced
up from her embroidery.
“It is tit for tat,” she said, laughingly; “preaching and practice.”
I was quiet for some minutes.
“Do I preach much, Fan?” I asked, rather soberly.
“Not very much. But it may be as dangerous a habit as scolding, if
one gets confirmed in it. And I suppose it isn’t entertaining to boys.”
“But what are you to do when they are just as bad as they can
be?”
“Bear it with Christian fortitude and resignation. I am not sure but it
will be good for us to have something that takes us out of the one
groove, and shows us that the world is wider than the little space just
around us.”
There was much truth in that, to be sure.
“You see we have had everything pretty much one way; and now
we have come to a change in the current. I rather like the stir and
freshening up.”
“But if Tabby was yours—”
“You remember the old lady whose idea of heaven was to ‘sit in a
clean checked apron, and sing psalms;’ and I think yours must be to
sit here on the porch, in a clean white dress, and nurse that sleek
Maltese cat.”
“O, Fan, how can you be so irreverent?”
I heard the faint tinkle of a bell; so I ran up stairs. Mrs. Whitcomb
asked me to sit there while she went out for a walk. I took up some
crocheting, and, as I worked, watched the wind blowing about the
high tree-tops, and making picturesque backgrounds of the blue sky.
Then a wood robin came and sang his sweet song almost in my ear.
The sick youth stirred and opened his eyes wide. How strange and
sunken they looked!
“Where am I?”
I started at the question, and collected my wandering senses.
“At the rectory. At Mr. Endicott’s.”
“O! Have I been sick? How long since—I can’t seem to remember
—”
“It is almost a fortnight since you were taken ill. But you are out of
all danger, and have only to get well.”
“I suppose I have been a great deal of trouble. Did I talk much?”
And he glanced sharply at me.
“No; that is, it was not of much account.”
“Where is Stuart?”
“Out somewhere.”
“May I have a drink?”
I gave him that.
“And you have been taking care of me—all the time?”
“Not all. Mamma and Mrs. Whitcomb have done the most of it.”
“Was I near dying?”
“We thought so, at one time,” I answered, rather slowly, not feeling
quite sure that the admission was right.
“It wouldn’t have been much loss. Both Stephen and Stuart would
have been glad, no doubt, or, at least, relieved. Don’t look so horror-
stricken.”
“I think you are unjust to both your brothers,” I said. “But perhaps it
is best not to talk any more. You are still weak.”
He turned his face over on the pillow, and was silent until mamma
came in and spoke in her cheerful fashion.
“You have all been very kind, much kinder than I deserve. How
long will it take me to get well?”
“That depends a good deal upon yourself,” returned mamma.
“When you feel like it, you may begin to sit up. And you must keep
as cheerful as possible. Are you not hungry?”
He thought he was presently; but he made a wry face over the
beef tea.
“Can’t I have something besides this?” he asked. “I am so tired of
it!”
“Then you may take it hereafter as medicine, and we will find a
new article of diet. I am glad that you are sufficiently improved to
desire a change. I will see what I can find for you.”
She was as good as her word; and Mrs. Whitcomb brought him up
the cunningest tea in the old-fashioned china, and a fresh nosegay
of spice pinks lying beside his plate.
“O, how delightful they are! I am very much obliged,” he said,
gratefully.
That evening Kate Fairlie and her brother Dick came over to call
upon us.
“I heard your invalid was out of danger, or I should not have
ventured,” she began, after the first greetings were over, “for it is not
a call of condolence merely. Fan, aren’t you glad school is over? But
what can you find to occupy yourself with? I am actually bored to
death already. We are to have some company from the city next
week, and we want to get up a picnic to go to Longmeadow. Won’t
you two girls join, and the young Mr. Duncan who isn’t sick? Dick
thinks him such a funny fellow. Where is he? Can’t I have an
introduction? The boys all seem to know him very well. And is it true
that they are so rich?”
“They are very well provided for,” said Fan, quietly.
“And was that handsome man who came to church with you one
Sunday, not long ago, their brother? Has he gone to make the grand
tour of Europe? O, how I do envy people who can go abroad!”

You might also like