[R] shapiro.test

Greg Snow 538280 at gmail.com
Tue Feb 25 00:06:10 CET 2014


replies inline

On Sat, Feb 22, 2014 at 12:29 AM, Philippe Grosjean
<phgrosjean at sciviews.org> wrote:
> Greg,
> I really like that TeachingDemos::SnowsPenultimateNormalityTest()...

If you like that function then you may appreciate
which I suspect (but have been to lazy to check) may be the longest
exported function name in a CRAN package.  I justify the names of
these 2 functions using the same logic that suggests short and simple
names for functions that you would expect to be used often.

> even the tortuous way to always return a p-value == 0:

It turns out (discovered by accident and then brought to my attention)
that if you run SnowsPenultimateNormalityTest on a vector of length 0
then it does return a p-value of 1.  I have not yet decided if this is
a bug or a feature.  On one hand it makes sense that a sample of size
0 is perfectly consistent with the assumption that you chose 0
observations from a normal distribution, on the other hand, if it is
an integer or double vector of length 0 that would still be
information that the numbers (or lack thereof) are rational.


> I am just curious... Are there teachers out there pointing to that test? If yes, what fraction of the students realise what happens? I guess, it is closer to zero than to one, unfortunately. Wait... I need another SnowsPenultimateXxxxTest() here to check the null hypothesis that all my students are doing what they are supposed to do when discovering a new statistical tool!

I don't know of any teachers pointing to the test, I would want to be
careful which class to bring it up in.  For some students it could
result in an epiphany, others may just blindly use it, and still
others may have their heads explode if they have to think to hard
about it.

I was originally considering naming the test SnowsAntepenultimeateTest
to give a little more room for follow-up tests, but at the time I
could not remember if it was Ante (before) or Anti (opposite).  I
learned the word Antepenultimate in terms of pages in a book, where
the 3rd to last page (the Antepenultimate page) is directly opposite
(Anti-) the Penultimate page.

Just in case that is not confusing enough, the ultimate page of a
cheap detective novel is the last page where the hero realizes that
since the motive for the murder was to cover up the murderer's
embezzlement of the family fortune to pay off his bookie, the hero
will not be paid after all and will still need to continue avoiding
his loan shark.  The penultimate page is the second to last page where
in response to the hero's listing of circumstantial evidence the
murderer conveniently confesses and fills in all the missing details
saving the embarrassment to the hero if he had just lawyer-ed up and
been acquitted due to lack of hard evidence.  And the antepenultimate
page is the 3rd to last where the hero utters the cliche phrase "You
are probably wondering why I gathered you all here".  I don't know
what the 4th to last page would be called (could add another ante-, or
in R just use tail(book,4)).

Gregory (Greg) L. Snow Ph.D.
538280 at gmail.com

More information about the R-help mailing list