Building Statistical Models in Python 1st Edition Anonymous Download
Building Statistical Models in Python 1st Edition Anonymous Download
https://ebookmeta.com/product/building-statistical-models-in-
python-1st-edition-anonymous/
https://ebookmeta.com/product/statistical-learning-with-math-and-
python-100-exercises-for-building-logic-joe-suzuki/
https://ebookmeta.com/product/python-for-beginners-11th-
edition-2022-anonymous/
https://ebookmeta.com/product/statistical-analysis-with-swift-
data-sets-statistical-models-and-predictions-on-apple-platforms-
andersson/
https://ebookmeta.com/product/sons-at-war-the-true-story-of-two-
young-men-destined-from-birth-to-collide-in-death-first-edition-
jane-sweetland/
Black Light Rocked Black Light Series Book 1 1st
Edition Livia Grant
https://ebookmeta.com/product/black-light-rocked-black-light-
series-book-1-1st-edition-livia-grant-2/
https://ebookmeta.com/product/thermal-and-structural-electronic-
packaging-analysis-for-space-and-extreme-environments-1st-
edition-juan-cepeda-rizo/
https://ebookmeta.com/product/occultism-and-the-origins-of-
psychoanalysis-1st-edition-maria-pierri/
https://ebookmeta.com/product/the-crying-cave-killings-the-
yorkshire-murders-3-1st-edition-wes-markin/
https://ebookmeta.com/product/the-gun-debate-what-everyone-needs-
to-know-philip-j-cook/
Mathematical Methods Units 1 2 for Queensland 1st
Edition Michael Evans
https://ebookmeta.com/product/mathematical-methods-units-1-2-for-
queensland-1st-edition-michael-evans/
Building Statistical Models
in Python
Paul N Adams
Stuart J Miller
BIRMINGHAM—MUMBAI
Building Statistical Models in Python
Copyright © 2023 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted
in any form or by any means, without the prior written permission of the publisher, except in the case
of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information
presented. However, the information contained in this book is sold without warranty, either express
or implied. Neither the author(s), nor Packt Publishing or its dealers and distributors, will be held
liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and
products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot
guarantee the accuracy of this information.
To my daughter, Lydie, for demonstrating how work and dedication regenerate inspiration and
creativity. To my wife, Helene, for her love and support.
– Paul Adams
I would like to thank my wife Anita and daughter Ananya for giving me the time and space to review
this book.
Karthik Dulam is a Principal Data Scientist at EDB. He is passionate about all things data with a
particular focus on data engineering, statistical modeling, and machine learning. He has a diverse
background delivering machine learning solutions for the healthcare, IT, automotive, telecom, tax,
and advisory industries. He actively engages with students as a guest speaker at esteemed universities
delivering insightful talks on machine learning use cases.
I would like to thank my wife, Sruthi Anem, for her unwavering support and patience. I also want to
thank my family, friends, and colleagues who have played an instrumental role in shaping the person I
am today. Their unwavering support, encouragement, and belief in me have been a constant source of
inspiration.
Table of Contents
Preface xiii
2
Distributions of Data 19
Technical requirements 19 Measuring shape 38
Understanding data types 20 The normal distribution and central
Nominal data 20 limit theorem 42
Ordinal data 21 The Central Limit Theorem 45
Interval data 21
Ratio data 22
Bootstrapping 45
Visualizing data types 22 Confidence intervals 46
Standard error 51
Measuring and describing Correlation coefficients (Pearson’s correlation) 51
distributions 26
Measuring central tendency 26
Permutations 52
Measuring variability 33 Permutations and combinations 52
Permutation testing 55
viii Table of Contents
Transformations 57 References 59
Summary 59
3
Hypothesis Testing 61
The goal of hypothesis testing 61 Basics of the z-test – the z-score,
Overview of a hypothesis test for the mean 62 z-statistic, critical values, and p-values 65
Scope of inference 62 The z-score and z-statistic 65
Hypothesis test steps 63 A z-test for means 72
z-test for proportions 78
Type I and Type II errors 63
Power analysis for a two-population pooled
Type I errors 63 z-test 82
Type II errors 64
Summary 85
4
Parametric Tests 87
Assumptions of parametric tests 87 Tests with more than two groups and
Normally distributed population data 88 ANOVA 114
Equal population variance 99 Multiple tests for significance 114
ANOVA 117
T-test – a parametric hypothesis test 102
Pearson’s correlation coefficient 118
T-test for means 103
Power analysis examples 123
Two-sample t-test – pooled t-test 108
Two-sample t-test – Welch’s t-test 111 Summary 124
Paired t-test 112 References 124
5
Non-Parametric Tests 125
When parametric test assumptions The test statistic procedure 128
are violated 125 Normal approximation 129
Permutation tests 126 Rank-Sum example 129
7
Multiple Linear Regression 173
Multiple linear regression 173 Ridge regression 189
Adding categorical variables 175 LASSO regression 192
Evaluating model fit 176 Elastic Net 194
Interpreting the results 181 Dimension reduction 196
Feature selection 184 PCA – a hands-on introduction 196
Statistical methods for feature selection 184 PCR – a hands-on salary prediction study 199
Performance-based methods for feature Summary 202
selection 186
Recursive feature elimination 187
9
Discriminant Analysis 225
Bayes’ theorem 225 Linear Discriminant Analysis 229
Probability 225 Supervised dimension reduction 236
Conditional probability 227
Quadratic Discriminant Analysis 238
Discussing Bayes’ Theorem 228
Summary 244
11
ARIMA Models 271
Technical requirements 271 Models for non-stationary
Models for stationary time series 272 time series 295
Autoregressive (AR) models 272 ARIMA models 296
Moving average (MA) models 283 Seasonal ARIMA models 304
Autoregressive moving average (ARMA)
More on model evaluation 311
models 287
Summary 318
References 319
12
Multivariate Time Series 321
Multivariate time series 321 Step 2 – selecting the order of AR(p) 339
Time-series cross-correlation 322 Step 3 – assessing cross-correlation 340
Step 4 – building the VAR(p,q) model 344
ARIMAX 326 Step 5 – testing the forecast 346
Preprocessing the exogenous variables 328 Step 6 – building the forecast 347
Fitting the model 329
Assessing model performance 333 Summary 349
References 349
VAR modeling 335
Step 1 – visual inspection 338
14
Survival Models 361
Technical requirements 361 Cox Proportional Hazards
Kaplan-Meier model 362 regression model 372
Model definition 362 Step 1 374
Model example 364 Step 2 375
Step 3 379
Exponential model 368 Step 4 380
Model example 370 Step 5 383
Summary 384
Index 385
• An introduction to statistics
• Regression models
• Classification models
• Time series models
• Survival analysis
Understanding the tools provided in these sections will provide the reader with a firm foundation
from which further independent growth in the statistics domain can more easily be achieved.
xiv Preface
• Industry professionals with limited statistical or programming knowledge who would like to
learn to use data for testing hypotheses they have in their business domain
• Data analysts and scientists who wish to broaden their statistical knowledge and find a set of
tools and their implementations for performing various data-oriented tasks
The ground-up approach of this book seeks to provide entry into the knowledge base for a wide
audience and therefore should neither discourage novice-level practitioners nor exclude advanced-
level practitioners from the benefits of the materials presented.
IX.
There is a kind of fairy tale of which I think I have hitherto not given the
reader a specimen: a good instance is given in the third volume of the
Brython, at p. 459, by a contributor who calls himself Idnerth ab Gwgan,
who, I learn from the Rev. Chancellor Silvan Evans, the editor, was no other
than the Rev. Benjamin Williams, best known to Welsh antiquaries by his
bardic name of Gwynionyđ. The preface to the tale is also interesting, so I
am tempted to render the whole into English, as follows:—
‘The fair family were wonderful creatures in the imaginary world: they
encamped, they walked, and they capered a great deal in former ages in our
country, according to what we learn from some of our old people. It may be
supposed that they were very little folks like the children of Rhys Đwfn; for
the old people used to imagine that they were wont to visit their hearths in
great numbers in ages gone by. The girls at the farm houses used to make
the hearths clean after supper, and to place a cauldron full of water near the
fire; and so they thought that the fair family came there to play at night,
bringing sweethearts for the young women, and leaving pieces of money on
the hob for them in the morning. Sometimes they might be seen as splendid
hosts exercising themselves on our hills. They were very fond of the
mountains of Dyfed; travellers between Lampeter and Cardigan used to see
them on the hill of Ỻanwenog, but by the time they had reached there the
fairies would be far away on the hills of Ỻandyssul, and when one had
reached the place where one expected to see the family together in tidy
array, they would be seen very busily engaged on the tops of Crug y Balog;
when one went there they would be on Blaen Pant ar Fi, moving on and on
to Bryn Bwa, and, finally, to some place or other in the lower part of Dyfed.
Like the soldiers of our earthly world, they were possessed of terribly
fascinating music; and in the autumnal season they had their rings, still
named from them, in which they sang and danced. The young man of Ỻech
y Derwyđ24 was his father’s only son, as well as heir to the farm; so he was
very dear to his father and his mother, indeed he was the light of their eyes.
Now, the head servant and the son were bosom friends: they were like
brothers together, or rather twin brothers. As the son and the servant were
such friends, the farmer’s wife used to get exactly the same kind of clothes
prepared for the servant as for her son. The two fell in love with two
handsome young women of very good reputation in the neighbourhood. The
two couples were soon joined in honest wedlock, and great was the merry-
making on the occasion. The servant had a suitable place to live in on the
farm of Ỻech y Derwyđ; but about half a year after the son’s marriage, he
and his friend went out for sport, when the servant withdrew to a wild and
retired corner to look for game. He returned presently for his friend, but
when he got there he could not see him anywhere: he kept looking around
for some time for him, shouting and whistling, but there was no sign of his
friend. By-and-by, he went home to Ỻech y Derwyđ expecting to see him,
but no one knew anything about him. Great was the sorrow of his family
through the night; and next day the anxiety was still greater. They went to
see the place where his friend had seen him last: it was hard to tell whether
his mother or his wife wept the more bitterly; but the father was a little
better, though he also looked as if he were half mad with grief. The spot
was examined, and, to their surprise, they saw a fairy ring close by, and the
servant recollected that he had heard the sound of very fascinating music
somewhere or other about the time in question. It was at once agreed that
the man had been unfortunate enough to have got into the ring of the
Tylwyth, and to have been carried away by them, nobody knew whither.
Weeks and months passed away, and a son was born to the heir of Ỻech y
Derwyđ, but the young father was not there to see his child, which the old
people thought very hard. However, the little one grew up the very picture
of his father, and great was his influence over his grandfather and
grandmother; in fact he was everything to them. He grew up to be a man,
and he married a good-looking girl in that neighbourhood; but her family
did not enjoy the reputation of being kind-hearted people. The old folks
died, and their daughter-in-law also. One windy afternoon in the month of
October, the family of Ỻech y Derwyđ beheld a tall thin old man, with his
beard and hair white as snow, coming towards the house, and they thought
he was a Jew. The servant maids stared at him, and their mistress laughed at
the “old Jew,” at the same time that she lifted the children up one after
another to see him. He came to the door and entered boldly enough, asking
about his parents. The mistress answered him in an unusually surly and
contemptuous tone, wondering why the “drunken old Jew had come there,”
because it was thought he had been drinking, and that he would otherwise
not have spoken so. The old man cast wondering and anxious looks around
on everything in the house, feeling as he did greatly surprised; but it was the
little children about the floor that drew his attention most: his looks were
full of disappointment and sorrow. He related the whole of his account,
saying that he had been out the day before and that he was now returning.
The mistress of the house told him that she had heard a tale about her
husband’s father, that he had been lost years before her birth while out
sporting, whilst her father maintained that it was not true, but that he had
been killed. She became angry, and quite lost her temper at seeing “the old
Jew” not going away. The old man was roused, saying that he was the
owner of the house, and that he must have his rights. He then went out to
see his possessions, and presently went to the house of the servant, where,
to his surprise, things had greatly changed; after conversing with an aged
man, who sat by the fire, the one began to scrutinize the other more and
more. The aged man by the fire told him what had been the fate of his old
friend, the heir of Ỻech y Derwyđ. They talked deliberately of the events of
their youth, but it all seemed like a dream; in short, the old man in the
corner concluded that his visitor was his old friend, the heir of Ỻech y
Derwyđ, returning from the land of the Tylwyth Teg after spending half a
hundred years there. The other old man, with the snow-white beard,
believed in his history, and much did they talk together and question one
another for many hours. The old man by the fire said that the master of
Ỻech y Derwyđ was away from home that day, and he induced his aged
visitor to eat some food, but, to the horror of all, the eater fell down dead on
the spot25. There is no record that an inquest was held over him, but the tale
relates that the cause of it was, that he ate food after having been so long in
the world of the fair family. His old friend insisted on seeing him buried by
the side of his ancestors; but the rudeness of the mistress of Ỻech y Derwyđ
to her father-in-law brought a curse on the family that clung to it to distant
generations, and until the place had been sold nine times.’
A tale from the other end of the tract of country once occupied by a
sprinkling, perhaps, of Celts among a population of Picts, makes the man,
and not the fairies, supply the music. I owe it to the kindness of the Rev.
Andrew Clark, Fellow of Lincoln College, Oxford, who heard it from the
late sexton of the parish of Dollar, in the county of Clackmannan. The
sexton died some twelve years ago, aged seventy: he had learnt the tale
from his father. The following are Mr. Clark’s words:—
‘Glendevon is a parish and village in the Ochils in County Perth, about five
miles from Dollar as you come up Glen Queich and down by Gloomhill.
Glen Queich is a narrowish glen between two grassy hills—at the top of the
glen is a round hill of no great height, but very neat shape, the grass of
which is always short and trim, and the ferns on the shoulder of a very
marked green. This, as you come up the glen, seems entirely to block the
way. It is called the “Maiden Castle.” Only when you come quite close do
you see the path winding round the foot of it. A little further on is a fine
spring bordered with flat stones, in the middle of a neat, turfy spot, called
the “Maiden’s Well.” This road, till the new toll-road was made on the other
side of the hills, was the thoroughfare between Dollar and Glendevon.’
The following is the legend, as told by the ‘Bethrel’:—‘A piper, carrying his
pipes, was coming from Glendevon to Dollar in the grey of the evening. He
crossed the Garchel (a little stream running into the Queich burn), and
looked at the “Maiden Castle,” and saw only the grey hillside and heard
only the wind soughing through the bent. He had got beyond it when he
heard a burst of lively music: he turned round, and instead of the dark knoll
saw a great castle, with lights blazing from the windows, and heard the
noise of dancing issuing from the open door. He went back incautiously,
and a procession issuing forth at that moment, he was caught and taken into
a great hall ablaze with lights, and people dancing on the floor. He had to
pipe to them for a day or two, but he got anxious, because he knew his
people would be wondering why he did not come back in the morning as he
had promised. The fairies seemed to sympathize with his anxiety, and
promised to let him go if he played a favourite tune of his, which they
seemed fond of, to their satisfaction. He played his very best, the dance
went fast and furious, and at its close he was greeted with loud applause.
On his release he found himself alone, in the grey of the evening, beside the
dark hillock, and no sound was heard save the purr of the burn and the
soughing of the wind through the bent. Instead of completing his journey to
Dollar, he walked hastily back to Glendevon to relieve his folk’s anxiety.
He entered his father’s house and found no kent face there. On his
protesting that he had gone only a day or two before, and waxing loud in his
bewildered talk, a grey old man was roused from a doze behind the fire; and
told how he had heard when a boy from his father that a piper had gone
away to Dollar on a quiet evening, and had never been heard or seen since,
nor any trace of him found. He had been in the “castle” for a hundred
years.’
The term Plant Rhys Đwfn has already been brought before the reader: it
means ‘the Children of Rhys Đwfn,’ and Rhys Đwfn means literally Rhys
the Deep, but the adjective in Welsh connotes depth of character in the
sense of shrewdness or cunning. Nay, even the English deep is often
borrowed for use in the same sense, as when one colloquially says un dîp
iawn yw e, ‘he is a very calculating or cunning fellow.’ The following
account of Rhys and his progeny is given by Gwynionyđ in the first volume
of the Brython, p. 130, which deserves being cited at length:—‘There is a
tale current in Dyfed, that there is, or rather that there has been, a country
between Cemmes, the northern Hundred of Pembrokeshire, and Aberdaron
in Ỻeyn. The chief patriarch of the inhabitants was Rhys Đwfn, and his
descendants used to be called after him the Children of Rhys Đwfn. They
were, it is said, a handsome race enough, but remarkably small in size. It is
stated that certain herbs of a strange nature grew in their land, so that they
were able to keep their country from being seen by even the most sharp
sighted of invaders. There is no account that these remarkable herbs grew in
any other part of the world excepting on a small spot, about a square yard in
area, in a certain part of Cemmes. If it chanced that a man stood alone on it,
he beheld the whole of the territory of Plant Rhys Đwfn; but the moment he
moved he would lose sight of it altogether, and it would have been utterly
vain for him to look for his footprints. In another story, as will be seen
presently, the requisite platform was a turf from St. David’s churchyard.
The Rhysians had not much land—they lived in towns. So they were wont
in former times to come to market to Cardigan, and to raise the prices of
things terribly. They were seen of no one coming or going, but only seen
there in the market. When prices happened to be high, and the corn all sold,
however much there might have been there in the morning, the poor used to
say to one another on the way home, “Oh! they were there to-day,” meaning
Plant Rhys Đwfn. So they were dear friends in the estimation of Siôn Phil
Hywel, the farmer; but not so high in the opinion of Dafyđ, the labourer. It
is said, however, that they were very honest and resolute men. A certain
Gruffyđ ab Einon was wont to sell them more corn than anybody else, and
so he was a great friend of theirs. He was honoured by them beyond all his
contemporaries by being led on a visit to their home. As they were great
traders like the Phœnicians of old, they had treasures from all countries
under the sun. Gruffyđ, after feasting his eyes to satiety on their wonders,
was led back by them loaded with presents. But before taking leave of
them, he asked them how they succeeded in keeping themselves safe from
invaders, as one of their number might become unfaithful, and go beyond
the virtue of the herbs that formed their safety. “Oh!” replied the little old
man of shrewd looks, “just as Ireland has been blessed with a soil on which
venomous reptiles cannot live, so with our land: no traitor can live here.
Look at the sand on the sea-shore: perfect unity prevails there, and so
among us. Rhys, the father of our race, bade us, even to the most distant
descendant, honour our parents and ancestors; love our own wives without
looking at those of our neighbours; and do our best for our children and
grandchildren. And he said that if we did so, no one of us would ever prove
unfaithful to another, or become what you call a traitor. The latter is a
wholly imaginary character among us; strange pictures are drawn of him
with his feet like those of an ass, with a nest of snakes in his bosom, with a
head like the devil’s, with hands somewhat like a man’s, while one of them
holds a large knife, and the family lies dead around the figure. Good-bye!”
When Gruffyđ looked about him he lost sight of the country of Plant Rhys,
and found himself near his home. He became very wealthy after this, and
continued to be a great friend of Plant Rhys as long as he lived. After
Gruffyđ’s death they came to market again, but such was the greed of the
farmers, like Gruffyđ before them, for riches, and so unreasonable were the
prices they asked for their corn, that the Rhysians took offence and came no
more to Cardigan to market. The old people used to think that they now
went to Fishguard market, as very strange people were wont to be seen
there.’ On the other hand, some Fishguard people were lately of opinion that
it was at Haverfordwest the fairies did their marketing: I refer to a letter of
Mr. Ferrar Fenton’s, in the Pembroke County Guardian of October 31,
1896, in which he mentions a conversation he had with a Fishguard woman
as to the existence of fairies: ‘There are fairies,’ she asserted, ‘for they came
to Ha’rfordwest market to buy things, so there must be.’
With this should be compared pp. 9–10 of Wirt Sikes’ British Goblins,
where mention is made of sailors on the coast of Pembrokeshire and
Carmarthenshire, ‘who still talk of the green meadows of enchantment lying
in the Irish Channel to the west of Pembrokeshire,’ and of men who had
landed on them, or seen them suddenly vanishing. The author then proceeds
to abstract from Howells’ Cambrian Superstitions, p. 119, the following
paragraph:—‘The fairies inhabiting these islands are said to have regularly
attended the markets at Milford Haven and Laugharne. They made their
purchases without speaking, laid down their money and departed, always
leaving the exact sum required, which they seemed to know without asking
the price of anything. Sometimes they were invisible; but they were often
seen by sharp-eyed persons. There was always one special butcher at
Milford Haven upon whom the fairies bestowed their patronage instead of
distributing their favours indiscriminately. The Milford Haven folk could
see the green Fairy Islands distinctly, lying out a short distance from land;
and the general belief was that they were densely peopled with fairies. It
was also said that the latter went to and fro between the islands and the
shore, through a subterranean gallery under the bottom of the sea.’
Another tale given in the Brython, ii. 20, by a writer who gives his name as
B. Davies26, will serve to show, short though it be, that the term Plant Rhys
Đwfn was not confined to those honestly dealing fairies, but was used in a
sense wholly synonymous with that of Tylwyth Teg, as understood in other
parts of Wales. The story runs as follows, and should be compared with the
Dyffryn Mymbyr one given above, pp. 100–3:—‘One calm hot day, when
the sun of heaven was brilliantly shining, and the hay in the dales was being
busily made by lads and lasses, and by grown-up people of both sexes, a
woman in the neighbourhood of Emlyn placed her one-year-old infant in
the gader, or chair, as the cradle is called in these parts, and out she went to
the field for a while, intending to return, when her neighbour, an old woman
overtaken by the decrepitude of eighty summers, should call to her that her
darling was crying. It was not long before she heard the old woman calling
to her; she ran hurriedly, and as soon as she set foot on the kitchen floor she
took her little one in her arms as usual, saying to him, “O my little one! thy
mother’s delight art thou! I would not take the world for thee, &c.” But to
her surprise he had a very old look about him, and the more the tender-
hearted mother gazed at his face, the stranger it seemed to her, so that at last
she placed him in the cradle and told her trouble and sorrow to her relatives
and acquaintances. And after this one and the other had given his opinion, it
was agreed at last that it was one of Rhys Đwfn’s children that was in the
cradle, and not her dearly loved baby. In this distress there was nothing to
do but to fetch a sorcerer, as fast as the fastest horse could gallop. He said,
when he saw the child, that he had seen his like before, and that it would be
a hard job to get rid of him, though not such a very hard job this time. The
shovel was made red hot in the fire by one of the Cefnarth27 boys, and held
before the child’s face; and in an instant the short little old man took to his
heels, and neither he nor his like was seen afterwards from Aber Cuch to
Aber Bargoed at any rate. The mother, it is said, found her darling
unscathed the next moment. I remember also hearing that the strange child
was as old as the grandfather of the one that had been lost.’
A writer in the Brython, iv. 194, states that the people of Nefyn in Ỻeyn
claim the story of the fisher and the mermaid as belonging to them, which
proves that a similar legend has been current there: add to this the fact
mentioned in the Brython, iii. 133, that a red mermaid with yellow hair, on a
white field, figures in the coat of arms of the family resident at Glasfryn in
the parish of Ỻangybi, in Eifionyđ or the southern portion of
Carnarvonshire; and we have already suggested that Glasynys’ story (pp.
117–25) was made up, to a certain extent, of materials found on the coasts
of Carnarvonshire. A small batch of stories about South Wales mermaids is
given by a writer who calls himself Ab Nadol30, in the Brython, iv. 310, as
follows:—
‘A few rockmen are said to have been working, about eighty years ago, in a
quarry near Porth y Rhaw, when the day was calm and clear, with nature, as
it were, feasting, the flowers shedding sweet scent around, and the hot
sunshine beaming into the jagged rocks. Though an occasional wave rose to
strike the romantic cliffs, the sea was like a placid lake, with its light
coverlet of blue attractive enough to entice one of the ladies of Rhys Đwfn
forth from the town seen by Daniel Huws off Trefin as he was journeying
between Fishguard and St. David’s in the year 1858, to make her way to the
top of a stone and to sit on it to disentangle her flowing silvery hair. Whilst
she was cleaning herself, the rockmen went down, and when they got near
her they perceived that, from her waist upwards, she was like the lasses of
Wales, but that, from her waist downwards, she had the body of a fish. And,
when they began to talk to her, they found she spoke Welsh, though she
only uttered the following few words to them: “Reaping in Pembrokeshire
and weeding in Carmarthenshire.” Off she then went to walk in the depth of
the sea towards her home. Another tale is repeated about a mermaid, said to
have been caught by men below the land of Ỻanwnda, near the spot, if not
on the spot, where the French made their landing afterwards, and three
miles to the west of Fishguard. It then goes on to say that they carried her to
their home, and kept her in a secure place for some time; before long, she
begged to be allowed to return to the brine land, and gave the people of the
house three bits of advice; but I only remember one of them,’ he writes,
‘and this is it: “Skim the surface of the pottage before adding sweet milk to
it: it will be whiter and sweeter, and less of it will do.” I was told that this
family follow the three advices to this day.’ A somewhat similar advice to
that about the pottage is said to have been given by a mermaid, under
similar circumstances, to a Manxman.
After putting the foregoing bits together, I was favoured by Mr. Benjamin
Williams with notes on the tales and on the persons from whom he heard
them: they form the contents of two or three letters, mostly answers to
queries of mine, and the following is the substance of them:—Mr. Williams
is a native of the valley of Troed yr Aur31, in the Cardiganshire parish of
that name. He spent a part of his youth at Verwig, in the angle between the
northern bank of the Teifi and Cardigan Bay. He heard of Rhys Đwfn’s
Children first from a distant relative of his father’s, a Catherine Thomas,
who came to visit her daughter, who lived not far from his father’s house:
that would now be from forty-eight to fifty years ago. He was very young at
the time, and of Rhys Đwfn’s progeny he formed a wonderful idea, which
was partly due also to the talk of one James Davies or Siàms Mocyn, who
was very well up in folklore, and was one of his father’s next-door
neighbours. He was an old man, and nephew to the musician, David Jenkin
Morgan. The only spot near Mr. Williams’ home, that used to be frequented
by the fairies, was Cefn y Ceirw, ‘the Stag’s Ridge,’ a large farm, so called
from having been kept as a park for their deer by the Lewises of Aber Nant
Bychan. He adds that the late Mr. Philipps, of Aberglasney, was very fond
of talking of things in his native neighbourhood, and of mentioning the
fairies at Cefn y Ceirw. It was after moving to Verwig that Mr. Williams
began to put the tales he heard on paper: then he came in contact with three
brothers, whose names were John, Owen, and Thomas Evans. They were
well-to-do and respectable bachelors, living together on the large farm of
Hafod Ruffyđ. Thomas was a man of very strong common sense, and worth
consulting on any subject: he was a good arithmetician, and a constant
reader of the Baptist periodical, Seren Gomer, from its first appearance. He
thoroughly understood the bardic metres, and had a fair knowledge of
music. He was well versed in Scripture, and filled the office of deacon at
the Baptist Chapel. His death took place in the year 1864. Now, the eldest
of the three brothers, the one named John, or Siôn, was then about seventy-
five years of age, and he thoroughly believed in the tales about the fairies,
as will be seen from the following short dialogue:—
Siôn: Williams bach, ma’n rhaid i bod nhw’i gâl: yr w i’n cofio yn amser
Bone fod marchnad Aberteifi yn ỻawn o lafir yn y bore—digon yno am fis—
ond cin pen hanner awr yr ôđ y cwbwl wedi darfod. Nid ôđ possib i gweld
nhwi: mâ gida nhwi faint a fynnon nhwi o arian.
Siôn: O mâ gida nhwi đynion fel ninne yn pryni drostyn nhwi; ag y mâ nhwi
fel yr hen siówmin yna yn geỻi gneid pob tric.
John: ‘My dear Williams, it must be that they exist: I remember Cardigan
market, in the time of Bonaparte, full of corn in the morning—enough for a
month—but in less than half an hour it was all gone. It was impossible to
see them: they have as much money as they like.’
Williams: ‘How is it, then, that men did not see them, John?’
John: ‘Oh, they have men like us to do the buying for them; and they can,
like those old showmen, do every kind of trick.’
At this kind of display of simplicity on the part of his brother, Thomas used
to smile and say: ‘My brother John believes such things as those;’ for he
had no belief in them himself. Still it is from his mouth that Mr. Williams
published the tales in the Brython, which have been reproduced here, that of
‘Pergrin and the Mermaid,’ and all about the ‘Heir of Ỻech y Derwyđ,’ not
to mention the ethical element in the account of Rhys Đwfn’s country and
its people, the product probably of his mind. Thomas Evans, or as he was
really called, Tommos Ifan, was given rather to grappling with the question
of the origin of such beliefs; so one day he called Mr. Williams out, and led
him to a spot about four hundred yards from Bol y Fron, where the latter
then lived: he pointed to the setting sun, and asked Mr. Williams what he
thought of the glorious sunset before them. ‘It is all produced,’ he then
observed, ‘by the reflection of the sun’s rays on the mist: one might think,’
he went on to say, ‘that there was there a paradise of a country full of fields,
forests, and everything that is desirable.’ And before they had moved away
the grand scene had disappeared, when Thomas suggested that the idea of
the existence of the country of Rhys Đwfn’s Children arose from the
contemplation of that phenomenon. One may say that Thomas Evans was
probably far ahead of the Welsh historians who try to extract history from
the story of Cantre’r Gwaelod, ‘the Bottom Hundred,’ beneath the waves of
Cardigan Bay; but what was seen was probably an instance of the mirage to
be mentioned presently. Lastly, besides Mr. Williams’ contributions to the
Brython, and a small volume of poetry, entitled Briaỻen glan Ceri, some
tales of his were published by Ỻaỻawg in Bygones some years ago, and he
had the prize at the Cardigan Eisteđfod of 1866 for the best collection in
Welsh of the folklore of Dyfed: his recollection was that it contained in all
thirty-six tales of all kinds; but since the manuscript, as the property of the
Committee of that Eisteđfod, was sold, he could not now consult it: in fact
he is not certain as to who the owner of it may now be, though he has an
idea that it is either the Rev. Rees Williams, vicar of Whitchurch, near
Solva, Pembrokeshire, or R. D. Jenkins, Esq., of Cilbronnau, Cardiganshire.
Whoever the owner may be, he would probably be only too glad to have it
published, and I mention this merely to call attention to it. The Eisteđfod is
to be commended for encouraging local research, and sometimes even for
burying the results in obscurity, but not always.
X.
Before leaving Dyfed I wish to revert to the extract from Mr. Sikes, p. 161
above. He had been helped partly by the article on Gavran, in the Cambrian
Biography, by William Owen, better known since as William Owen Pughe
and Dr. Pughe, and partly by a note of Southey’s on the following words in
his Madoc (London, 1815), i. III:—
The Gavran story, I may premise, is based on one of the Welsh Triads—i.
34, ii. 41, iii. 80—and Southey cites the article in the Cambrian Biography;
but he goes on to give the following statements without indicating on what
sources he was drawing—the reader has, however, been made acquainted
already with the virtue of a blade of grass, by the brief mention of Ỻyn
Irđyn above, p. 148:—
‘Of these Islands, or Green Spots of the Floods, there are some singular
superstitions. They are the abode of the Tylwyth Teg, or the fair family, the
souls of the virtuous Druids, who, not having been Christians, cannot enter
the Christian heaven, but enjoy this heaven of their own. They however
discover a love of mischief, neither becoming happy spirits, nor consistent
with their original character; for they love to visit the earth, and, seizing a
man, inquire whether he will travel above wind, mid wind, or below wind;
above wind is a giddy and terrible passage, below wind is through bush and
brake, the middle is a safe course. But the spell of security is, to catch hold
of the grass, for these Beings have not power to destroy a blade of grass. In
their better moods they come over and carry the Welsh in their boats. He
who visits these Islands imagines on his return that he has been absent only
a few hours, when, in truth, whole centuries have passed away. If you take a
turf from St. David’s churchyard, and stand upon it on the sea shore, you
behold these Islands. A man once, who thus obtained sight of them,
immediately put to sea to find them; but they disappeared, and his search
was in vain. He returned, looked at them again from the enchanted turf,
again set sail, and failed again. The third time he took the turf into his
vessel, and stood upon it till he reached them.’
‘May not the fairy islands referred to by Professor Rhys have originated
from mirages? During the glorious weather we enjoyed last summer, I went
up one particularly fine evening to the top of the Garn behind Penysgwarne
to view the sunset. It would have been worth a thousand miles’ travel to go
to see such a scene as I saw that evening. It was about half an hour before
sunset—the bay was calm and smooth as the finest mirror. The rays of the
sun made
and a picture indescribable. As the sun neared the horizon the rays
broadened until the sheen resembled a gigantic golden plate prepared to
hold the brighter sun. No sooner had the sun set than I saw a striking
mirage. To the right I saw a stretch of country similar to a landscape in this
country. A farmhouse and out-buildings were seen, I will not say quite as
distinct as I can see the upper part of St. David’s parish from this Garn, but
much more detailed. We could see fences, roads, and gateways leading to
the farmyard, but in the haze it looked more like a panoramic view than a
veritable landscape. Similar mirages may possibly have caused our old
tadau to think these were the abode of the fairies.’
To return to Mr. Sikes, the rest of his account of the Pembrokeshire fairies
and their green islands, of their Milford butcher, and of the subterranean
gallery leading into their home, comes, as already indicated, for the most
part from Howells. But it does not appear on what authority Southey
himself made departed druids of the fairies. One would be glad to be
reassured on this last point, as such a hypothesis would fit in well enough
with what we are told of the sacrosanct character of the inhabitants of the
isles on the coast of Britain in ancient times. Take, for instance, the brief
account given by Plutarch of one of the isles explored by a certain
Demetrius in the service of the Emperor of Rome: see chapter viii.
XI.
Mr. Craigfryn Hughes, the author of a Welsh novelette32 with its scene laid
in Glamorgan, having induced me to take a copy, I read it and found it full
of local colouring. Then I ventured to sound the author on the question of
fairy tales, and the reader will be able to judge how hearty the response has
been. Before reproducing the tale which Mr. Hughes has sent me, I will
briefly put into English his account of himself and his authorities. Mr.
Hughes lives at the Quakers’ Yard in the neighbourhood of Pontypriđ, in
Glamorganshire. His father was not a believer33 in tales about fairies or the
like, and he learned all he knows of the traditions about them in his father’s
absence, from his grandmother and other old people. The old lady’s name
was Rachel Hughes. She was born at Pandy Pont y Cymmer, near
Pontypool, or Pont ap Hywel as Mr. Hughes analyses the name, in the year
1773, and she had a vivid recollection of Edmund Jones of the Tranch, of
whom more anon, coming from time to time to preach to the Independents
there. She came, however, to live in the parish of Ỻanfabon, near the
Quakers’ Yard, when she was only twelve years of age; and there she
continued to live to the day of her death, which took place in 1864, so that
she was about ninety-one years of age at the time. Mr. Hughes adds that he
remembers many of the old inhabitants besides his grandmother, who were
perfectly familiar with the story he has put on record; but only two of them
were alive when he wrote to me in 1881, and these were both over ninety
years old, with their minds overtaken by the childishness of age; but it was
only a short time since the death of another, who was, as he says, a walking
library of tales about corpse candles, ghosts, and Bendith y Mamau34, or
‘The Mothers’ Blessing,’ as the fairies are usually called in Glamorgan. Mr.
Hughes’ father tried to prevent his children being taught any tales about
ghosts, corpse candles, or fairies; but the grandmother found opportunities
of telling them plenty, and Mr. Hughes vividly describes the effect on his
mind when he was a boy, how frightened he used to feel, how he pulled the
clothes over his head in bed, and how he half suffocated himself thereby
under the effects of the fear with which the tales used to fill him. Then, as to
the locality, he makes the following remarks:—‘There are few people who
have not heard something or other about the old graveyard of the Quakers,
which was made by Lydia Phil, a lady who lived at a neighbouring farm
house, called Cefn y Fforest. This old graveyard lies in the eastern corner of
the parish of Merthyr Tydfil, on land called Pantannas, as to the meaning of
which there is much controversy. Some will have it that it is properly Pant
yr Aros, or the Hollow of the Staying, because travellers were sometimes
stopped there overnight by the swelling of the neighbouring river; others
treat it as Pant yr Hanes, the Hollow of the Legend, in allusion to the
following story. But before the graveyard was made, the spot was called
Rhyd y Grug, or the Ford of the Heather, which grows thereabouts in
abundance. In front of the old graveyard towards the south the rivers Taff
and Bargoed, which some would make into Byrgoed or Short-Wood, meet
with each other, and thence rush in one over terrible cliffs of rock, in the
recesses of which lie huge cerwyni or cauldron-like pools, called
respectively the Gerwyn Fach, the Gerwyn Fawr, and the Gerwyn Ganol,
where many a drowning has taken place. As one walks up over Tarren y
Crynwyr, “the Quakers’ Rift,” until Pantannas is reached, and proceeds
northwards for about a mile and a half, one arrives at a farm house called
Pen Craig Daf35, “the Top of the Taff Rock.” The path between the two
houses leads through fertile fields, in which may be seen, if one has eyes to
observe, small rings which are greener than the rest of the ground. They are,
in fact, green even as compared with the greenness around them—these are
the rings in which Bendith y Mamau used to meet to sing and dance all
night. If a man happened to get inside one of these circles when the fairies
were there, he could not be got out in a hurry, as they would charm him and
lead him into some of their caves, where they would keep him for ages,
unawares to him, listening to their music. The rings vary greatly in size, but
in point of form they are all round or oval. I have heard my grandmother,’
says Mr. Hughes, ‘reciting and singing several of the songs which the
fairies sang in these rings. One of them began thus:—
Ond un prydnawn, ar ol i’r haul ymgilio i yst feỻoeđ y gorỻewin, tra yr oeđ
amaethwr Pantannas yn dychwelyd tua ei gartref cyfarfyđwyd ag ef gan fod
bychan ar ffurf dyn, yn gwisgo hugan goch; a phan đaeth gyferbyn ag ef
dadweiniođ ei gleđ bychan, gan gyfeirio ei flaen at yr amaethwr, a
dywedyd,
Dial a đaw,
Y mae gerỻaw.
Daw dial.
Pan oeđ yr yd wedi cael ei fedi ac yn barod i gael ei gywain i’r ysgubor, yn
sydyn ryw noswaith ỻosgwyd ef fel nad oeđ yr un dywysen na gweỻtyn i’w
gael yn un man o’r caeau, ac nis gaỻasai neb fod wedi gosod yr yd ar dan
ond Bendith y Mamau.
Trođ gwyneb yr amaethwr cyn wynned a’r marmor, a safođ gan alw y gwr
bychan yn ol, ond bu y còr yn hynod o wydn ac anewyỻysgar i droi ato, ond
ar ol hir erfyn arno trođ yn ei ol gan ofyn yn sarrug beth yr oeđ yr
amaethwr yn ei geisio, yr hwn a hysbysođ iđo ei fod yn berffaith fođlon i
adael y caeau ỻe yr oeđ eu hoff ymgyrchfan i dyfu yn don eilwaith, a rhođi
caniatad iđynt i đyfod iđynt pryd y dewisent, ond yn unig iđynt beidio dial
eu ỻid yn mheỻach arno ef.
‘Na,’ oeđ yr atebiad penderfynol, ‘y mae gair y brenin wedi ei roi y byđ iđo
ymđial arnat hyd eithaf ei aỻu ac nid oes dim un gaỻu ar wyneb y
greadigaeth a bair iđo gael ei dynnu yn ol.’
Pasiođ canrif heibio heb i’r dialeđ bygythiedig gael ei gyflawni, ac er fod
teulu Pantannas yn cael eu hadgofio yn awr ac eilwaith, y buasai yn sicr o
đigwyđ hwyr neu hwyrach, eto wrth hir glywed y waeđ,
Daw dial,
Aethant oỻ aỻan i wrando a glywent y ỻeferyđ eilwaith, ond nid oeđ dim
i’w glywed ond brochus drwst y dwfr wrth raiadru dros glogwyni aruthrol y
cerwyni. Ond ni chawsant aros i wrando yn hir iawn cyn iđynt glywed yr un
ỻeferyđ eilwaith yn dyrchafu i fyny yn uwch na swn y dwfr pan yn bwrlymu
dros ysgwyđau y graig, ac yn gwaeđi,
Daeth yr amser.
Nis gaỻent đyfalu beth yr oeđ yn ei arwyđo, a chymaint ydoeđ eu braw a’u
syndod fel nad aỻent lefaru yr un gair a’u gilyđ. Yn mhen ennyd
dychwelasant i’r ty a chyn iđynt eisteđ credent yn đios fod yr adeilad yn
cael ei ysgwyd iđ ei sylfeini gan ryw dwrf y tu aỻan. Pan yr oeđ yr oỻ wedi
cael eu parlysio gan fraw, wele fenyw fechan yn gwneuthur ei
hymđangosiad ar y bwrđ o’u blaen, yr hwn oeđ yn sefyỻ yn agos i’r ffenestr.
‘Nid oes gennyf unrhyw neges a thi, y gwr hir dafod,’ oeđ atebiad y fenyw
fechan. ‘Ond yr wyf wedi cael fy anfon yma i adrođ rhyw bethau ag syđ ar
đigwyđ i’r teulu hwn, a theulu araỻ o’r gymydogaeth ag a đichon fod o
đyđordeb iđynt, ond gan i mi đerbyn y fath sarhad ođiar law y gwr du ag
syđ yn eisteđ yn y cornel, ni fyđ i mi godi y ỻen ag oeđ yn cuđio y dyfodol
aỻan o’u golwg.’
‘Na wnaf, ond yn unig hysbysu, fod calon gwyryf fel ỻong ar y traeth yn
methu cyrraeđ y porthlad oherwyđ digalondid y pilot.’
A chyda ei bod yn ỻefaru y gair diweđaf diflannođ o’u gwyđ, na wyđai neb i
ba le na pha fođ!
Drwy ystod ci hymweliad hi, peidiođ y waeđ a godasai o’r afon, ond yn
fuan ar ol iđi điflannu, dechreuođ eilwaith a chyhoeđi
Cyn ymadael a’i fun dywedir iđynt dyngu bythol ffyđlondeb i’w gilyđ, pe
heb weled y naiỻ y ỻaỻ byth ond hynny, ac nad oeđ dim a aỻai beri iđynt
anghofio eu gilyđ.
Mae yn debygol i’r ỻanc Rhyđerch pan yn dychwelyd gartref gael ei hun
ođifewn i un o gylchoeđ Bendith y Mamau, ac yna iđynt ei hud-đenu i mewn
i un o’u hogofau yn Nharren y Cigfrain, ac yno y bu.
Edrychai nes yn agos bod yn đaỻ, ac wylai ei henaid aỻan o đyđ i đyđ ar ol
anwylđyn ei chalon. O’r diweđ aeth y rhai syđ yn edrych drwy y ffenestri i
omeđ eu gwasanaeth iđi, ac yr oeđ y pren almon yn coroni ei phen a’i
flagur gwyryfol, ond parhai hi i edrych, ond nid oeđ neb yn dod. Yn ỻawn o
đyđiau ac yn aeđfed i’r beđ rhođwyd terfyn ar ei hoỻ obeithion a’i
disgwyliadau gan angeu, a chludwyd ei gweđiỻion marwol i fynwent hen
Gapel y Fan.
Pasiai blynyđoeđ heibio fel mwg, ac oesau fel cysgodion y boreu, ac nid
oeđ neb yn fyw ag oeđ yn cofio Rhyđerch, ond adrođid ei goỻiad disymwyth
yn aml. Dylasem fynegu na welwyd yr un o Fendith y Mamau ođeutu y
gymydogaeth wedi ei goỻiad, a pheidiođ sain eu cerđoriaeth o’r nos honno
aỻan.
Prysurođ eilwaith tua Phantannas, ac yr oeđ ei syndod yn fwy fyth yno! Nid
oeđ yn adwaen yr un o honynt, ac ni wyđent hwythau đim am dano yntau.
O’r diweđ daeth gwr y ty i fewn, ac yr oeđ hwnnw yn cofio clywed ei dad cu
yn adrođ am lanc ag oeđ wedi myned yn đisymwyth i goỻ er ys peth
cannoeđ o flynyđoeđ yn ol, ond na wyđai neb i ba le. Rywfođ neu gilyđ
tarawođ gwr y tŷ ei ffon yn erbyn Rhyđerch, pa un a điflannođ mewn cawod
o lwch, ac ni chlywyd air o son beth đaeth o hono mwyach.
‘In one of the centuries gone by, there lived a husbandman on the farm of
Pantannas; and at that time the fairies used to pay frequent visits to several
of the fields which belonged to him. He cherished in his bosom a
considerable hatred for the “noisy, boisterous, and pernicious tribe,” as he
called them, and often did he long to be able to discover some way to rid
the place of them. At last he was told by an old witch that the way to get rid
of them was easy enough, and that she would tell him how to attain what he
so greatly wished, if he gave her one evening’s milking37 on his farm, and
one morning’s. He agreed to her conditions, and from her he received
advice, which was to the effect that he was to plough all the fields where
they had their favourite resorts, and that, if they found the green sward
gone, they would take offence, and never return to trouble him with their
visits to the spot.
‘The husbandman followed the advice to the letter, and his work was
crowned with success. Not a single one of them was now to be seen about
the fields, and, instead of the sound of their sweet music, which used to be
always heard rising from the Coarse Meadow Land, the most complete
silence now reigned over their favourite resort.
‘He sowed his land with wheat and other grain; the verdant spring had now
thrust winter off its throne, and the fields appeared splendid in their vernal
and green livery.
‘But one evening, when the sun had retired to the chambers of the west, and
when the farmer of Pantannas was returning home, he was met by a
diminutive being in the shape of a man, with a red coat on. When he had
come right up to him, he unsheathed his little sword, and, directing the
point towards the farmer, he said:—
Vengeance cometh,
Fast it approacheth.
‘The farmer tried to laugh, but there was something in the surly and stern
looks of the little fellow which made him feel exceedingly uncomfortable.
‘A few nights afterwards, as the family were retiring to rest, they were very
greatly frightened by a noise, as though the house was falling to pieces; and,
immediately after the noise, they heard a voice uttering loudly the
threatening words—and nothing more:—
Vengeance cometh.
‘When, however, the corn was reaped and ready to be carried to the barn, it
was, all of a sudden, burnt up one night, so that neither an ear nor a straw of
it could be found anywhere in the fields; and now nobody could have set
the corn on fire but the fairies.
‘As one may naturally suppose, the farmer felt very much on account of this
event, and he regretted in his heart having done according to the witch’s
direction, and having thereby brought upon him the anger and hatred of the
fairies.
‘The day after the night of the burning of the corn, as he was surveying the
destruction caused by the fire, behold the little fellow, who had met him a
few days before, met him again, and, with a challenging glance, he pointed
his sword towards him, saying:—
It but beginneth.