100% found this document useful (3 votes)
213 views55 pages

Instant Download Probability and Statistics For Computer Scientists Third Edition Michael Baron PDF All Chapter

computer

Uploaded by

bilkahigero9
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 (3 votes)
213 views55 pages

Instant Download Probability and Statistics For Computer Scientists Third Edition Michael Baron PDF All Chapter

computer

Uploaded by

bilkahigero9
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/ 55

Download the Full Version of textbook for Fast Typing at textbookfull.

com

Probability and statistics for computer scientists


Third Edition Michael Baron

https://textbookfull.com/product/probability-and-statistics-
for-computer-scientists-third-edition-michael-baron/

OR CLICK BUTTON

DOWNLOAD NOW

Download More textbook Instantly Today - Get Yours Now at textbookfull.com


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

Probability statistics for engineers scientists Walpole

https://textbookfull.com/product/probability-statistics-for-engineers-
scientists-walpole/

textboxfull.com

Introduction to Probability and Statistics for Engineers


and Scientists 6th Edition Sheldon M. Ross

https://textbookfull.com/product/introduction-to-probability-and-
statistics-for-engineers-and-scientists-6th-edition-sheldon-m-ross/

textboxfull.com

Analysis for Computer Scientists Foundations Methods and


Algorithms Michael Oberguggenberger

https://textbookfull.com/product/analysis-for-computer-scientists-
foundations-methods-and-algorithms-michael-oberguggenberger/

textboxfull.com

Probability and statistics with reliability queueing and


computer science applications Trivedi

https://textbookfull.com/product/probability-and-statistics-with-
reliability-queueing-and-computer-science-applications-trivedi/

textboxfull.com
Statistics and Probability with Applications for Engineers
and Scientists Using MINITAB, R and JMP 2nd Edition
Bhisham C. Gupta
https://textbookfull.com/product/statistics-and-probability-with-
applications-for-engineers-and-scientists-using-minitab-r-and-jmp-2nd-
edition-bhisham-c-gupta/
textboxfull.com

Probability, Statistics, and Stochastic Processes for


Engineers and Scientists (Mathematical Engineering,
Manufacturing, and Management Sciences) First Edition
Aliakbar Montazer Haghighi
https://textbookfull.com/product/probability-statistics-and-
stochastic-processes-for-engineers-and-scientists-mathematical-
engineering-manufacturing-and-management-sciences-first-edition-
aliakbar-montazer-haghighi/
textboxfull.com

Statistics for Engineers and Scientists William Navidi

https://textbookfull.com/product/statistics-for-engineers-and-
scientists-william-navidi/

textboxfull.com

Statistics for Engineers and Scientists 5th Edition


William Navidi

https://textbookfull.com/product/statistics-for-engineers-and-
scientists-5th-edition-william-navidi/

textboxfull.com

Python for Probability Statistics and Machine Learning


José Unpingco

https://textbookfull.com/product/python-for-probability-statistics-
and-machine-learning-jose-unpingco/

textboxfull.com
Probability and Statistics for
Computer Scientists
Third Edition
Probability and Statistics for
Computer Scientists
Third Edition

Michael Baron
Department of Mathematics and Statistics
College of Arts and Sciences
American University
Washington DC
MATLAB is a trademark of The MathWorks, Inc. and is used with permission. The MathWorks does
not warrant the accuracy of the text or exercises in this book. This book’s use or discussion of MATLAB
software or related products does not constitute endorsement or sponsorship by The MathWorks of a par-
ticular pedagogical approach or particular use of the MATLAB software.

CRC Press
Taylor & Francis Group
6000 Broken Sound Parkway NW, Suite 300
Boca Raton, FL 33487-2742

© 2019 by Taylor & Francis Group, LLC


CRC Press is an imprint of Taylor & Francis Group, an Informa business

No claim to original U.S. Government works

Printed on acid-free paper

International Standard Book Number-13: 978-1-138-04448-7 (Hardback)

This book contains information obtained from authentic and highly regarded sources. Reasonable efforts
have been made to publish reliable data and information, but the author and publisher cannot assume
responsibility for the validity of all materials or the consequences of their use. The authors and publishers
have attempted to trace the copyright holders of all material reproduced in this publication and apologize
to copyright holders if permission to publish in this form has not been obtained. If any copyright material
has not been acknowledged please write and let us know so we may rectify in any future reprint.

Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, trans-
mitted, or utilized in any form by any electronic, mechanical, or other means, now known or hereafter
invented, including photocopying, microfilming, and recording, or in any information storage or retrieval
system, without written permission from the publishers.

For permission to photocopy or use material electronically from this work, please access www.copyright.com
(http://www.copyright.com/) or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive,
Danvers, MA 01923, 978-750-8400. CCC is a not-for-profit organization that provides licenses and registra-
tion for a variety of users. For organizations that have been granted a photocopy license by the CCC, a
separate system of payment has been arranged.

Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are
used only for identification and explanation without intent to infringe.

Library of Congress Cataloging-in-Publication Data

Names: Baron, Michael, 1968- author.


Title: Probability and statistics for computer scientists / Michael Baron.
Description: Third edition. | Boca Raton : CRC Press, Taylor & Francis Group, 2019. |
Includes index.
Identifiers: LCCN 2019006958 | ISBN 9781138044487 (hardback : alk. paper)
Subjects: LCSH: Probabilities--Textbooks. | Mathematical statistics--Textbooks. |
Probabilities--Computer simulation--Textbooks. | Mathematical statistics--Computer
simulation--Textbooks.
Classification: LCC QA273 .B2575 2019 | DDC 519.201/13--dc23
LC record available at https://lccn.loc.gov/2019006958

Visit the Taylor & Francis Web site at


http://www.taylorandfrancis.com

and the CRC Press Web site at


http://www.crcpress.com
To my parents – Genrietta and Izrael-Vulf Baron
Contents

Preface xv

1 Introduction and Overview 1

1.1 Making decisions under uncertainty . . . . . . . . . . . . . . . . . . . . . . 1


1.2 Overview of this book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Summary and conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

I Probability and Random Variables 7

2 Probability 9

2.1 Events and their probabilities . . . . . . . . . . . . . . . . . . . . . . . . . 9


2.1.1 Outcomes, events, and the sample space . . . . . . . . . . . . . . . . 10
2.1.2 Set operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.2 Rules of Probability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.2.1 Axioms of Probability . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.2.2 Computing probabilities of events . . . . . . . . . . . . . . . . . . . 15
2.2.3 Applications in reliability . . . . . . . . . . . . . . . . . . . . . . . . 18
2.3 Combinatorics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.3.1 Equally likely outcomes . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.3.2 Permutations and combinations . . . . . . . . . . . . . . . . . . . . . 22
2.4 Conditional probability and independence . . . . . . . . . . . . . . . . . . . 27
Summary and conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

vii
viii Contents

3 Discrete Random Variables and Their Distributions 39

3.1 Distribution of a random variable . . . . . . . . . . . . . . . . . . . . . . . 40


3.1.1 Main concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.1.2 Types of random variables . . . . . . . . . . . . . . . . . . . . . . . . 44
3.2 Distribution of a random vector . . . . . . . . . . . . . . . . . . . . . . . . 44
3.2.1 Joint distribution and marginal distributions . . . . . . . . . . . . . 45
3.2.2 Independence of random variables . . . . . . . . . . . . . . . . . . . 46
3.3 Expectation and variance . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
3.3.1 Expectation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
3.3.2 Expectation of a function . . . . . . . . . . . . . . . . . . . . . . . . 49
3.3.3 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.3.4 Variance and standard deviation . . . . . . . . . . . . . . . . . . . . 50
3.3.5 Covariance and correlation . . . . . . . . . . . . . . . . . . . . . . . 51
3.3.6 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
3.3.7 Chebyshev’s inequality . . . . . . . . . . . . . . . . . . . . . . . . . . 54
3.3.8 Application to finance . . . . . . . . . . . . . . . . . . . . . . . . . . 55
3.4 Families of discrete distributions . . . . . . . . . . . . . . . . . . . . . . . . 57
3.4.1 Bernoulli distribution . . . . . . . . . . . . . . . . . . . . . . . . . . 58
3.4.2 Binomial distribution . . . . . . . . . . . . . . . . . . . . . . . . . . 59
3.4.3 Geometric distribution . . . . . . . . . . . . . . . . . . . . . . . . . . 61
3.4.4 Negative Binomial distribution . . . . . . . . . . . . . . . . . . . . . 63
3.4.5 Poisson distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
3.4.6 Poisson approximation of Binomial distribution . . . . . . . . . . . . 66
Summary and conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

4 Continuous Distributions 75

4.1 Probability density . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75


4.2 Families of continuous distributions . . . . . . . . . . . . . . . . . . . . . . 80
4.2.1 Uniform distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
4.2.2 Exponential distribution . . . . . . . . . . . . . . . . . . . . . . . . . 82
4.2.3 Gamma distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
4.2.4 Normal distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
4.3 Central Limit Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Summary and conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Contents ix

5 Computer Simulations and Monte Carlo Methods 103

5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103


5.1.1 Applications and examples . . . . . . . . . . . . . . . . . . . . . . . 104
5.2 Simulation of random variables . . . . . . . . . . . . . . . . . . . . . . . . . 105
5.2.1 Random number generators . . . . . . . . . . . . . . . . . . . . . . . 106
5.2.2 Discrete methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
5.2.3 Inverse transform method . . . . . . . . . . . . . . . . . . . . . . . . 110
5.2.4 Rejection method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
5.2.5 Generation of random vectors . . . . . . . . . . . . . . . . . . . . . . 114
5.2.6 Special methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
5.3 Solving problems by Monte Carlo methods . . . . . . . . . . . . . . . . . . 116
5.3.1 Estimating probabilities . . . . . . . . . . . . . . . . . . . . . . . . . 116
5.3.2 Estimating means and standard deviations . . . . . . . . . . . . . . 120
5.3.3 Forecasting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
5.3.4 Estimating lengths, areas, and volumes . . . . . . . . . . . . . . . . 123
5.3.5 Monte Carlo integration . . . . . . . . . . . . . . . . . . . . . . . . . 125
Summary and conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128

II Stochastic Processes 133

6 Stochastic Processes 135

6.1 Definitions and classifications . . . . . . . . . . . . . . . . . . . . . . . . . . 136


6.2 Markov processes and Markov chains . . . . . . . . . . . . . . . . . . . . . 137
6.2.1 Markov chains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
6.2.2 Matrix approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
6.2.3 Steady-state distribution . . . . . . . . . . . . . . . . . . . . . . . . . 146
6.3 Counting processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
6.3.1 Binomial process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
6.3.2 Poisson process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
6.4 Simulation of stochastic processes . . . . . . . . . . . . . . . . . . . . . . . 161
Summary and conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
x Contents

7 Queuing Systems 171

7.1 Main components of a queuing system . . . . . . . . . . . . . . . . . . . . . 172


7.2 The Little’s Law . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
7.3 Bernoulli single-server queuing process . . . . . . . . . . . . . . . . . . . . 177
7.3.1 Systems with limited capacity . . . . . . . . . . . . . . . . . . . . . . 181
7.4 M/M/1 system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
7.4.1 Evaluating the system’s performance . . . . . . . . . . . . . . . . . . 185
7.5 Multiserver queuing systems . . . . . . . . . . . . . . . . . . . . . . . . . . 189
7.5.1 Bernoulli k-server queuing process . . . . . . . . . . . . . . . . . . . 190
7.5.2 M/M/k systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
7.5.3 Unlimited number of servers and M/M/∞ . . . . . . . . . . . . . . . 196
7.6 Simulation of queuing systems . . . . . . . . . . . . . . . . . . . . . . . . . 198
Summary and conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203

III Statistics 211

8 Introduction to Statistics 213

8.1 Population and sample, parameters and statistics . . . . . . . . . . . . . . 214


8.2 Descriptive statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
8.2.1 Mean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
8.2.2 Median . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
8.2.3 Quantiles, percentiles, and quartiles . . . . . . . . . . . . . . . . . . 223
8.2.4 Variance and standard deviation . . . . . . . . . . . . . . . . . . . . 225
8.2.5 Standard errors of estimates . . . . . . . . . . . . . . . . . . . . . . . 227
8.2.6 Interquartile range . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
8.3 Graphical statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
8.3.1 Histogram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
8.3.2 Stem-and-leaf plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
8.3.3 Boxplot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
8.3.4 Scatter plots and time plots . . . . . . . . . . . . . . . . . . . . . . . 237
Summary and conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Contents xi

9 Statistical Inference I 243

9.1 Parameter estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244


9.1.1 Method of moments . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
9.1.2 Method of maximum likelihood . . . . . . . . . . . . . . . . . . . . . 248
9.1.3 Estimation of standard errors . . . . . . . . . . . . . . . . . . . . . . 252
9.2 Confidence intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
9.2.1 Construction of confidence intervals: a general method . . . . . . . . 255
9.2.2 Confidence interval for the population mean . . . . . . . . . . . . . . 257
9.2.3 Confidence interval for the difference between two means . . . . . . 258
9.2.4 Selection of a sample size . . . . . . . . . . . . . . . . . . . . . . . . 260
9.2.5 Estimating means with a given precision . . . . . . . . . . . . . . . . 261
9.3 Unknown standard deviation . . . . . . . . . . . . . . . . . . . . . . . . . . 262
9.3.1 Large samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
9.3.2 Confidence intervals for proportions . . . . . . . . . . . . . . . . . . 263
9.3.3 Estimating proportions with a given precision . . . . . . . . . . . . . 265
9.3.4 Small samples: Student’s t distribution . . . . . . . . . . . . . . . . . 266
9.3.5 Comparison of two populations with unknown variances . . . . . . . 268
9.4 Hypothesis testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
9.4.1 Hypothesis and alternative . . . . . . . . . . . . . . . . . . . . . . . 272
9.4.2 Type I and Type II errors: level of significance . . . . . . . . . . . . 273
9.4.3 Level α tests: general approach . . . . . . . . . . . . . . . . . . . . . 274
9.4.4 Rejection regions and power . . . . . . . . . . . . . . . . . . . . . . . 276
9.4.5 Standard Normal null distribution (Z-test) . . . . . . . . . . . . . . 277
9.4.6 Z-tests for means and proportions . . . . . . . . . . . . . . . . . . . 279
9.4.7 Pooled sample proportion . . . . . . . . . . . . . . . . . . . . . . . . 281
9.4.8 Unknown σ: T-tests . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
9.4.9 Duality: two-sided tests and two-sided confidence intervals . . . . . . 284
9.4.10 P-value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
9.5 Inference about variances . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
9.5.1 Variance estimator and Chi-square distribution . . . . . . . . . . . . 293
9.5.2 Confidence interval for the population variance . . . . . . . . . . . . 295
9.5.3 Testing variance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
9.5.4 Comparison of two variances. F-distribution. . . . . . . . . . . . . . 299
9.5.5 Confidence interval for the ratio of population variances . . . . . . . 301
9.5.6 F-tests comparing two variances . . . . . . . . . . . . . . . . . . . . 303
Summary and conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
xii Contents

10 Statistical Inference II 315

10.1 Chi-square tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315


10.1.1 Testing a distribution . . . . . . . . . . . . . . . . . . . . . . . . . . 316
10.1.2 Testing a family of distributions . . . . . . . . . . . . . . . . . . . . 318
10.1.3 Testing independence . . . . . . . . . . . . . . . . . . . . . . . . . . 321
10.2 Nonparametric statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
10.2.1 Sign test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
10.2.2 Wilcoxon signed rank test . . . . . . . . . . . . . . . . . . . . . . . . 328
10.2.3 Mann–Whitney–Wilcoxon rank sum test . . . . . . . . . . . . . . . . 334
10.3 Bootstrap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
10.3.1 Bootstrap distribution and all bootstrap samples . . . . . . . . . . . 340
10.3.2 Computer generated bootstrap samples . . . . . . . . . . . . . . . . 345
10.3.3 Bootstrap confidence intervals . . . . . . . . . . . . . . . . . . . . . . 348
10.4 Bayesian inference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
10.4.1 Prior and posterior . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
10.4.2 Bayesian estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
10.4.3 Bayesian credible sets . . . . . . . . . . . . . . . . . . . . . . . . . . 360
10.4.4 Bayesian hypothesis testing . . . . . . . . . . . . . . . . . . . . . . . 364
Summary and conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366

11 Regression 375

11.1 Least squares estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376


11.1.1 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
11.1.2 Method of least squares . . . . . . . . . . . . . . . . . . . . . . . . . 378
11.1.3 Linear regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
11.1.4 Regression and correlation . . . . . . . . . . . . . . . . . . . . . . . . 382
11.1.5 Overfitting a model . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
11.2 Analysis of variance, prediction, and further inference . . . . . . . . . . . . 383
11.2.1 ANOVA and R-square . . . . . . . . . . . . . . . . . . . . . . . . . . 383
11.2.2 Tests and confidence intervals . . . . . . . . . . . . . . . . . . . . . . 385
11.2.3 Prediction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391
11.3 Multivariate regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
Contents xiii

11.3.1 Introduction and examples . . . . . . . . . . . . . . . . . . . . . . . 395


11.3.2 Matrix approach and least squares estimation . . . . . . . . . . . . . 396
11.3.3 Analysis of variance, tests, and prediction . . . . . . . . . . . . . . . 398
11.4 Model building . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
11.4.1 Adjusted R-square . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
11.4.2 Extra sum of squares, partial F-tests, and variable selection . . . . . 405
11.4.3 Categorical predictors and dummy variables . . . . . . . . . . . . . . 408
Summary and conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412

Appendix 417

A.1 Data sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417


A.2 Inventory of distributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
A.2.1 Discrete families . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
A.2.2 Continuous families . . . . . . . . . . . . . . . . . . . . . . . . . . . 422
A.3 Distribution tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
A.4 Calculus review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
A.4.1 Inverse function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
A.4.2 Limits and continuity . . . . . . . . . . . . . . . . . . . . . . . . . . 443
A.4.3 Sequences and series . . . . . . . . . . . . . . . . . . . . . . . . . . . 444
A.4.4 Derivatives, minimum, and maximum . . . . . . . . . . . . . . . . . 444
A.4.5 Integrals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446
A.5 Matrices and linear systems . . . . . . . . . . . . . . . . . . . . . . . . . . . 449
A.6 Answers to selected exercises . . . . . . . . . . . . . . . . . . . . . . . . . . 455

Index 461
Preface

Starting with the fundamentals of probability, this text leads readers to computer simula-
tions and Monte Carlo methods, stochastic processes and Markov chains, queuing systems,
statistical inference, and regression. These areas are heavily used in modern computer sci-
ence, computer engineering, software engineering, and related fields.

For whom this book is written

The book is primarily intended for junior undergraduate to beginning graduate level stu-
dents majoring in computer-related fields – computer science, software engineering, infor-
mation systems, data science, information technology, telecommunications, etc. At the same
time, it can be used by electrical engineering, mathematics, statistics, natural science, and
other majors for a standard calculus-based introductory statistics course. Standard topics
in probability and statistics are covered in Chapters 1–4 and 8–9.
Graduate students can use this book to prepare for probability-based courses such as queu-
ing theory, artificial neural networks, computer performance, etc.
The book can also be used as a standard reference on probability and statistical methods,
simulation, and modeling tools.

Recommended courses

The text is recommended for a one-semester course with several open-end options available.
At the same time, with the new material added in the second and the third editions, the
book can serve as a text for a full two-semester course in Probability and Statistics.
After introducing probability and distributions in Chapters 1–4, instructors may choose the
following continuations, see Figure 1.
Probability-oriented course. Proceed to Chapters 6–7 for Stochastic Processes, Markov
Chains, and Queuing Theory. Computer science majors will find it attractive to supple-
ment such a course with computer simulations and Monte Carlo methods. Students can
learn and practice general simulation techniques in Chapter 5, then advance to the simu-
lation of stochastic processes and rather complex queuing systems in Sections 6.4 and 7.6.
Chapter 5 is highly recommended but not required for the rest of the material.
Statistics-focused course. Proceed to Chapters 8–9 directly after the probability core, fol-
lowed by additional topics in Statistics selected from Chapters 10 and 11. Such a curriculum
is more standard, and it is suitable for a wide range of majors. Chapter 5 remains optional
but recommended; it discusses statistical methods based on computer simulations. Modern
bootstrap techniques in Section 10.3 will attractively continue this discussion.
A course satisfying ABET requirements. Topics covered in this book satisfy ABET (Accred-
itation Board for Engineering and Technology) requirements for probability and statistics.

xv
xvi Preface

Chap. 6 Chap. 7
Stochastic - Queuing
> Processes Theory

R R
Chap. 1–4 Chap. 5 Sec. 6.4 Sec. 7.6
Probability - Monte Carlo - Simulation of - Simulation
Stochastic of Queuing
Core Methods Processes Systems

Chap. 10
R Advanced
~ Chap. 8–9 > Statistics
Statistics
Core
~ Chap. 11
Regression

FIGURE 1: Flow-chart of chapters.

To meet the requirements, instructors should choose topics from Chapters 1–11. All or some
of Chapters 5–7 and 10–11 may be considered optional, depending on the program’s ABET
objectives.
A two-semester course will cover all Chapters 1–11, possibly skipping some sections. The
material presented in this book splits evenly between Probability topics for the first semester
(Chapters 1–7) and Statistics topics for the second semester (Chapters 8–11).

Prerequisites, and use of the appendix

Working differentiation and integration skills are required starting from Chapter 4. They
are usually covered in one semester of university calculus.
As a refresher, the appendix has a very brief summary of the minimum calculus techniques
required for reading this book (Section A.4). Certainly, this section cannot be used to learn
calculus “from scratch”. It only serves as a reference and student aid.
Next, Chapters 6–7 and Sections 11.3–11.4 rely on very basic matrix computations. Es-
sentially, readers should be able to multiply matrices, solve linear systems (Chapters 6–7),
and compute inverse matrices (Section 11.3). A basic refresher of these skills with some
examples is in the appendix, Section A.5.

Style and motivation

The book is written in a lively style and reasonably simple language that students find easy
to read and understand. Reading this book, students should feel as if an experienced and
enthusiastic lecturer is addressing them in person.
Preface xvii

Besides computer science applications and multiple motivating examples, the book contains
related interesting facts, paradoxical statements, wide applications to other fields, etc. I
expect prepared students to enjoy the course, benefit from it, and find it attractive and
useful for their careers.
Every chapter contains multiple examples with explicit solutions, many of them motivated
by computer science applications. Every chapter is concluded with a short summary and
more exercises for homework assignments and self-training. Over 270 problems can be as-
signed from this book.

Computers, data, demos, illustrations, R, and MATLAB

Frequent self-explaining figures help readers understand and visualize concepts, formulas,
and even some proofs. Moreover, instructors and students are invited to use included short
programs for computer demonstrations. Randomness, uncertainty, behavior of random vari-
ables and stochastic processes, convergence results such as the Central Limit Theorem, and
especially Monte Carlo simulations can be nicely visualized by animated graphics.
These short computer codes contain very basic and simple commands, written in R and
MATLAB with detailed commentary. Preliminary knowledge of these languages is not
necessary. Readers can also choose another software and reproduce the given commands in
it line by line or use them as a flow-chart.
Instructors have options of teaching the course with R, MATLAB, both of them, some other
software, or with no software at all.
Having understood computerized examples in the text, students will use similar codes to
complete the projects and mini-projects proposed in this book.
For educational purposes, data sets used in the book are not large. They are printed in the
book, typically at the first place where they are used, and also, placed in our data inventory
on the web site http://fs2.american.edu/baron/www/Book/. Students can either type
them as part of their computer programs, or they can download the data files given in text
and comma-separated value formats. All data sets are listed in Section A.1, where we also
teach how to read them into R and MATLAB.

Second edition and advanced statistics topics

Broad feedback coming from professors who use this book for their courses in different
countries motivated me to work on the second edition. As a result, the Statistical Inference
chapter expanded and split into Chapters 9 and 10. The added material is organized in the
new sections, according to Table 0.1.
Also, the 2nd edition has about 60 additional exercises. Enjoy practicing, dear students,
you will only benefit from extra training!

Third edition and R

The main news in the 3rd edition is the use of R, a popular software for statistical com-
puting. MATLAB has fulfilled its mission in earlier editions as a tool for computer demon-
strations, simulations, animated graphics, and basic statistical methods with easy-to-read
xviii Preface

New sections in the 2nd edition


Axioms of probability 2.2.1
Standard errors of estimates 8.2.5
Estimation of standard errors 9.1.3
Inference about variances 9.5
Estimation, confidence intervals, and hypothesis testing for
the population variance and for the ratio of variances.
Chi-square distribution and F-distribution.
Chi-square tests 10.1
Testing distributions and families of distributions;
goodness of fit tests; contingency tables.
Nonparametric statistics 10.2
Sign test; Wilcoxon signed rank test;
Mann–Whitney–Wilcoxon rank sum test.
Bootstrap 10.3
Estimating properties of estimators;
Bootstrap confidence intervals.

TABLE 0.1: New material in the 2nd edition.

codes. At the same time, expansion of Statistics chapters, adoption of this book in a number
of universities across four continents, and broad feedback from course instructors (thank
you, colleagues!) prompted me to add R examples parallel to MATLAB.
R, an unbelievably popular and still developing statistical software, is freely avail-
able for a variety of operating systems for anyone to install from the site
https://www.r-project.org/. The same site contains links to support, news, and other
information about R. Supplementary to basic R, one can invoke numerous additional pack-
ages written by different users for various statistical methods. Some of them will be used in
this book.

Thanks and acknowledgments

The author is grateful to Taylor & Francis Group for their constant professional help, respon-
siveness, support, and encouragement. Special thanks are due David Grubbs, Bob Stern,
Marcus Fontaine, Jill Jurgensen, Barbara Johnson, Rachael Panthier, and Shashi Kumar.
Many thanks go to my colleagues at American University, the University of Texas at Dal-
las, and other universities for their inspiring support and invaluable feedback, especially to
Professors Stephen Casey, Betty Malloy, and Nathalie Japkowicz from American University,
Farid Khafizov and Pankaj Choudhary from UT-Dallas, Joan Staniswalis and Amy Wagler
from UT-El Paso, Lillian Cassel from Villanova, Alan Sprague from the University of Al-
abama, Katherine Merrill from the University of Vermont, Alessandro Di Bucchianico from
Eindhoven University of Technology, Marc Aerts from Hasselt University, Pratik Shah from
the Indian Institute of Information Technology in Vadodara, and Magagula Vusi Mpendulo
from the University of Eswatini. I am grateful to Elena Baron for creative illustrations; Kate
Pechekhonova for interesting examples; and last but not least, to Eric, Anthony, Masha,
and Natasha Baron for their amazing patience and understanding.
Preface xix

MATLAB is a registered trademark of The MathWorks, Inc. For product information


please contact:
The MathWorks, Inc.
3 Apple Hill Drive
Natick, MA, 01760-2098 USA
Tel: 508-647-7000
Fax: 508-647-7001
E-mail: [email protected]
Web: www.mathworks.com
Chapter 1
Introduction and Overview

1.1 Making decisions under uncertainty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1


1.2 Overview of this book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Summary and conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

1.1 Making decisions under uncertainty

This course is about uncertainty, measuring and quantifying uncertainty, and making de-
cisions under uncertainty. Loosely speaking, by uncertainty we mean the condition when
results, outcomes, the nearest and remote future are not completely determined; their de-
velopment depends on a number of factors and just on a pure chance.
Simple examples of uncertainty appear when you buy a lottery ticket, turn a wheel of
fortune, or toss a coin to make a choice.
Uncertainly appears in virtually all areas of Computer Science and Software Engineering.
Installation of software requires uncertain time and often uncertain disk space. A newly
released software contains an uncertain number of defects. When a computer program is
executed, the amount of required memory may be uncertain. When a job is sent to a printer,
it takes uncertain time to print, and there is always a different number of jobs in a queue
ahead of it. Electronic components fail at uncertain times, and the order of their failures
cannot be predicted exactly. Viruses attack a system at unpredictable times and affect an
unpredictable number of files and directories.
Uncertainty surrounds us in everyday life, at home, at work, in business, and in leisure. To
take a snapshot, let us listen to the evening news.

Example 1.1 . We may find out that the stock market had several ups and downs today
which were caused by new contracts being made, financial reports being released, and other
events of this sort. Many turns of stock prices remained unexplained. Clearly, nobody would
have ever lost a cent in stock trading had the market contained no uncertainty.
We may find out that a launch of a space shuttle was postponed because of weather con-
ditions. Why did not they know it in advance, when the event was scheduled? Forecasting
weather precisely, with no error, is not a solvable problem, again, due to uncertainty.

To support these words, a meteorologist predicts, say, a 60% chance of rain. Why cannot
she let us know exactly whether it will rain or not, so we’ll know whether or not to take
our umbrellas? Yes, because of uncertainty. Because she cannot always know the situation
with future precipitation for sure.

1
2 Probability and Statistics for Computer Scientists

We may find out that eruption of an active volcano has suddenly started, and it is not clear
which regions will have to evacuate.
We may find out that a heavily favored home team unexpectedly lost to an outsider, and
a young tennis player won against expectations. Existence and popularity of totalizators,
where participants place bets on sports results, show that uncertainty enters sports, results
of each game, and even the final standing.
We may also hear reports of traffic accidents, crimes, and convictions. Of course, if that
driver knew about the coming accident ahead of time, he would have stayed home. ♦

Certainly, this list can be continued (at least one thing is certain!). Even when you drive
to your college tomorrow, you will see an unpredictable number of green lights when you
approach them, you will find an uncertain number of vacant parking slots, you will reach
the classroom at an uncertain time, and you cannot be certain now about the number of
classmates you will find in the classroom when you enter it.
Realizing that many important phenomena around us bear uncertainty, we have to un-
derstand it and deal with it. Most of the time, we are forced to make decisions under
uncertainty. For example, we have to deal with internet and e-mail knowing that we may
not be protected against all kinds of viruses. New software has to be released even if its
testing probably did not reveal all the defects. Some memory or disk quota has to be allo-
cated for each customer by servers, internet service providers, etc., without knowing exactly
what portion of users will be satisfied with these limitations. And so on.
This book is about measuring and dealing with uncertainty and randomness. Through basic
theory and numerous examples, it teaches

– how to evaluate probabilities, or chances of different results (when the exact result is
uncertain),
– how to select a suitable model for a phenomenon containing uncertainty and use it in
subsequent decision making,

– how to evaluate performance characteristics and other important parameters for new
devices and servers,

– how to make optimal decisions under uncertainty.

Summary and conclusion

Uncertainty is a condition when the situation cannot be predetermined or predicted for


sure with no error. Uncertainty exists in computer science, software engineering, in many
aspects of science, business, and our everyday life. It is an objective reality, and one has to
be able to deal with it. We are forced to make decisions under uncertainty.
Introduction and Overview 3

1.2 Overview of this book


The next chapter introduces a language that we’ll use to describe and quantify uncertainty.
It is a language of Probability. When outcomes are uncertain, one can identify more likely
and less likely ones and assign, respectively, high and low probabilities to them. Probabilities
are numbers between 0 and 1, with 0 being assigned to an impossible event and 1 being the
probability of an event that occurs for sure.
Next, using the introduced language, we shall discuss random variables as quantities that
depend on chance. They assume different values with different probabilities. Due to un-
certainty, an exact value of a random variable cannot be computed before this variable is
actually observed or measured. Then, the best way to describe its behavior is to list all its
possible values along with the corresponding probabilities.
Such a collection of probabilities is called a distribution. Amazingly, many different phe-
nomena of seemingly unrelated nature can be described by the same distribution or by the
same family of distributions. This allows a rather general approach to the entire class of
situations involving uncertainty. As an application, it will be possible to compute probabil-
ities of interest, once a suitable family of distributions is found. Chapters 3 and 4 introduce
families of distributions that are most commonly used in computer science and other fields.
In modern practice, however, one often deals with rather complicated random phenom-
ena where computation of probabilities and other quantities of interest is far from being
straightforward. In such situations, we will make use of Monte Carlo methods (Chapter 5).
Instead of direct computation, we shall learn methods of simulation or generation of random
variables. If we are able to write a computer code for simulation of a certain phenomenon,
we can immediately put it in a loop and simulate such a phenomenon thousands or millions
of times and simply count how many times our event of interest occurred. This is how we
shall distinguish more likely and less likely events. We can then estimate probability of an
event by computing a proportion of simulations that led to the occurrence of this event.
As a step up to the next level, we shall realize that many random variables depend not only
on a chance but also on time. That is, they evolve and develop in time while being random
at each particular moment. Examples include the number of concurrent users, the number
of jobs in a queue, the system’s available capacity, intensity of internet traffic, stock prices,
air temperature, etc. A random variable that depends on time is called a stochastic process.
In Chapter 6, we study some commonly used types of stochastic processes and use these
models to compute probabilities of events and other quantities of interest.
An important application of virtually all the material acquired so far lies in queuing systems
(Chapter 7). These are systems of one or several servers performing certain tasks and
serving jobs or customers. There is a lot of uncertainty in such systems. Customers arrive
at unpredictable times, spend random time waiting in a queue, get assigned to a server,
spend random time receiving service, and depart (Figure 1.1). In simple cases, we shall use
our methods of computing probabilities and analyzing stochastic processes to compute such
important characteristics of a queuing system as the utilization of a server, average waiting
time of customers, average response time (from arrival until departure), average number of
jobs in the system at any time, or the proportion of time the server is idle. This is extremely
important for planning purposes. Performance characteristics can be recalculated for the
next year, when, say, the number of customers is anticipated to increase by 5%. As a result,
we’ll know whether the system will remain satisfactory or will require an upgrade.
4 Probability and Statistics for Computer Scientists

Server I

 R 
- Arrivals - - - - -
 Departures
Server II
  


R Server III

FIGURE 1.1: A queuing system with 3 servers.

When direct computation is too complicated, resource consuming, too approximate, or sim-
ply not feasible, we shall use Monte Carlo methods. The book contains standard examples
of computer codes simulating rather complex queuing systems and evaluating their vital
characteristics. The codes are written in R and MATLAB, with detailed explanations of
steps, and most of them can be directly translated to other computer languages.
Next, we turn to Statistical Inference. While in Probability, we usually deal with more or
less clearly described situations (models), in Statistics, all the analysis is based on collected
and observed data. Given the data, a suitable model (say, a family of distributions) is fitted,
its parameters are estimated, and conclusions are drawn concerning the entire totality of
observed and unobserved subjects of interest that should follow the same model.
A typical Probability problem sounds like this.

Example 1.2 . A folder contains 50 executable files. When a computer virus or a hacker
attacks the system, each file is affected with probability 0.2. Compute the probability that
during a virus attack, more than 15 files get affected. ♦

Notice that the situation is rather clearly described, in terms of the total number of files
and the chance of affecting each file. The only uncertain quantity is the number of affected
files, which cannot be predicted for sure.

A typical Statistics problem sounds like this.

Example 1.3 . A folder contains 50 executable files. When a computer virus or a hacker
attacks the system, each file is affected with probability p. It has been observed that during
a virus attack, 15 files got affected. Estimate p. Is there a strong indication that p is greater
than 0.2? ♦

This is a practical situation. A user only knows the objectively observed data: the number
of files in the folder and the number of files that got affected. Based on that, he needs to
estimate p, the proportion of all the files, including the ones in his system and any similar
systems. One may provide a point estimator of p, a real number, or may opt to construct a
confidence interval of “most probable” values of p. Similarly, a meteorologist may predict,
say, a temperature of 70o F, which, realistically, does not exclude a possibility of 69 or 72
degrees, or she may give us an interval by promising, say, between 68 and 72 degrees.
Introduction and Overview 5

Most forecasts are being made from a carefully and suitably chosen model that fits the data.
A widely used method is regression that utilizes the observed data to find a mathematical
form of relationship between two variables (Chapter 11). One variable is called predictor,
the other is response. When the relationship between them is established, one can use the
predictor to infer about the response. For example, one can more or less accurately estimate
the average installation time of a software given the size of its executable files. An even more
accurate inference about the response can be made based on several predictors such as the
size of executable files, amount of random access memory (RAM), and type of processor
and operating system. This type of data analysis will require multivariate regression.
Each method will be illustrated by numerous practical examples and exercises. As the ulti-
mate target, by the end of this course, students should be able to read a word problem or a
corporate report, realize the uncertainty involved in the described situation, select a suitable
probability model, estimate and test its parameters based on real data, compute probabil-
ities of interesting events and other vital characteristics, make meaningful conclusions and
forecasts, and explain these results to other people.

Summary and conclusions


In this course, uncertainty is measured and described on a language of Probability. Using
this language, we shall study random variables and stochastic processes and learn the most
commonly used types of distributions. In particular, we shall be able to find a suitable
stochastic model for the described situation and use it to compute probabilities and other
quantities of interest. When direct computation is not feasible, Monte Carlo methods will
be used based on a random number generator. We shall then learn how to make decisions
under uncertainty based on the observed data, how to estimate parameters of interest, test
hypotheses, fit regression models, and make forecasts.

Exercises

1.1. List 20 situations involving uncertainty that happened with you yesterday.

1.2. Name 10 random variables that you observed or dealt with yesterday.

1.3. Name 5 stochastic processes that played a role in your actions yesterday.

1.4. In a famous joke, a rather lazy student tosses a coin in order to decide what to do
next. If it turns up heads, play a computer game. If tails, watch a video. If it stands on its
edge, do the homework. If it hangs in the air, study for an exam.

(a) Which events should be assigned probability 0, probability 1, and some probability
strictly between 0 and 1?
6 Probability and Statistics for Computer Scientists

(b) What probability between 0 and 1 would you assign to the event “watch a video”,
and how does it help you to define “a fair coin”?

1.5. A new software package is being tested by specialists. Every day, a number of defects
is found and corrected. It is planned to release this software in 30 days. Is it possible to
predict how many defects per day specialists will be finding at the time of the release? What
data should be collected for this purpose, what is the predictor, and what is the response?

1.6. Mr. Cheap plans to open a computer store to trade hardware. He would like to stock
an optimal number of different hardware products in order to optimize his monthly profit.
Data are available on similar computer stores opened in the area. What kind of data should
Mr. Cheap collect in order to predict his monthly profit? What should he use as a predictor
and as a response in his analysis?
Part I

Probability and Random


Variables

7
Discovering Diverse Content Through
Random Scribd Documents
The Project Gutenberg eBook of Sandman's rainy
day stories
This ebook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this ebook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

Title: Sandman's rainy day stories

Author: Abbie Phillips Walker

Illustrator: Rhoda Chase

Release date: July 23, 2022 [eBook #68589]

Language: English

Original publication: United States: Harper & Brothers, 1920

Credits: Charlene Taylor, Amber Black and the Online


Distributed Proofreading Team at https://www.pgdp.net
(This file was produced from images generously made
available by The Internet Archive/American Libraries.)

*** START OF THE PROJECT GUTENBERG EBOOK SANDMAN'S


RAINY DAY STORIES ***
SANDMAN’S
RAINY DAY STORIES
Books by
ABBIE PHILLIPS
WALKER

SANDMAN’S
STORIES OF DRUSILLA
DOLL
SANDMAN’S RAINY
DAY STORIES
SANDMAN’S
CHRISTMAS STORIES
SANDMAN’S
TWILIGHT STORIES
TOLD BY THE
SANDMAN
SANDMAN’S TALES
THE SANDMAN’S
HOUR

Harper & Brothers


Publishers
Established 1817
Sandman’s Rainy Day Stories
By Abbie Phillips Walker
Illustrated by Rhoda C. Chase

Harper & Brothers, Publishers


Sandman’s Rainy Day Stories

Copyright, 1920, by Harper & Brothers


Printed in the United States of America
Published September, 1920
G—U

This book is lovingly dedicated


to the memory of
my father
THOMAS PHILLIPS
CONTENTS
PAGE
Princess Cantilla 3
The Tree of Swords 18
The Silver Horseshoes 28
The Blue Castle 37
Nardo and the Princess 50
Old Three Heads 59
The Enchanted Boat 73
Nicko and the Ogre 83
The Gingerbread Rock 91
Prince Roul’s Bride 100
Sunev 109
Cilla and the Dwarf 117
Greta and the Black Cat 123
The Knight of the Bright Star 132
The Dolphin’s Bride 138
Princess Dido and the Prince of the Roses 144
Catville Gossip 151
How the Elephant Got His Trunk 154
Why Rabbits Have Short Tails 160
The Hunter’s Friend, Johnnie Bear 166
Plaid Trousers 170
The Three Runaways 177
SANDMAN’S
RAINY DAY STORIES
PRINCESS CANTILLA
rincess Cantilla lived in a castle like most princesses, but she
P was not a rich princess, for her father had lost all his lands and
money by quarreling with other kings about the length and
breadth of his kingdom and theirs.
So poor little Cantilla had to work just like any common peasant
girl and cook the meals for herself and her father.
The old castle where Cantilla and her father lived had fallen into
decay, and only a few rooms at one end were now used, so that the
bats and owls had taken possession of the towers and once
gorgeous halls on the opposite side of the castle, where beautiful
ladies and courtly gentlemen were once seen in gay and festive
pleasures. A kitchen and a bedroom apiece were all the rooms that
Cantilla and her father, the old King, used, and the furniture was so
old it hardly held together.
One day Cantilla was cooking soup for dinner, and as the steam
rolled up from the kettle Cantilla thought she saw a face with a long
beard looking at her. She drew her hand across her eyes to make
her sight more clear, and the next time she looked she did see a
face, and a form, too.
A little man with a misshapen back and a long white beard, the
ends of which he carried over one arm, stepped from the cover of
the boiling pot and hopped to the floor.
“Princess,” he said, bowing low before Cantilla, “I am an
enchanted dwarf. I can give you back your once beautiful home and
make your father a rich king again.
“I can cause all the rooms of the old castle to become new and
filled with beautiful hangings and furniture, as they were before your
father became so poor.”
Cantilla began to smile at the thought of all the luxury and comfort
the dwarf pictured, and she lost sight of his ugly-looking body and
face for a minute, but she was brought to her senses by what the
dwarf next said.
“All this will I give you, Princess Cantilla, if you will become my
wife,” he said, taking a step closer to Cantilla.
“Oh no, no! I cannot do that,” said Cantilla, holding up both hands
as if to ward off even the thought of such a thing.
“Wait,” said the dwarf. “Do not be so hasty, my Princess. I will
come again for your reply to-night at the fountain in the garden
where the honeysuckle grows.”
Before Cantilla could reply to this he swung his beard over his
head and disappeared in a cloud of what looked like steam or
smoke.
Cantilla looked about her and pinched herself to make sure she
had not dreamed all she had just seen, and by and by she believed it
was a dream—that she must have fallen asleep in her chair by the
fire.
That night while she was sleeping she was awakened by feeling
some one touch her on the face.
Cantilla had been awakened so many times by the little mice that
overran the old castle that she only brushed her face with her hand
without opening her eyes and went to sleep again.
“Cantilla, open your eyes! Open your eyes!” she heard some one
whisper close to her ear, and again she felt the touch of something
on her face.
Cantilla opened her eyes and sat up in bed. The room was quite
bright, and a beautiful lamp with a pink silk shade gave everything in
the room a rose tint.
Cantilla was sure she was dreaming, for it was not her old shabby
room at all she was looking at.
She looked down at the covering of her bed—that was pink silk,
too; she felt of it and found it was filled with the softest down; she
also noticed that she wore a beautiful night-robe of pink silk and
lace.
On the floor beside the bed on a soft, pink rug stood two little satin
slippers, trimmed with swan’s-down.
“I am dreaming,” said Cantilla, “but I will enjoy it while it lasts,” and
she looked about her.
The furniture was white and gold, and soft pink rugs covered the
floor. Her bed had little gold Cupids on each post, and they held in
their hands the ends of pink silk that formed a beautiful canopy; little
frills of lace fell from the bottom of the silk, making it look very soft
and pretty in the lamplight.
On the table beside her bed, which held her lamp, Cantilla saw a
big gold-and-glass bottle. She reached for it and took out the gold
stopper, then she tipped the bottle and bathed her face and hands
with the delicious perfume it held.
Cantilla put her little feet out of bed and slipped them into the
slippers and walked over to the gold-and-white dressing-table at the
other side of the room.
Everything was so beautiful she just looked at first, then she
picked up a gold brush and smoothed her hair. She took up each of
the gold toilet articles and saw that on each was the letter “C.”
“They must belong to me,” said Cantilla. “But, of course, it is all a
dream,” as she opened a drawer of a big gold-and-white chest.
What she saw made Cantilla gasp with wonder, for the drawer was
filled with beautiful clothes, and as she opened the others she found
they all were filled with silk and lace-trimmed clothes.
Cantilla forgot all about her dream and ran, just as though she
were awake, to a closet door that was open. She swung it back and
looked; there hung before her astonished gaze pink silk dresses and
blue silk dresses and white and dainty green and yellow silk dresses.
Now, I did not tell you that Cantilla had black hair which hung in
long curls about her pretty face and over her pretty white shoulders,
and her eyes were as deep-blue as the deepest blue of a violet, and
when she put on one of the pink silk dresses and stepped in front of
a long mirror she forgot all else for a moment. Then suddenly she
heard her name called softly. “Cantilla, Cantilla,” the voice said.
Cantilla looked up, and on the top of the mirror stood a little fairy
dressed in pink gauze.
“Oh! you have a pretty pink dress, too,” said Cantilla, forgetting to
be surprised at seeing a fairy in her room.
“Yes, but it is the only dress I own,” said the little creature, with a
smile, “while you have a closet full; but then mine never wear out,
and yours will.”
“You mean I will wake up in a minute, I suppose,” said Cantilla.
“Yes, I know it is a dream, but I am having a good time. I wish I could
have a dream like this every night. I wouldn’t mind being poor
through the day.”
“Ah! but you are not dreaming at all, Princess Cantilla,” said the
fairy, “and if you will follow me I will show you more of your beautiful
home. Come along.”
Cantilla did not answer, but walked after the fairy, who skimmed
along before Cantilla like a little pink bird.
The fairy touched a door with her wand and it flew open. Cantilla
looked about her in wonder, for the hall, which had been hung with
tatters of faded tapestry, now looked like the hall of a king.
The tapestry hung whole and rich-looking upon the walls, which
were of deep-blue and gold. The old armor that had been broken
and covered with dust and mold was erect as though its former
wearer was inside it.
The fairy touched the door of the room where the old King was
sleeping, and again Cantilla looked in wonder, for her father slept
beneath a canopy of red and gold upon a bed of gold, and all the
furnishings of his room were such as a king would have.
Cantilla looked at her father. He was smiling in his sleep, and the
care-worn look had gone from his face.
The fairy beckoned to her and Cantilla, with one backward glance
at her sleeping father, followed.
Next the old dining-hall was opened for Cantilla to see. The once
faded and torn draperies were whole, and bats and owls were gone
from the corners of the room where they had often made their nests.
The beautiful table of onyx and silver was covered with dishes of
silver, and dainty lace napkins lay beside each place as though
ready for the coming guests. But the fairy led her away, and next
Cantilla saw the beautiful halls where the old King held his grand
balls and kings and queens and princes and princesses had danced.
The lights burned in the gold-and-glass fixtures fastened to the
walls and made the place look like fairyland.
The blue damask curtains with their edge of priceless lace hung
from the windows, whole and shimmering with richness, and chairs
of gold stood upright and bright against the walls, and the floor
shone with polish.
And so through the whole castle the fairy led the wondering little
Princess to look at her old ruined home, now beautiful and whole.
Then the fairy took Cantilla to the gardens. The once dry fountains
were playing in the moonlight, the nightingales could be heard
among the roses, and the air was filled with rich perfume.
When they reached the lower end of the garden Cantilla suddenly
stopped and stood very still. She was beside a fountain, and
honeysuckle grew over an arbor close beside it.
Cantilla remembered the words of the dwarf she had seen in her
dream, and his words, “I will come for your reply to-night at the
fountain where the honeysuckle grows.”
The fairy stood on a bush beside her. “You remember now, do you
not?” she asked. “You see it was not a dream this morning, and you
are not dreaming now, my Princess, but I cannot help you. I have
finished my work and must return to my Queen. Farewell!”
Cantilla watched the fairy disappear without uttering a single word.
She saw in her mind’s eye only the ugly features of the dwarf and
heard his words.
In another minute she saw what looked like a cloud near the
honeysuckle arbor, and in another minute the dwarf of the morning
stood before her with the ends of his long white beard thrown over
one arm.
“I have come, Princess Cantilla, for my answer,” said the dwarf.
“Marry me and all you have seen shall be yours.”
Cantilla threw out her hands as she had in the morning and started
to reply, but the dwarf checked her. “Before you give your answer,”
he said, “think of your old father and how contented and happy he
looked surrounded by the comforts of his former days of prosperity.”
Cantilla let her hands fall by her side, her head bent low, and she
stood lost in thought. She saw again her old father in his bed of gold,
and the face that looked so happy, then she raised her head without
looking at the ugly creature before her and said: “I consent; I will
become your wife; I cannot love you, but I will wed you if that will
content you.”
“Follow me, then,” said the dwarf, throwing his long beard over his
head and letting it fall over Cantilla as he spoke.
Cantilla saw only a fleecy cloud closing all about her, and the next
thing she knew she was on a little island in the middle of a deep blue
ocean, with the dwarf standing beside her.
The dwarf, with his beard still over one arm, held his hands to his
mouth and gave a long, loud call, which seemed to descend to the
depths of the ocean.
Up from the water came an arm and hand holding a twisted shell,
and then Cantilla saw a head appear and blow a long, loud blast
from the shell.
A splashing was heard, and out of the water came an old man in a
chariot of mother-of-pearl.
The chariot was drawn by two horses with feet and manes of gold,
and in one hand the old man carried a long wand with three prongs
at one end.
The old man struck the water with the queer-looking wand, and
from all over the surface of the water come the sea nymphs and all
sorts of monsters and creatures that live at the bottom of the ocean.
But when the mermaids appeared the old man sent them back
quickly and drove his chariot toward Cantilla and the dwarf.
Cantilla by this time was beyond being frightened or surprised, and
she stood beside the dwarf waiting for the next thing to happen.
“My Lord Neptune,” said the dwarf, bowing low as the old man
drove close to the island on which Cantilla and the dwarf stood, “I
have come with my Princess for you to perform the ceremony. She
has consented to become my wife.”
“What!” cried the old man, in an angry voice, “do you mean you
have found a Princess who will consent to have such a husband as
you are—ugly and misshapen wretch?”
“Answer him, my Princess,” said the dwarf. “Tell my Lord Neptune
you consent to marry me.”
“I do consent to marry the dwarf,” Cantilla managed to say, and
again the old man struck the water, this time in anger, and the water
spouted about them like huge fountains throwing up rivers.
Cantilla felt the dwarf take her hand, and he said, “Fear not, my
Princess; it will soon be over.”
In a few minutes the water was calm again, and the old man in the
chariot stood a little way off, surrounded by the nymphs and other
creatures, holding the three-pronged wand high over his head.
“I release you; you are wed; be gone from my sight,” said the old
man, and as the trumpet-bearer sounded his loud call, the old man
and his chariot passed into the deep water, followed by all his
nymphs and the others.
Cantilla looked toward the dwarf, wondering if ever any one had
such a strange wedding, but to her surprise he was gone and by her
side stood a handsome man, who said: “My Princess, behold in me
your husband. I am free from the spell of the old man of the sea, who
wanted me to become a sea monster and live under the ocean.
“I was changed into the shape of the ugly dwarf because I would
not marry a mermaid who happened to fall in love with me one day
while I was bathing, and she called upon a sea witch to change me
into a sea monster, but I escaped before I took on the sea shape, but
not before I was changed into the ugly dwarf you saw this morning.
“A kind fairy interceded with her Queen to save me, and she went
to the old man, who is Neptune, the God of the Waters. He told the
Queen if I could find a princess who would consent to marry me he
would release me from the spell the sea witch had cast over me.
“You know how that was accomplished, my Princess, and if you
think you can accept me in place of the dwarf for your husband we
will return to the castle, where your father is still sleeping, I expect,
for the Fairy Queen said she would watch until sunrise for our
return.”
Cantilla, no longer looking sad, but smiling and happy, put her
hand in her husband’s and told him she was the happiest girl in the
world.
“And I am the happiest man in the world,” said her husband, “for I
not only am freed from the spell of the sea witch, but I have won the
one woman in the world I could ever love for my wife.”
Three times he clapped his hands together, and the little fairy in
the pink gauze dress appeared.
“The Queen sends her love to you and this message, ‘Bless you,
my children,’ and now I will take you home to the castle.”
She touched the Princess and her husband on the cheek with her
wand, and Cantilla found herself back in the castle garden by the
fountain and honeysuckle arbor, with her handsome husband
standing by her side.
“Come, my dear, we must go in to breakfast,” said her husband;
“your father will be waiting for us.”
“How will we explain about our wedding and the changed
appearance of the castle?” asked Cantilla.
“Oh! the Fairy Queen has arranged all that,” said Cantilla’s
husband. “Your father will not remember he ever lost his fortune; he
will ask no questions.”
Cantilla and her husband went hand in hand into the castle to their
breakfast, and from that day Cantilla never knew another sorrow or
unhappy moment.
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!

textbookfull.com

You might also like